fields = 1;\n */\n this.fields = {};\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n const json = {};\n for (const [k, v] of Object.entries(this.fields)) {\n json[k] = v.toJson(options);\n }\n return json;\n }\n fromJson(json, options) {\n if (typeof json != \"object\" || json == null || Array.isArray(json)) {\n throw new Error(\"cannot decode google.protobuf.Struct from JSON \" + proto3_js_1.proto3.json.debug(json));\n }\n for (const [k, v] of Object.entries(json)) {\n this.fields[k] = Value.fromJson(v);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new Struct().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Struct().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Struct().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Struct, a, b);\n }\n}\nexports.Struct = Struct;\nStruct.runtime = proto3_js_1.proto3;\nStruct.typeName = \"google.protobuf.Struct\";\nStruct.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"fields\", kind: \"map\", K: 9 /* ScalarType.STRING */, V: { kind: \"message\", T: Value } },\n]);\n/**\n * `Value` represents a dynamically typed value which can be either\n * null, a number, a string, a boolean, a recursive struct value, or a\n * list of values. A producer of value is expected to set one of these\n * variants. Absence of any variant indicates an error.\n *\n * The JSON representation for `Value` is JSON value.\n *\n * @generated from message google.protobuf.Value\n */\nclass Value extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The kind of value.\n *\n * @generated from oneof google.protobuf.Value.kind\n */\n this.kind = { case: undefined };\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n switch (this.kind.case) {\n case \"nullValue\":\n return null;\n case \"numberValue\":\n if (!Number.isFinite(this.kind.value)) {\n throw new Error(\"google.protobuf.Value cannot be NaN or Infinity\");\n }\n return this.kind.value;\n case \"boolValue\":\n return this.kind.value;\n case \"stringValue\":\n return this.kind.value;\n case \"structValue\":\n case \"listValue\":\n return this.kind.value.toJson(Object.assign(Object.assign({}, options), { emitDefaultValues: true }));\n }\n throw new Error(\"google.protobuf.Value must have a value\");\n }\n fromJson(json, options) {\n switch (typeof json) {\n case \"number\":\n this.kind = { case: \"numberValue\", value: json };\n break;\n case \"string\":\n this.kind = { case: \"stringValue\", value: json };\n break;\n case \"boolean\":\n this.kind = { case: \"boolValue\", value: json };\n break;\n case \"object\":\n if (json === null) {\n this.kind = { case: \"nullValue\", value: NullValue.NULL_VALUE };\n }\n else if (Array.isArray(json)) {\n this.kind = { case: \"listValue\", value: ListValue.fromJson(json) };\n }\n else {\n this.kind = { case: \"structValue\", value: Struct.fromJson(json) };\n }\n break;\n default:\n throw new Error(\"cannot decode google.protobuf.Value from JSON \" + proto3_js_1.proto3.json.debug(json));\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new Value().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Value().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Value().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Value, a, b);\n }\n}\nexports.Value = Value;\nValue.runtime = proto3_js_1.proto3;\nValue.typeName = \"google.protobuf.Value\";\nValue.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"null_value\", kind: \"enum\", T: proto3_js_1.proto3.getEnumType(NullValue), oneof: \"kind\" },\n { no: 2, name: \"number_value\", kind: \"scalar\", T: 1 /* ScalarType.DOUBLE */, oneof: \"kind\" },\n { no: 3, name: \"string_value\", kind: \"scalar\", T: 9 /* ScalarType.STRING */, oneof: \"kind\" },\n { no: 4, name: \"bool_value\", kind: \"scalar\", T: 8 /* ScalarType.BOOL */, oneof: \"kind\" },\n { no: 5, name: \"struct_value\", kind: \"message\", T: Struct, oneof: \"kind\" },\n { no: 6, name: \"list_value\", kind: \"message\", T: ListValue, oneof: \"kind\" },\n]);\n/**\n * `ListValue` is a wrapper around a repeated field of values.\n *\n * The JSON representation for `ListValue` is JSON array.\n *\n * @generated from message google.protobuf.ListValue\n */\nclass ListValue extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * Repeated field of dynamically typed values.\n *\n * @generated from field: repeated google.protobuf.Value values = 1;\n */\n this.values = [];\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return this.values.map(v => v.toJson());\n }\n fromJson(json, options) {\n if (!Array.isArray(json)) {\n throw new Error(\"cannot decode google.protobuf.ListValue from JSON \" + proto3_js_1.proto3.json.debug(json));\n }\n for (let e of json) {\n this.values.push(Value.fromJson(e));\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new ListValue().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new ListValue().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new ListValue().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(ListValue, a, b);\n }\n}\nexports.ListValue = ListValue;\nListValue.runtime = proto3_js_1.proto3;\nListValue.typeName = \"google.protobuf.ListValue\";\nListValue.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"values\", kind: \"message\", T: Value, repeated: true },\n]);\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Timestamp = void 0;\nconst message_js_1 = require(\"../../message.js\");\nconst proto_int64_js_1 = require(\"../../proto-int64.js\");\nconst proto3_js_1 = require(\"../../proto3.js\");\n/**\n * A Timestamp represents a point in time independent of any time zone or local\n * calendar, encoded as a count of seconds and fractions of seconds at\n * nanosecond resolution. The count is relative to an epoch at UTC midnight on\n * January 1, 1970, in the proleptic Gregorian calendar which extends the\n * Gregorian calendar backwards to year one.\n *\n * All minutes are 60 seconds long. Leap seconds are \"smeared\" so that no leap\n * second table is needed for interpretation, using a [24-hour linear\n * smear](https://developers.google.com/time/smear).\n *\n * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By\n * restricting to that range, we ensure that we can convert to and from [RFC\n * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings.\n *\n * # Examples\n *\n * Example 1: Compute Timestamp from POSIX `time()`.\n *\n * Timestamp timestamp;\n * timestamp.set_seconds(time(NULL));\n * timestamp.set_nanos(0);\n *\n * Example 2: Compute Timestamp from POSIX `gettimeofday()`.\n *\n * struct timeval tv;\n * gettimeofday(&tv, NULL);\n *\n * Timestamp timestamp;\n * timestamp.set_seconds(tv.tv_sec);\n * timestamp.set_nanos(tv.tv_usec * 1000);\n *\n * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`.\n *\n * FILETIME ft;\n * GetSystemTimeAsFileTime(&ft);\n * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;\n *\n * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z\n * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z.\n * Timestamp timestamp;\n * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL));\n * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100));\n *\n * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`.\n *\n * long millis = System.currentTimeMillis();\n *\n * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000)\n * .setNanos((int) ((millis % 1000) * 1000000)).build();\n *\n * Example 5: Compute Timestamp from Java `Instant.now()`.\n *\n * Instant now = Instant.now();\n *\n * Timestamp timestamp =\n * Timestamp.newBuilder().setSeconds(now.getEpochSecond())\n * .setNanos(now.getNano()).build();\n *\n * Example 6: Compute Timestamp from current time in Python.\n *\n * timestamp = Timestamp()\n * timestamp.GetCurrentTime()\n *\n * # JSON Mapping\n *\n * In JSON format, the Timestamp type is encoded as a string in the\n * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the\n * format is \"{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z\"\n * where {year} is always expressed using four digits while {month}, {day},\n * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional\n * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),\n * are optional. The \"Z\" suffix indicates the timezone (\"UTC\"); the timezone\n * is required. A proto3 JSON serializer should always use UTC (as indicated by\n * \"Z\") when printing the Timestamp type and a proto3 JSON parser should be\n * able to accept both UTC and other timezones (as indicated by an offset).\n *\n * For example, \"2017-01-15T01:30:15.01Z\" encodes 15.01 seconds past\n * 01:30 UTC on January 15, 2017.\n *\n * In JavaScript, one can convert a Date object to this format using the\n * standard\n * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString)\n * method. In Python, a standard `datetime.datetime` object can be converted\n * to this format using\n * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with\n * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use\n * the Joda Time's [`ISODateTimeFormat.dateTime()`](\n * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()\n * ) to obtain a formatter capable of generating timestamps in this format.\n *\n *\n * @generated from message google.protobuf.Timestamp\n */\nclass Timestamp extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n *\n * @generated from field: int64 seconds = 1;\n */\n this.seconds = proto_int64_js_1.protoInt64.zero;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n *\n * @generated from field: int32 nanos = 2;\n */\n this.nanos = 0;\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n fromJson(json, options) {\n if (typeof json !== \"string\") {\n throw new Error(`cannot decode google.protobuf.Timestamp from JSON: ${proto3_js_1.proto3.json.debug(json)}`);\n }\n const matches = json.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]))$/);\n if (!matches) {\n throw new Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);\n }\n const ms = Date.parse(matches[1] + \"-\" + matches[2] + \"-\" + matches[3] + \"T\" + matches[4] + \":\" + matches[5] + \":\" + matches[6] + (matches[8] ? matches[8] : \"Z\"));\n if (Number.isNaN(ms)) {\n throw new Error(`cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string`);\n }\n if (ms < Date.parse(\"0001-01-01T00:00:00Z\") || ms > Date.parse(\"9999-12-31T23:59:59Z\")) {\n throw new Error(`cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);\n }\n this.seconds = proto_int64_js_1.protoInt64.parse(ms / 1000);\n this.nanos = 0;\n if (matches[7]) {\n this.nanos = (parseInt(\"1\" + matches[7] + \"0\".repeat(9 - matches[7].length)) - 1000000000);\n }\n return this;\n }\n toJson(options) {\n const ms = Number(this.seconds) * 1000;\n if (ms < Date.parse(\"0001-01-01T00:00:00Z\") || ms > Date.parse(\"9999-12-31T23:59:59Z\")) {\n throw new Error(`cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive`);\n }\n if (this.nanos < 0) {\n throw new Error(`cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative`);\n }\n let z = \"Z\";\n if (this.nanos > 0) {\n const nanosStr = (this.nanos + 1000000000).toString().substring(1);\n if (nanosStr.substring(3) === \"000000\") {\n z = \".\" + nanosStr.substring(0, 3) + \"Z\";\n }\n else if (nanosStr.substring(6) === \"000\") {\n z = \".\" + nanosStr.substring(0, 6) + \"Z\";\n }\n else {\n z = \".\" + nanosStr + \"Z\";\n }\n }\n return new Date(ms).toISOString().replace(\".000Z\", z);\n }\n toDate() {\n return new Date(Number(this.seconds) * 1000 + Math.ceil(this.nanos / 1000000));\n }\n static now() {\n return Timestamp.fromDate(new Date());\n }\n static fromDate(date) {\n const ms = date.getTime();\n return new Timestamp({\n seconds: proto_int64_js_1.protoInt64.parse(Math.floor(ms / 1000)),\n nanos: (ms % 1000) * 1000000,\n });\n }\n static fromBinary(bytes, options) {\n return new Timestamp().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Timestamp().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Timestamp().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Timestamp, a, b);\n }\n}\nexports.Timestamp = Timestamp;\nTimestamp.runtime = proto3_js_1.proto3;\nTimestamp.typeName = \"google.protobuf.Timestamp\";\nTimestamp.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"seconds\", kind: \"scalar\", T: 3 /* ScalarType.INT64 */ },\n { no: 2, name: \"nanos\", kind: \"scalar\", T: 5 /* ScalarType.INT32 */ },\n]);\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Option = exports.EnumValue = exports.Enum = exports.Field_Cardinality = exports.Field_Kind = exports.Field = exports.Type = exports.Syntax = void 0;\n// @generated by protoc-gen-es v1.3.0 with parameter \"bootstrap_wkt=true,ts_nocheck=false,target=ts\"\n// @generated from file google/protobuf/type.proto (package google.protobuf, syntax proto3)\n/* eslint-disable */\nconst proto3_js_1 = require(\"../../proto3.js\");\nconst message_js_1 = require(\"../../message.js\");\nconst source_context_pb_js_1 = require(\"./source_context_pb.js\");\nconst any_pb_js_1 = require(\"./any_pb.js\");\n/**\n * The syntax in which a protocol buffer element is defined.\n *\n * @generated from enum google.protobuf.Syntax\n */\nvar Syntax;\n(function (Syntax) {\n /**\n * Syntax `proto2`.\n *\n * @generated from enum value: SYNTAX_PROTO2 = 0;\n */\n Syntax[Syntax[\"PROTO2\"] = 0] = \"PROTO2\";\n /**\n * Syntax `proto3`.\n *\n * @generated from enum value: SYNTAX_PROTO3 = 1;\n */\n Syntax[Syntax[\"PROTO3\"] = 1] = \"PROTO3\";\n /**\n * Syntax `editions`.\n *\n * @generated from enum value: SYNTAX_EDITIONS = 2;\n */\n Syntax[Syntax[\"EDITIONS\"] = 2] = \"EDITIONS\";\n})(Syntax || (exports.Syntax = Syntax = {}));\n// Retrieve enum metadata with: proto3.getEnumType(Syntax)\nproto3_js_1.proto3.util.setEnumType(Syntax, \"google.protobuf.Syntax\", [\n { no: 0, name: \"SYNTAX_PROTO2\" },\n { no: 1, name: \"SYNTAX_PROTO3\" },\n { no: 2, name: \"SYNTAX_EDITIONS\" },\n]);\n/**\n * A protocol buffer message type.\n *\n * @generated from message google.protobuf.Type\n */\nclass Type extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The fully qualified message name.\n *\n * @generated from field: string name = 1;\n */\n this.name = \"\";\n /**\n * The list of fields.\n *\n * @generated from field: repeated google.protobuf.Field fields = 2;\n */\n this.fields = [];\n /**\n * The list of types appearing in `oneof` definitions in this type.\n *\n * @generated from field: repeated string oneofs = 3;\n */\n this.oneofs = [];\n /**\n * The protocol buffer options.\n *\n * @generated from field: repeated google.protobuf.Option options = 4;\n */\n this.options = [];\n /**\n * The source syntax.\n *\n * @generated from field: google.protobuf.Syntax syntax = 6;\n */\n this.syntax = Syntax.PROTO2;\n /**\n * The source edition string, only valid when syntax is SYNTAX_EDITIONS.\n *\n * @generated from field: string edition = 7;\n */\n this.edition = \"\";\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n static fromBinary(bytes, options) {\n return new Type().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Type().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Type().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Type, a, b);\n }\n}\nexports.Type = Type;\nType.runtime = proto3_js_1.proto3;\nType.typeName = \"google.protobuf.Type\";\nType.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"name\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n { no: 2, name: \"fields\", kind: \"message\", T: Field, repeated: true },\n { no: 3, name: \"oneofs\", kind: \"scalar\", T: 9 /* ScalarType.STRING */, repeated: true },\n { no: 4, name: \"options\", kind: \"message\", T: Option, repeated: true },\n { no: 5, name: \"source_context\", kind: \"message\", T: source_context_pb_js_1.SourceContext },\n { no: 6, name: \"syntax\", kind: \"enum\", T: proto3_js_1.proto3.getEnumType(Syntax) },\n { no: 7, name: \"edition\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n]);\n/**\n * A single field of a message type.\n *\n * @generated from message google.protobuf.Field\n */\nclass Field extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The field type.\n *\n * @generated from field: google.protobuf.Field.Kind kind = 1;\n */\n this.kind = Field_Kind.TYPE_UNKNOWN;\n /**\n * The field cardinality.\n *\n * @generated from field: google.protobuf.Field.Cardinality cardinality = 2;\n */\n this.cardinality = Field_Cardinality.UNKNOWN;\n /**\n * The field number.\n *\n * @generated from field: int32 number = 3;\n */\n this.number = 0;\n /**\n * The field name.\n *\n * @generated from field: string name = 4;\n */\n this.name = \"\";\n /**\n * The field type URL, without the scheme, for message or enumeration\n * types. Example: `\"type.googleapis.com/google.protobuf.Timestamp\"`.\n *\n * @generated from field: string type_url = 6;\n */\n this.typeUrl = \"\";\n /**\n * The index of the field type in `Type.oneofs`, for message or enumeration\n * types. The first type has index 1; zero means the type is not in the list.\n *\n * @generated from field: int32 oneof_index = 7;\n */\n this.oneofIndex = 0;\n /**\n * Whether to use alternative packed wire representation.\n *\n * @generated from field: bool packed = 8;\n */\n this.packed = false;\n /**\n * The protocol buffer options.\n *\n * @generated from field: repeated google.protobuf.Option options = 9;\n */\n this.options = [];\n /**\n * The field JSON name.\n *\n * @generated from field: string json_name = 10;\n */\n this.jsonName = \"\";\n /**\n * The string value of the default value of this field. Proto2 syntax only.\n *\n * @generated from field: string default_value = 11;\n */\n this.defaultValue = \"\";\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n static fromBinary(bytes, options) {\n return new Field().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Field().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Field().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Field, a, b);\n }\n}\nexports.Field = Field;\nField.runtime = proto3_js_1.proto3;\nField.typeName = \"google.protobuf.Field\";\nField.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"kind\", kind: \"enum\", T: proto3_js_1.proto3.getEnumType(Field_Kind) },\n { no: 2, name: \"cardinality\", kind: \"enum\", T: proto3_js_1.proto3.getEnumType(Field_Cardinality) },\n { no: 3, name: \"number\", kind: \"scalar\", T: 5 /* ScalarType.INT32 */ },\n { no: 4, name: \"name\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n { no: 6, name: \"type_url\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n { no: 7, name: \"oneof_index\", kind: \"scalar\", T: 5 /* ScalarType.INT32 */ },\n { no: 8, name: \"packed\", kind: \"scalar\", T: 8 /* ScalarType.BOOL */ },\n { no: 9, name: \"options\", kind: \"message\", T: Option, repeated: true },\n { no: 10, name: \"json_name\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n { no: 11, name: \"default_value\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n]);\n/**\n * Basic field types.\n *\n * @generated from enum google.protobuf.Field.Kind\n */\nvar Field_Kind;\n(function (Field_Kind) {\n /**\n * Field type unknown.\n *\n * @generated from enum value: TYPE_UNKNOWN = 0;\n */\n Field_Kind[Field_Kind[\"TYPE_UNKNOWN\"] = 0] = \"TYPE_UNKNOWN\";\n /**\n * Field type double.\n *\n * @generated from enum value: TYPE_DOUBLE = 1;\n */\n Field_Kind[Field_Kind[\"TYPE_DOUBLE\"] = 1] = \"TYPE_DOUBLE\";\n /**\n * Field type float.\n *\n * @generated from enum value: TYPE_FLOAT = 2;\n */\n Field_Kind[Field_Kind[\"TYPE_FLOAT\"] = 2] = \"TYPE_FLOAT\";\n /**\n * Field type int64.\n *\n * @generated from enum value: TYPE_INT64 = 3;\n */\n Field_Kind[Field_Kind[\"TYPE_INT64\"] = 3] = \"TYPE_INT64\";\n /**\n * Field type uint64.\n *\n * @generated from enum value: TYPE_UINT64 = 4;\n */\n Field_Kind[Field_Kind[\"TYPE_UINT64\"] = 4] = \"TYPE_UINT64\";\n /**\n * Field type int32.\n *\n * @generated from enum value: TYPE_INT32 = 5;\n */\n Field_Kind[Field_Kind[\"TYPE_INT32\"] = 5] = \"TYPE_INT32\";\n /**\n * Field type fixed64.\n *\n * @generated from enum value: TYPE_FIXED64 = 6;\n */\n Field_Kind[Field_Kind[\"TYPE_FIXED64\"] = 6] = \"TYPE_FIXED64\";\n /**\n * Field type fixed32.\n *\n * @generated from enum value: TYPE_FIXED32 = 7;\n */\n Field_Kind[Field_Kind[\"TYPE_FIXED32\"] = 7] = \"TYPE_FIXED32\";\n /**\n * Field type bool.\n *\n * @generated from enum value: TYPE_BOOL = 8;\n */\n Field_Kind[Field_Kind[\"TYPE_BOOL\"] = 8] = \"TYPE_BOOL\";\n /**\n * Field type string.\n *\n * @generated from enum value: TYPE_STRING = 9;\n */\n Field_Kind[Field_Kind[\"TYPE_STRING\"] = 9] = \"TYPE_STRING\";\n /**\n * Field type group. Proto2 syntax only, and deprecated.\n *\n * @generated from enum value: TYPE_GROUP = 10;\n */\n Field_Kind[Field_Kind[\"TYPE_GROUP\"] = 10] = \"TYPE_GROUP\";\n /**\n * Field type message.\n *\n * @generated from enum value: TYPE_MESSAGE = 11;\n */\n Field_Kind[Field_Kind[\"TYPE_MESSAGE\"] = 11] = \"TYPE_MESSAGE\";\n /**\n * Field type bytes.\n *\n * @generated from enum value: TYPE_BYTES = 12;\n */\n Field_Kind[Field_Kind[\"TYPE_BYTES\"] = 12] = \"TYPE_BYTES\";\n /**\n * Field type uint32.\n *\n * @generated from enum value: TYPE_UINT32 = 13;\n */\n Field_Kind[Field_Kind[\"TYPE_UINT32\"] = 13] = \"TYPE_UINT32\";\n /**\n * Field type enum.\n *\n * @generated from enum value: TYPE_ENUM = 14;\n */\n Field_Kind[Field_Kind[\"TYPE_ENUM\"] = 14] = \"TYPE_ENUM\";\n /**\n * Field type sfixed32.\n *\n * @generated from enum value: TYPE_SFIXED32 = 15;\n */\n Field_Kind[Field_Kind[\"TYPE_SFIXED32\"] = 15] = \"TYPE_SFIXED32\";\n /**\n * Field type sfixed64.\n *\n * @generated from enum value: TYPE_SFIXED64 = 16;\n */\n Field_Kind[Field_Kind[\"TYPE_SFIXED64\"] = 16] = \"TYPE_SFIXED64\";\n /**\n * Field type sint32.\n *\n * @generated from enum value: TYPE_SINT32 = 17;\n */\n Field_Kind[Field_Kind[\"TYPE_SINT32\"] = 17] = \"TYPE_SINT32\";\n /**\n * Field type sint64.\n *\n * @generated from enum value: TYPE_SINT64 = 18;\n */\n Field_Kind[Field_Kind[\"TYPE_SINT64\"] = 18] = \"TYPE_SINT64\";\n})(Field_Kind || (exports.Field_Kind = Field_Kind = {}));\n// Retrieve enum metadata with: proto3.getEnumType(Field_Kind)\nproto3_js_1.proto3.util.setEnumType(Field_Kind, \"google.protobuf.Field.Kind\", [\n { no: 0, name: \"TYPE_UNKNOWN\" },\n { no: 1, name: \"TYPE_DOUBLE\" },\n { no: 2, name: \"TYPE_FLOAT\" },\n { no: 3, name: \"TYPE_INT64\" },\n { no: 4, name: \"TYPE_UINT64\" },\n { no: 5, name: \"TYPE_INT32\" },\n { no: 6, name: \"TYPE_FIXED64\" },\n { no: 7, name: \"TYPE_FIXED32\" },\n { no: 8, name: \"TYPE_BOOL\" },\n { no: 9, name: \"TYPE_STRING\" },\n { no: 10, name: \"TYPE_GROUP\" },\n { no: 11, name: \"TYPE_MESSAGE\" },\n { no: 12, name: \"TYPE_BYTES\" },\n { no: 13, name: \"TYPE_UINT32\" },\n { no: 14, name: \"TYPE_ENUM\" },\n { no: 15, name: \"TYPE_SFIXED32\" },\n { no: 16, name: \"TYPE_SFIXED64\" },\n { no: 17, name: \"TYPE_SINT32\" },\n { no: 18, name: \"TYPE_SINT64\" },\n]);\n/**\n * Whether a field is optional, required, or repeated.\n *\n * @generated from enum google.protobuf.Field.Cardinality\n */\nvar Field_Cardinality;\n(function (Field_Cardinality) {\n /**\n * For fields with unknown cardinality.\n *\n * @generated from enum value: CARDINALITY_UNKNOWN = 0;\n */\n Field_Cardinality[Field_Cardinality[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n /**\n * For optional fields.\n *\n * @generated from enum value: CARDINALITY_OPTIONAL = 1;\n */\n Field_Cardinality[Field_Cardinality[\"OPTIONAL\"] = 1] = \"OPTIONAL\";\n /**\n * For required fields. Proto2 syntax only.\n *\n * @generated from enum value: CARDINALITY_REQUIRED = 2;\n */\n Field_Cardinality[Field_Cardinality[\"REQUIRED\"] = 2] = \"REQUIRED\";\n /**\n * For repeated fields.\n *\n * @generated from enum value: CARDINALITY_REPEATED = 3;\n */\n Field_Cardinality[Field_Cardinality[\"REPEATED\"] = 3] = \"REPEATED\";\n})(Field_Cardinality || (exports.Field_Cardinality = Field_Cardinality = {}));\n// Retrieve enum metadata with: proto3.getEnumType(Field_Cardinality)\nproto3_js_1.proto3.util.setEnumType(Field_Cardinality, \"google.protobuf.Field.Cardinality\", [\n { no: 0, name: \"CARDINALITY_UNKNOWN\" },\n { no: 1, name: \"CARDINALITY_OPTIONAL\" },\n { no: 2, name: \"CARDINALITY_REQUIRED\" },\n { no: 3, name: \"CARDINALITY_REPEATED\" },\n]);\n/**\n * Enum type definition.\n *\n * @generated from message google.protobuf.Enum\n */\nclass Enum extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * Enum type name.\n *\n * @generated from field: string name = 1;\n */\n this.name = \"\";\n /**\n * Enum value definitions.\n *\n * @generated from field: repeated google.protobuf.EnumValue enumvalue = 2;\n */\n this.enumvalue = [];\n /**\n * Protocol buffer options.\n *\n * @generated from field: repeated google.protobuf.Option options = 3;\n */\n this.options = [];\n /**\n * The source syntax.\n *\n * @generated from field: google.protobuf.Syntax syntax = 5;\n */\n this.syntax = Syntax.PROTO2;\n /**\n * The source edition string, only valid when syntax is SYNTAX_EDITIONS.\n *\n * @generated from field: string edition = 6;\n */\n this.edition = \"\";\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n static fromBinary(bytes, options) {\n return new Enum().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Enum().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Enum().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Enum, a, b);\n }\n}\nexports.Enum = Enum;\nEnum.runtime = proto3_js_1.proto3;\nEnum.typeName = \"google.protobuf.Enum\";\nEnum.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"name\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n { no: 2, name: \"enumvalue\", kind: \"message\", T: EnumValue, repeated: true },\n { no: 3, name: \"options\", kind: \"message\", T: Option, repeated: true },\n { no: 4, name: \"source_context\", kind: \"message\", T: source_context_pb_js_1.SourceContext },\n { no: 5, name: \"syntax\", kind: \"enum\", T: proto3_js_1.proto3.getEnumType(Syntax) },\n { no: 6, name: \"edition\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n]);\n/**\n * Enum value definition.\n *\n * @generated from message google.protobuf.EnumValue\n */\nclass EnumValue extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * Enum value name.\n *\n * @generated from field: string name = 1;\n */\n this.name = \"\";\n /**\n * Enum value number.\n *\n * @generated from field: int32 number = 2;\n */\n this.number = 0;\n /**\n * Protocol buffer options.\n *\n * @generated from field: repeated google.protobuf.Option options = 3;\n */\n this.options = [];\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n static fromBinary(bytes, options) {\n return new EnumValue().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new EnumValue().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new EnumValue().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(EnumValue, a, b);\n }\n}\nexports.EnumValue = EnumValue;\nEnumValue.runtime = proto3_js_1.proto3;\nEnumValue.typeName = \"google.protobuf.EnumValue\";\nEnumValue.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"name\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n { no: 2, name: \"number\", kind: \"scalar\", T: 5 /* ScalarType.INT32 */ },\n { no: 3, name: \"options\", kind: \"message\", T: Option, repeated: true },\n]);\n/**\n * A protocol buffer option, which can be attached to a message, field,\n * enumeration, etc.\n *\n * @generated from message google.protobuf.Option\n */\nclass Option extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The option's name. For protobuf built-in options (options defined in\n * descriptor.proto), this is the short name. For example, `\"map_entry\"`.\n * For custom options, it should be the fully-qualified name. For example,\n * `\"google.api.http\"`.\n *\n * @generated from field: string name = 1;\n */\n this.name = \"\";\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n static fromBinary(bytes, options) {\n return new Option().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Option().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Option().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Option, a, b);\n }\n}\nexports.Option = Option;\nOption.runtime = proto3_js_1.proto3;\nOption.typeName = \"google.protobuf.Option\";\nOption.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"name\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n { no: 2, name: \"value\", kind: \"message\", T: any_pb_js_1.Any },\n]);\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BytesValue = exports.StringValue = exports.BoolValue = exports.UInt32Value = exports.Int32Value = exports.UInt64Value = exports.Int64Value = exports.FloatValue = exports.DoubleValue = void 0;\nconst message_js_1 = require(\"../../message.js\");\nconst proto3_js_1 = require(\"../../proto3.js\");\nconst field_js_1 = require(\"../../field.js\");\nconst proto_int64_js_1 = require(\"../../proto-int64.js\");\n/**\n * Wrapper message for `double`.\n *\n * The JSON representation for `DoubleValue` is JSON number.\n *\n * @generated from message google.protobuf.DoubleValue\n */\nclass DoubleValue extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The double value.\n *\n * @generated from field: double value = 1;\n */\n this.value = 0;\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.DOUBLE, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.DOUBLE, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.DoubleValue from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new DoubleValue().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new DoubleValue().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new DoubleValue().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(DoubleValue, a, b);\n }\n}\nexports.DoubleValue = DoubleValue;\nDoubleValue.runtime = proto3_js_1.proto3;\nDoubleValue.typeName = \"google.protobuf.DoubleValue\";\nDoubleValue.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 1 /* ScalarType.DOUBLE */ },\n]);\nDoubleValue.fieldWrapper = {\n wrapField(value) {\n return new DoubleValue({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n/**\n * Wrapper message for `float`.\n *\n * The JSON representation for `FloatValue` is JSON number.\n *\n * @generated from message google.protobuf.FloatValue\n */\nclass FloatValue extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The float value.\n *\n * @generated from field: float value = 1;\n */\n this.value = 0;\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.FLOAT, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.FLOAT, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.FloatValue from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new FloatValue().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new FloatValue().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new FloatValue().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(FloatValue, a, b);\n }\n}\nexports.FloatValue = FloatValue;\nFloatValue.runtime = proto3_js_1.proto3;\nFloatValue.typeName = \"google.protobuf.FloatValue\";\nFloatValue.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 2 /* ScalarType.FLOAT */ },\n]);\nFloatValue.fieldWrapper = {\n wrapField(value) {\n return new FloatValue({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n/**\n * Wrapper message for `int64`.\n *\n * The JSON representation for `Int64Value` is JSON string.\n *\n * @generated from message google.protobuf.Int64Value\n */\nclass Int64Value extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The int64 value.\n *\n * @generated from field: int64 value = 1;\n */\n this.value = proto_int64_js_1.protoInt64.zero;\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.INT64, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.INT64, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.Int64Value from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new Int64Value().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Int64Value().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Int64Value().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Int64Value, a, b);\n }\n}\nexports.Int64Value = Int64Value;\nInt64Value.runtime = proto3_js_1.proto3;\nInt64Value.typeName = \"google.protobuf.Int64Value\";\nInt64Value.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 3 /* ScalarType.INT64 */ },\n]);\nInt64Value.fieldWrapper = {\n wrapField(value) {\n return new Int64Value({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n/**\n * Wrapper message for `uint64`.\n *\n * The JSON representation for `UInt64Value` is JSON string.\n *\n * @generated from message google.protobuf.UInt64Value\n */\nclass UInt64Value extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The uint64 value.\n *\n * @generated from field: uint64 value = 1;\n */\n this.value = proto_int64_js_1.protoInt64.zero;\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.UINT64, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.UINT64, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.UInt64Value from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new UInt64Value().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new UInt64Value().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new UInt64Value().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(UInt64Value, a, b);\n }\n}\nexports.UInt64Value = UInt64Value;\nUInt64Value.runtime = proto3_js_1.proto3;\nUInt64Value.typeName = \"google.protobuf.UInt64Value\";\nUInt64Value.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 4 /* ScalarType.UINT64 */ },\n]);\nUInt64Value.fieldWrapper = {\n wrapField(value) {\n return new UInt64Value({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n/**\n * Wrapper message for `int32`.\n *\n * The JSON representation for `Int32Value` is JSON number.\n *\n * @generated from message google.protobuf.Int32Value\n */\nclass Int32Value extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The int32 value.\n *\n * @generated from field: int32 value = 1;\n */\n this.value = 0;\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.INT32, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.INT32, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.Int32Value from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new Int32Value().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Int32Value().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Int32Value().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(Int32Value, a, b);\n }\n}\nexports.Int32Value = Int32Value;\nInt32Value.runtime = proto3_js_1.proto3;\nInt32Value.typeName = \"google.protobuf.Int32Value\";\nInt32Value.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 5 /* ScalarType.INT32 */ },\n]);\nInt32Value.fieldWrapper = {\n wrapField(value) {\n return new Int32Value({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n/**\n * Wrapper message for `uint32`.\n *\n * The JSON representation for `UInt32Value` is JSON number.\n *\n * @generated from message google.protobuf.UInt32Value\n */\nclass UInt32Value extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The uint32 value.\n *\n * @generated from field: uint32 value = 1;\n */\n this.value = 0;\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.UINT32, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.UINT32, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.UInt32Value from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new UInt32Value().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new UInt32Value().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new UInt32Value().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(UInt32Value, a, b);\n }\n}\nexports.UInt32Value = UInt32Value;\nUInt32Value.runtime = proto3_js_1.proto3;\nUInt32Value.typeName = \"google.protobuf.UInt32Value\";\nUInt32Value.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 13 /* ScalarType.UINT32 */ },\n]);\nUInt32Value.fieldWrapper = {\n wrapField(value) {\n return new UInt32Value({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n/**\n * Wrapper message for `bool`.\n *\n * The JSON representation for `BoolValue` is JSON `true` and `false`.\n *\n * @generated from message google.protobuf.BoolValue\n */\nclass BoolValue extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The bool value.\n *\n * @generated from field: bool value = 1;\n */\n this.value = false;\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.BOOL, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.BOOL, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.BoolValue from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new BoolValue().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new BoolValue().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new BoolValue().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(BoolValue, a, b);\n }\n}\nexports.BoolValue = BoolValue;\nBoolValue.runtime = proto3_js_1.proto3;\nBoolValue.typeName = \"google.protobuf.BoolValue\";\nBoolValue.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 8 /* ScalarType.BOOL */ },\n]);\nBoolValue.fieldWrapper = {\n wrapField(value) {\n return new BoolValue({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n/**\n * Wrapper message for `string`.\n *\n * The JSON representation for `StringValue` is JSON string.\n *\n * @generated from message google.protobuf.StringValue\n */\nclass StringValue extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The string value.\n *\n * @generated from field: string value = 1;\n */\n this.value = \"\";\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.STRING, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.STRING, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.StringValue from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new StringValue().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new StringValue().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new StringValue().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(StringValue, a, b);\n }\n}\nexports.StringValue = StringValue;\nStringValue.runtime = proto3_js_1.proto3;\nStringValue.typeName = \"google.protobuf.StringValue\";\nStringValue.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n]);\nStringValue.fieldWrapper = {\n wrapField(value) {\n return new StringValue({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n/**\n * Wrapper message for `bytes`.\n *\n * The JSON representation for `BytesValue` is JSON string.\n *\n * @generated from message google.protobuf.BytesValue\n */\nclass BytesValue extends message_js_1.Message {\n constructor(data) {\n super();\n /**\n * The bytes value.\n *\n * @generated from field: bytes value = 1;\n */\n this.value = new Uint8Array(0);\n proto3_js_1.proto3.util.initPartial(data, this);\n }\n toJson(options) {\n return proto3_js_1.proto3.json.writeScalar(field_js_1.ScalarType.BYTES, this.value, true);\n }\n fromJson(json, options) {\n try {\n this.value = proto3_js_1.proto3.json.readScalar(field_js_1.ScalarType.BYTES, json);\n }\n catch (e) {\n let m = `cannot decode message google.protobuf.BytesValue from JSON\"`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n return this;\n }\n static fromBinary(bytes, options) {\n return new BytesValue().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new BytesValue().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new BytesValue().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3_js_1.proto3.util.equals(BytesValue, a, b);\n }\n}\nexports.BytesValue = BytesValue;\nBytesValue.runtime = proto3_js_1.proto3;\nBytesValue.typeName = \"google.protobuf.BytesValue\";\nBytesValue.fields = proto3_js_1.proto3.util.newFieldList(() => [\n { no: 1, name: \"value\", kind: \"scalar\", T: 12 /* ScalarType.BYTES */ },\n]);\nBytesValue.fieldWrapper = {\n wrapField(value) {\n return new BytesValue({ value });\n },\n unwrapField(value) {\n return value.value;\n }\n};\n","\"use strict\";\n// Copyright 2008 Google Inc. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Code generated by the Protocol Buffer compiler is owned by the owner\n// of the input file used when generating it. This code is not\n// standalone and requires a support library to be linked with it. This\n// support library is itself covered by the above license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.varint32read = exports.varint32write = exports.uInt64ToString = exports.int64ToString = exports.int64FromString = exports.varint64write = exports.varint64read = void 0;\n/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */\n/**\n * Read a 64 bit varint as two JS numbers.\n *\n * Returns tuple:\n * [0]: low bits\n * [1]: high bits\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175\n */\nfunction varint64read() {\n let lowBits = 0;\n let highBits = 0;\n for (let shift = 0; shift < 28; shift += 7) {\n let b = this.buf[this.pos++];\n lowBits |= (b & 0x7f) << shift;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n }\n let middleByte = this.buf[this.pos++];\n // last four bits of the first 32 bit number\n lowBits |= (middleByte & 0x0f) << 28;\n // 3 upper bits are part of the next 32 bit number\n highBits = (middleByte & 0x70) >> 4;\n if ((middleByte & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n for (let shift = 3; shift <= 31; shift += 7) {\n let b = this.buf[this.pos++];\n highBits |= (b & 0x7f) << shift;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n }\n throw new Error(\"invalid varint\");\n}\nexports.varint64read = varint64read;\n/**\n * Write a 64 bit varint, given as two JS numbers, to the given bytes array.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344\n */\nfunction varint64write(lo, hi, bytes) {\n for (let i = 0; i < 28; i = i + 7) {\n const shift = lo >>> i;\n const hasNext = !(shift >>> 7 == 0 && hi == 0);\n const byte = (hasNext ? shift | 0x80 : shift) & 0xff;\n bytes.push(byte);\n if (!hasNext) {\n return;\n }\n }\n const splitBits = ((lo >>> 28) & 0x0f) | ((hi & 0x07) << 4);\n const hasMoreBits = !(hi >> 3 == 0);\n bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xff);\n if (!hasMoreBits) {\n return;\n }\n for (let i = 3; i < 31; i = i + 7) {\n const shift = hi >>> i;\n const hasNext = !(shift >>> 7 == 0);\n const byte = (hasNext ? shift | 0x80 : shift) & 0xff;\n bytes.push(byte);\n if (!hasNext) {\n return;\n }\n }\n bytes.push((hi >>> 31) & 0x01);\n}\nexports.varint64write = varint64write;\n// constants for binary math\nconst TWO_PWR_32_DBL = 0x100000000;\n/**\n * Parse decimal string of 64 bit integer value as two JS numbers.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nfunction int64FromString(dec) {\n // Check for minus sign.\n const minus = dec[0] === \"-\";\n if (minus) {\n dec = dec.slice(1);\n }\n // Work 6 decimal digits at a time, acting like we're converting base 1e6\n // digits to binary. This is safe to do with floating point math because\n // Number.isSafeInteger(ALL_32_BITS * 1e6) == true.\n const base = 1e6;\n let lowBits = 0;\n let highBits = 0;\n function add1e6digit(begin, end) {\n // Note: Number('') is 0.\n const digit1e6 = Number(dec.slice(begin, end));\n highBits *= base;\n lowBits = lowBits * base + digit1e6;\n // Carry bits from lowBits to\n if (lowBits >= TWO_PWR_32_DBL) {\n highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0);\n lowBits = lowBits % TWO_PWR_32_DBL;\n }\n }\n add1e6digit(-24, -18);\n add1e6digit(-18, -12);\n add1e6digit(-12, -6);\n add1e6digit(-6);\n return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits);\n}\nexports.int64FromString = int64FromString;\n/**\n * Losslessly converts a 64-bit signed integer in 32:32 split representation\n * into a decimal string.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nfunction int64ToString(lo, hi) {\n let bits = newBits(lo, hi);\n // If we're treating the input as a signed value and the high bit is set, do\n // a manual two's complement conversion before the decimal conversion.\n const negative = (bits.hi & 0x80000000);\n if (negative) {\n bits = negate(bits.lo, bits.hi);\n }\n const result = uInt64ToString(bits.lo, bits.hi);\n return negative ? \"-\" + result : result;\n}\nexports.int64ToString = int64ToString;\n/**\n * Losslessly converts a 64-bit unsigned integer in 32:32 split representation\n * into a decimal string.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nfunction uInt64ToString(lo, hi) {\n ({ lo, hi } = toUnsigned(lo, hi));\n // Skip the expensive conversion if the number is small enough to use the\n // built-in conversions.\n // Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with\n // highBits <= 0x1FFFFF can be safely expressed with a double and retain\n // integer precision.\n // Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true.\n if (hi <= 0x1FFFFF) {\n return String(TWO_PWR_32_DBL * hi + lo);\n }\n // What this code is doing is essentially converting the input number from\n // base-2 to base-1e7, which allows us to represent the 64-bit range with\n // only 3 (very large) digits. Those digits are then trivial to convert to\n // a base-10 string.\n // The magic numbers used here are -\n // 2^24 = 16777216 = (1,6777216) in base-1e7.\n // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.\n // Split 32:32 representation into 16:24:24 representation so our\n // intermediate digits don't overflow.\n const low = lo & 0xFFFFFF;\n const mid = ((lo >>> 24) | (hi << 8)) & 0xFFFFFF;\n const high = (hi >> 16) & 0xFFFF;\n // Assemble our three base-1e7 digits, ignoring carries. The maximum\n // value in a digit at this step is representable as a 48-bit integer, which\n // can be stored in a 64-bit floating point number.\n let digitA = low + (mid * 6777216) + (high * 6710656);\n let digitB = mid + (high * 8147497);\n let digitC = (high * 2);\n // Apply carries from A to B and from B to C.\n const base = 10000000;\n if (digitA >= base) {\n digitB += Math.floor(digitA / base);\n digitA %= base;\n }\n if (digitB >= base) {\n digitC += Math.floor(digitB / base);\n digitB %= base;\n }\n // If digitC is 0, then we should have returned in the trivial code path\n // at the top for non-safe integers. Given this, we can assume both digitB\n // and digitA need leading zeros.\n return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) +\n decimalFrom1e7WithLeadingZeros(digitA);\n}\nexports.uInt64ToString = uInt64ToString;\nfunction toUnsigned(lo, hi) {\n return { lo: lo >>> 0, hi: hi >>> 0 };\n}\nfunction newBits(lo, hi) {\n return { lo: lo | 0, hi: hi | 0 };\n}\n/**\n * Returns two's compliment negation of input.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers\n */\nfunction negate(lowBits, highBits) {\n highBits = ~highBits;\n if (lowBits) {\n lowBits = ~lowBits + 1;\n }\n else {\n // If lowBits is 0, then bitwise-not is 0xFFFFFFFF,\n // adding 1 to that, results in 0x100000000, which leaves\n // the low bits 0x0 and simply adds one to the high bits.\n highBits += 1;\n }\n return newBits(lowBits, highBits);\n}\n/**\n * Returns decimal representation of digit1e7 with leading zeros.\n */\nconst decimalFrom1e7WithLeadingZeros = (digit1e7) => {\n const partial = String(digit1e7);\n return \"0000000\".slice(partial.length) + partial;\n};\n/**\n * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144\n */\nfunction varint32write(value, bytes) {\n if (value >= 0) {\n // write value as varint 32\n while (value > 0x7f) {\n bytes.push((value & 0x7f) | 0x80);\n value = value >>> 7;\n }\n bytes.push(value);\n }\n else {\n for (let i = 0; i < 9; i++) {\n bytes.push((value & 127) | 128);\n value = value >> 7;\n }\n bytes.push(1);\n }\n}\nexports.varint32write = varint32write;\n/**\n * Read an unsigned 32 bit varint.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220\n */\nfunction varint32read() {\n let b = this.buf[this.pos++];\n let result = b & 0x7f;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 7;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 14;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 21;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n // Extract only last 4 bits\n b = this.buf[this.pos++];\n result |= (b & 0x0f) << 28;\n for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++)\n b = this.buf[this.pos++];\n if ((b & 0x80) != 0)\n throw new Error(\"invalid varint\");\n this.assertBounds();\n // Result can have 32 bits, convert it to unsigned\n return result >>> 0;\n}\nexports.varint32read = varint32read;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.toPlainMessage = exports.createRegistryFromDescriptors = exports.createRegistry = exports.createDescriptorSet = exports.BinaryReader = exports.BinaryWriter = exports.WireType = exports.MethodIdempotency = exports.MethodKind = exports.ScalarType = exports.Message = exports.codegenInfo = exports.protoDelimited = exports.protoBase64 = exports.protoInt64 = exports.protoDouble = exports.proto2 = exports.proto3 = void 0;\nvar proto3_js_1 = require(\"./proto3.js\");\nObject.defineProperty(exports, \"proto3\", { enumerable: true, get: function () { return proto3_js_1.proto3; } });\nvar proto2_js_1 = require(\"./proto2.js\");\nObject.defineProperty(exports, \"proto2\", { enumerable: true, get: function () { return proto2_js_1.proto2; } });\nvar proto_double_js_1 = require(\"./proto-double.js\");\nObject.defineProperty(exports, \"protoDouble\", { enumerable: true, get: function () { return proto_double_js_1.protoDouble; } });\nvar proto_int64_js_1 = require(\"./proto-int64.js\");\nObject.defineProperty(exports, \"protoInt64\", { enumerable: true, get: function () { return proto_int64_js_1.protoInt64; } });\nvar proto_base64_js_1 = require(\"./proto-base64.js\");\nObject.defineProperty(exports, \"protoBase64\", { enumerable: true, get: function () { return proto_base64_js_1.protoBase64; } });\nvar proto_delimited_js_1 = require(\"./proto-delimited.js\");\nObject.defineProperty(exports, \"protoDelimited\", { enumerable: true, get: function () { return proto_delimited_js_1.protoDelimited; } });\nvar codegen_info_js_1 = require(\"./codegen-info.js\");\nObject.defineProperty(exports, \"codegenInfo\", { enumerable: true, get: function () { return codegen_info_js_1.codegenInfo; } });\nvar message_js_1 = require(\"./message.js\");\nObject.defineProperty(exports, \"Message\", { enumerable: true, get: function () { return message_js_1.Message; } });\nvar field_js_1 = require(\"./field.js\");\nObject.defineProperty(exports, \"ScalarType\", { enumerable: true, get: function () { return field_js_1.ScalarType; } });\nvar service_type_js_1 = require(\"./service-type.js\");\nObject.defineProperty(exports, \"MethodKind\", { enumerable: true, get: function () { return service_type_js_1.MethodKind; } });\nObject.defineProperty(exports, \"MethodIdempotency\", { enumerable: true, get: function () { return service_type_js_1.MethodIdempotency; } });\nvar binary_encoding_js_1 = require(\"./binary-encoding.js\");\nObject.defineProperty(exports, \"WireType\", { enumerable: true, get: function () { return binary_encoding_js_1.WireType; } });\nObject.defineProperty(exports, \"BinaryWriter\", { enumerable: true, get: function () { return binary_encoding_js_1.BinaryWriter; } });\nObject.defineProperty(exports, \"BinaryReader\", { enumerable: true, get: function () { return binary_encoding_js_1.BinaryReader; } });\nvar create_descriptor_set_js_1 = require(\"./create-descriptor-set.js\");\nObject.defineProperty(exports, \"createDescriptorSet\", { enumerable: true, get: function () { return create_descriptor_set_js_1.createDescriptorSet; } });\nvar create_registry_js_1 = require(\"./create-registry.js\");\nObject.defineProperty(exports, \"createRegistry\", { enumerable: true, get: function () { return create_registry_js_1.createRegistry; } });\nvar create_registry_from_desc_js_1 = require(\"./create-registry-from-desc.js\");\nObject.defineProperty(exports, \"createRegistryFromDescriptors\", { enumerable: true, get: function () { return create_registry_from_desc_js_1.createRegistryFromDescriptors; } });\nvar to_plain_message_js_1 = require(\"./to-plain-message.js\");\nObject.defineProperty(exports, \"toPlainMessage\", { enumerable: true, get: function () { return to_plain_message_js_1.toPlainMessage; } });\n// ideally, we would export these types with sub-path exports:\n__exportStar(require(\"./google/protobuf/compiler/plugin_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/api_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/any_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/descriptor_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/duration_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/empty_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/field_mask_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/source_context_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/struct_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/timestamp_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/type_pb.js\"), exports);\n__exportStar(require(\"./google/protobuf/wrappers_pb.js\"), exports);\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Message = void 0;\n/**\n * Message is the base class of every message, generated, or created at\n * runtime.\n *\n * It is _not_ safe to extend this class. If you want to create a message at\n * run time, use proto3.makeMessageType().\n */\nclass Message {\n /**\n * Compare with a message of the same type.\n */\n equals(other) {\n return this.getType().runtime.util.equals(this.getType(), this, other);\n }\n /**\n * Create a deep copy.\n */\n clone() {\n return this.getType().runtime.util.clone(this);\n }\n /**\n * Parse from binary data, merging fields.\n *\n * Repeated fields are appended. Map entries are added, overwriting\n * existing keys.\n *\n * If a message field is already present, it will be merged with the\n * new data.\n */\n fromBinary(bytes, options) {\n const type = this.getType(), format = type.runtime.bin, opt = format.makeReadOptions(options);\n format.readMessage(this, opt.readerFactory(bytes), bytes.byteLength, opt);\n return this;\n }\n /**\n * Parse a message from a JSON value.\n */\n fromJson(jsonValue, options) {\n const type = this.getType(), format = type.runtime.json, opt = format.makeReadOptions(options);\n format.readMessage(type, jsonValue, opt, this);\n return this;\n }\n /**\n * Parse a message from a JSON string.\n */\n fromJsonString(jsonString, options) {\n let json;\n try {\n json = JSON.parse(jsonString);\n }\n catch (e) {\n throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${e instanceof Error ? e.message : String(e)}`);\n }\n return this.fromJson(json, options);\n }\n /**\n * Serialize the message to binary data.\n */\n toBinary(options) {\n const type = this.getType(), bin = type.runtime.bin, opt = bin.makeWriteOptions(options), writer = opt.writerFactory();\n bin.writeMessage(this, writer, opt);\n return writer.finish();\n }\n /**\n * Serialize the message to a JSON value, a JavaScript value that can be\n * passed to JSON.stringify().\n */\n toJson(options) {\n const type = this.getType(), json = type.runtime.json, opt = json.makeWriteOptions(options);\n return json.writeMessage(this, opt);\n }\n /**\n * Serialize the message to a JSON string.\n */\n toJsonString(options) {\n var _a;\n const value = this.toJson(options);\n return JSON.stringify(value, null, (_a = options === null || options === void 0 ? void 0 : options.prettySpaces) !== null && _a !== void 0 ? _a : 0);\n }\n /**\n * Override for serialization behavior. This will be invoked when calling\n * JSON.stringify on this message (i.e. JSON.stringify(msg)).\n *\n * Note that this will not serialize google.protobuf.Any with a packed\n * message because the protobuf JSON format specifies that it needs to be\n * unpacked, and this is only possible with a type registry to look up the\n * message type. As a result, attempting to serialize a message with this\n * type will throw an Error.\n *\n * This method is protected because you should not need to invoke it\n * directly -- instead use JSON.stringify or toJsonString for\n * stringified JSON. Alternatively, if actual JSON is desired, you should\n * use toJson.\n */\n toJSON() {\n return this.toJson({\n emitDefaultValues: true,\n });\n }\n /**\n * Retrieve the MessageType of this message - a singleton that represents\n * the protobuf message declaration and provides metadata for reflection-\n * based operations.\n */\n getType() {\n // Any class that extends Message _must_ provide a complete static\n // implementation of MessageType.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return\n return Object.getPrototypeOf(this).constructor;\n }\n}\nexports.Message = Message;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assertFloat32 = exports.assertUInt32 = exports.assertInt32 = exports.assert = void 0;\n/**\n * Assert that condition is truthy or throw error (with message)\n */\nfunction assert(condition, msg) {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions -- we want the implicit conversion to boolean\n if (!condition) {\n throw new Error(msg);\n }\n}\nexports.assert = assert;\nconst FLOAT32_MAX = 3.4028234663852886e38, FLOAT32_MIN = -3.4028234663852886e38, UINT32_MAX = 0xffffffff, INT32_MAX = 0x7fffffff, INT32_MIN = -0x80000000;\n/**\n * Assert a valid signed protobuf 32-bit integer.\n */\nfunction assertInt32(arg) {\n if (typeof arg !== \"number\")\n throw new Error(\"invalid int 32: \" + typeof arg);\n if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)\n throw new Error(\"invalid int 32: \" + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string\n}\nexports.assertInt32 = assertInt32;\n/**\n * Assert a valid unsigned protobuf 32-bit integer.\n */\nfunction assertUInt32(arg) {\n if (typeof arg !== \"number\")\n throw new Error(\"invalid uint 32: \" + typeof arg);\n if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)\n throw new Error(\"invalid uint 32: \" + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string\n}\nexports.assertUInt32 = assertUInt32;\n/**\n * Assert a valid protobuf float value.\n */\nfunction assertFloat32(arg) {\n if (typeof arg !== \"number\")\n throw new Error(\"invalid float 32: \" + typeof arg);\n if (!Number.isFinite(arg))\n return;\n if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)\n throw new Error(\"invalid float 32: \" + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string\n}\nexports.assertFloat32 = assertFloat32;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.writePacked = exports.writeScalar = exports.writeMessageField = exports.writeMapEntry = exports.makeBinaryFormatCommon = void 0;\nconst binary_encoding_js_1 = require(\"../binary-encoding.js\");\nconst message_js_1 = require(\"../message.js\");\nconst field_js_1 = require(\"../field.js\");\nconst field_wrapper_js_1 = require(\"./field-wrapper.js\");\nconst scalars_js_1 = require(\"./scalars.js\");\nconst assert_js_1 = require(\"./assert.js\");\n/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unnecessary-condition, no-case-declarations, prefer-const */\nconst unknownFieldsSymbol = Symbol(\"@bufbuild/protobuf/unknown-fields\");\n// Default options for parsing binary data.\nconst readDefaults = {\n readUnknownFields: true,\n readerFactory: (bytes) => new binary_encoding_js_1.BinaryReader(bytes),\n};\n// Default options for serializing binary data.\nconst writeDefaults = {\n writeUnknownFields: true,\n writerFactory: () => new binary_encoding_js_1.BinaryWriter(),\n};\nfunction makeReadOptions(options) {\n return options ? Object.assign(Object.assign({}, readDefaults), options) : readDefaults;\n}\nfunction makeWriteOptions(options) {\n return options ? Object.assign(Object.assign({}, writeDefaults), options) : writeDefaults;\n}\nfunction makeBinaryFormatCommon() {\n return {\n makeReadOptions,\n makeWriteOptions,\n listUnknownFields(message) {\n var _a;\n return (_a = message[unknownFieldsSymbol]) !== null && _a !== void 0 ? _a : [];\n },\n discardUnknownFields(message) {\n delete message[unknownFieldsSymbol];\n },\n writeUnknownFields(message, writer) {\n const m = message;\n const c = m[unknownFieldsSymbol];\n if (c) {\n for (const f of c) {\n writer.tag(f.no, f.wireType).raw(f.data);\n }\n }\n },\n onUnknownField(message, no, wireType, data) {\n const m = message;\n if (!Array.isArray(m[unknownFieldsSymbol])) {\n m[unknownFieldsSymbol] = [];\n }\n m[unknownFieldsSymbol].push({ no, wireType, data });\n },\n readMessage(message, reader, length, options) {\n const type = message.getType();\n const end = length === undefined ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const [fieldNo, wireType] = reader.tag(), field = type.fields.find(fieldNo);\n if (!field) {\n const data = reader.skip(wireType);\n if (options.readUnknownFields) {\n this.onUnknownField(message, fieldNo, wireType, data);\n }\n continue;\n }\n let target = message, repeated = field.repeated, localName = field.localName;\n if (field.oneof) {\n target = target[field.oneof.localName];\n if (target.case != localName) {\n delete target.value;\n }\n target.case = localName;\n localName = \"value\";\n }\n switch (field.kind) {\n case \"scalar\":\n case \"enum\":\n const scalarType = field.kind == \"enum\" ? field_js_1.ScalarType.INT32 : field.T;\n if (repeated) {\n let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values\n if (wireType == binary_encoding_js_1.WireType.LengthDelimited &&\n scalarType != field_js_1.ScalarType.STRING &&\n scalarType != field_js_1.ScalarType.BYTES) {\n let e = reader.uint32() + reader.pos;\n while (reader.pos < e) {\n arr.push(readScalar(reader, scalarType));\n }\n }\n else {\n arr.push(readScalar(reader, scalarType));\n }\n }\n else {\n target[localName] = readScalar(reader, scalarType);\n }\n break;\n case \"message\":\n const messageType = field.T;\n if (repeated) {\n // safe to assume presence of array, oneof cannot contain repeated values\n target[localName].push(readMessageField(reader, new messageType(), options));\n }\n else {\n if (target[localName] instanceof message_js_1.Message) {\n readMessageField(reader, target[localName], options);\n }\n else {\n target[localName] = readMessageField(reader, new messageType(), options);\n if (messageType.fieldWrapper &&\n !field.oneof &&\n !field.repeated) {\n target[localName] = messageType.fieldWrapper.unwrapField(target[localName]);\n }\n }\n }\n break;\n case \"map\":\n let [mapKey, mapVal] = readMapEntry(field, reader, options);\n // safe to assume presence of map object, oneof cannot contain repeated values\n target[localName][mapKey] = mapVal;\n break;\n }\n }\n },\n };\n}\nexports.makeBinaryFormatCommon = makeBinaryFormatCommon;\n// Read a message, avoiding MessageType.fromBinary() to re-use the\n// BinaryReadOptions and the IBinaryReader.\nfunction readMessageField(reader, message, options) {\n const format = message.getType().runtime.bin;\n format.readMessage(message, reader, reader.uint32(), options);\n return message;\n}\n// Read a map field, expecting key field = 1, value field = 2\nfunction readMapEntry(field, reader, options) {\n const length = reader.uint32(), end = reader.pos + length;\n let key, val;\n while (reader.pos < end) {\n let [fieldNo] = reader.tag();\n switch (fieldNo) {\n case 1:\n key = readScalar(reader, field.K);\n break;\n case 2:\n switch (field.V.kind) {\n case \"scalar\":\n val = readScalar(reader, field.V.T);\n break;\n case \"enum\":\n val = reader.int32();\n break;\n case \"message\":\n val = readMessageField(reader, new field.V.T(), options);\n break;\n }\n break;\n }\n }\n if (key === undefined) {\n let keyRaw = (0, scalars_js_1.scalarDefaultValue)(field.K);\n key =\n field.K == field_js_1.ScalarType.BOOL\n ? keyRaw.toString()\n : keyRaw;\n }\n if (typeof key != \"string\" && typeof key != \"number\") {\n key = key.toString();\n }\n if (val === undefined) {\n switch (field.V.kind) {\n case \"scalar\":\n val = (0, scalars_js_1.scalarDefaultValue)(field.V.T);\n break;\n case \"enum\":\n val = 0;\n break;\n case \"message\":\n val = new field.V.T();\n break;\n }\n }\n return [key, val];\n}\n// Does not use scalarTypeInfo() for better performance.\nfunction readScalar(reader, type) {\n switch (type) {\n case field_js_1.ScalarType.STRING:\n return reader.string();\n case field_js_1.ScalarType.BOOL:\n return reader.bool();\n case field_js_1.ScalarType.DOUBLE:\n return reader.double();\n case field_js_1.ScalarType.FLOAT:\n return reader.float();\n case field_js_1.ScalarType.INT32:\n return reader.int32();\n case field_js_1.ScalarType.INT64:\n return reader.int64();\n case field_js_1.ScalarType.UINT64:\n return reader.uint64();\n case field_js_1.ScalarType.FIXED64:\n return reader.fixed64();\n case field_js_1.ScalarType.BYTES:\n return reader.bytes();\n case field_js_1.ScalarType.FIXED32:\n return reader.fixed32();\n case field_js_1.ScalarType.SFIXED32:\n return reader.sfixed32();\n case field_js_1.ScalarType.SFIXED64:\n return reader.sfixed64();\n case field_js_1.ScalarType.SINT64:\n return reader.sint64();\n case field_js_1.ScalarType.UINT32:\n return reader.uint32();\n case field_js_1.ScalarType.SINT32:\n return reader.sint32();\n }\n}\nfunction writeMapEntry(writer, options, field, key, value) {\n writer.tag(field.no, binary_encoding_js_1.WireType.LengthDelimited);\n writer.fork();\n // javascript only allows number or string for object properties\n // we convert from our representation to the protobuf type\n let keyValue = key;\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- we deliberately handle just the special cases for map keys\n switch (field.K) {\n case field_js_1.ScalarType.INT32:\n case field_js_1.ScalarType.FIXED32:\n case field_js_1.ScalarType.UINT32:\n case field_js_1.ScalarType.SFIXED32:\n case field_js_1.ScalarType.SINT32:\n keyValue = Number.parseInt(key);\n break;\n case field_js_1.ScalarType.BOOL:\n (0, assert_js_1.assert)(key == \"true\" || key == \"false\");\n keyValue = key == \"true\";\n break;\n }\n // write key, expecting key field number = 1\n writeScalar(writer, field.K, 1, keyValue, true);\n // write value, expecting value field number = 2\n switch (field.V.kind) {\n case \"scalar\":\n writeScalar(writer, field.V.T, 2, value, true);\n break;\n case \"enum\":\n writeScalar(writer, field_js_1.ScalarType.INT32, 2, value, true);\n break;\n case \"message\":\n writeMessageField(writer, options, field.V.T, 2, value);\n break;\n }\n writer.join();\n}\nexports.writeMapEntry = writeMapEntry;\nfunction writeMessageField(writer, options, type, fieldNo, value) {\n if (value !== undefined) {\n const message = (0, field_wrapper_js_1.wrapField)(type, value);\n writer\n .tag(fieldNo, binary_encoding_js_1.WireType.LengthDelimited)\n .bytes(message.toBinary(options));\n }\n}\nexports.writeMessageField = writeMessageField;\nfunction writeScalar(writer, type, fieldNo, value, emitIntrinsicDefault) {\n let [wireType, method, isIntrinsicDefault] = (0, scalars_js_1.scalarTypeInfo)(type, value);\n if (!isIntrinsicDefault || emitIntrinsicDefault) {\n writer.tag(fieldNo, wireType)[method](value);\n }\n}\nexports.writeScalar = writeScalar;\nfunction writePacked(writer, type, fieldNo, value) {\n if (!value.length) {\n return;\n }\n writer.tag(fieldNo, binary_encoding_js_1.WireType.LengthDelimited).fork();\n let [, method] = (0, scalars_js_1.scalarTypeInfo)(type);\n for (let i = 0; i < value.length; i++) {\n writer[method](value[i]);\n }\n writer.join();\n}\nexports.writePacked = writePacked;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeBinaryFormatProto2 = void 0;\nconst field_js_1 = require(\"../field.js\");\nconst binary_format_common_js_1 = require(\"./binary-format-common.js\");\n/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unnecessary-condition, @typescript-eslint/strict-boolean-expressions, no-case-declarations, prefer-const */\nfunction makeBinaryFormatProto2() {\n return Object.assign(Object.assign({}, (0, binary_format_common_js_1.makeBinaryFormatCommon)()), { writeMessage(message, writer, options) {\n const type = message.getType();\n let field;\n try {\n for (field of type.fields.byNumber()) {\n let value, // this will be our field value, whether it is member of a oneof or not\n repeated = field.repeated, localName = field.localName;\n if (field.oneof) {\n const oneof = message[field.oneof.localName];\n if (oneof.case !== localName) {\n continue; // field is not selected, skip\n }\n value = oneof.value;\n }\n else {\n value = message[localName];\n // In contrast to proto3, we raise an error if a non-optional (proto2 required)\n // field is missing a value.\n if (value === undefined && !field.oneof && !field.opt) {\n throw new Error(`cannot encode field ${type.typeName}.${field.name} to binary: required field not set`);\n }\n }\n switch (field.kind) {\n case \"scalar\":\n case \"enum\":\n let scalarType = field.kind == \"enum\" ? field_js_1.ScalarType.INT32 : field.T;\n if (repeated) {\n if (field.packed) {\n (0, binary_format_common_js_1.writePacked)(writer, scalarType, field.no, value);\n }\n else {\n for (const item of value) {\n (0, binary_format_common_js_1.writeScalar)(writer, scalarType, field.no, item, true);\n }\n }\n }\n else {\n if (value !== undefined) {\n // In contrast to proto3, we do not skip intrinsic default values.\n // Explicit default values are not special cased either.\n (0, binary_format_common_js_1.writeScalar)(writer, scalarType, field.no, value, true);\n }\n }\n break;\n case \"message\":\n if (repeated) {\n for (const item of value) {\n (0, binary_format_common_js_1.writeMessageField)(writer, options, field.T, field.no, item);\n }\n }\n else {\n (0, binary_format_common_js_1.writeMessageField)(writer, options, field.T, field.no, value);\n }\n break;\n case \"map\":\n for (const [key, val] of Object.entries(value)) {\n (0, binary_format_common_js_1.writeMapEntry)(writer, options, field, key, val);\n }\n break;\n }\n }\n }\n catch (e) {\n let m = field\n ? `cannot encode field ${type.typeName}.${field === null || field === void 0 ? void 0 : field.name} to binary`\n : `cannot encode message ${type.typeName} to binary`;\n let r = e instanceof Error ? e.message : String(e);\n throw new Error(m + (r.length > 0 ? `: ${r}` : \"\"));\n }\n if (options.writeUnknownFields) {\n this.writeUnknownFields(message, writer);\n }\n return writer;\n } });\n}\nexports.makeBinaryFormatProto2 = makeBinaryFormatProto2;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeBinaryFormatProto3 = void 0;\nconst field_js_1 = require(\"../field.js\");\nconst binary_format_common_js_1 = require(\"./binary-format-common.js\");\n/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unnecessary-condition, @typescript-eslint/strict-boolean-expressions, prefer-const, no-case-declarations */\nfunction makeBinaryFormatProto3() {\n return Object.assign(Object.assign({}, (0, binary_format_common_js_1.makeBinaryFormatCommon)()), { writeMessage(message, writer, options) {\n const type = message.getType();\n for (const field of type.fields.byNumber()) {\n let value, // this will be our field value, whether it is member of a oneof or regular field\n repeated = field.repeated, localName = field.localName;\n if (field.oneof) {\n const oneof = message[field.oneof.localName];\n if (oneof.case !== localName) {\n continue; // field is not selected, skip\n }\n value = oneof.value;\n }\n else {\n value = message[localName];\n }\n switch (field.kind) {\n case \"scalar\":\n case \"enum\":\n let scalarType = field.kind == \"enum\" ? field_js_1.ScalarType.INT32 : field.T;\n if (repeated) {\n if (field.packed) {\n (0, binary_format_common_js_1.writePacked)(writer, scalarType, field.no, value);\n }\n else {\n for (const item of value) {\n (0, binary_format_common_js_1.writeScalar)(writer, scalarType, field.no, item, true);\n }\n }\n }\n else {\n if (value !== undefined) {\n (0, binary_format_common_js_1.writeScalar)(writer, scalarType, field.no, value, !!field.oneof || field.opt);\n }\n }\n break;\n case \"message\":\n if (repeated) {\n for (const item of value) {\n (0, binary_format_common_js_1.writeMessageField)(writer, options, field.T, field.no, item);\n }\n }\n else {\n (0, binary_format_common_js_1.writeMessageField)(writer, options, field.T, field.no, value);\n }\n break;\n case \"map\":\n for (const [key, val] of Object.entries(value)) {\n (0, binary_format_common_js_1.writeMapEntry)(writer, options, field, key, val);\n }\n break;\n }\n }\n if (options.writeUnknownFields) {\n this.writeUnknownFields(message, writer);\n }\n return writer;\n } });\n}\nexports.makeBinaryFormatProto3 = makeBinaryFormatProto3;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeEnum = exports.makeEnumType = exports.setEnumType = exports.getEnumType = void 0;\nconst assert_js_1 = require(\"./assert.js\");\nconst enumTypeSymbol = Symbol(\"@bufbuild/protobuf/enum-type\");\n/**\n * Get reflection information from a generated enum.\n * If this function is called on something other than a generated\n * enum, it raises an error.\n */\nfunction getEnumType(enumObject) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any\n const t = enumObject[enumTypeSymbol];\n (0, assert_js_1.assert)(t, \"missing enum type on enum object\");\n return t; // eslint-disable-line @typescript-eslint/no-unsafe-return\n}\nexports.getEnumType = getEnumType;\n/**\n * Sets reflection information on a generated enum.\n */\nfunction setEnumType(enumObject, typeName, values, opt) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n enumObject[enumTypeSymbol] = makeEnumType(typeName, values.map((v) => ({\n no: v.no,\n name: v.name,\n localName: enumObject[v.no],\n })), opt);\n}\nexports.setEnumType = setEnumType;\n/**\n * Create a new EnumType with the given values.\n */\nfunction makeEnumType(typeName, values, \n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n_opt) {\n const names = Object.create(null);\n const numbers = Object.create(null);\n const normalValues = [];\n for (const value of values) {\n // We do not surface options at this time\n // const value: EnumValueInfo = {...v, options: v.options ?? emptyReadonlyObject};\n const n = normalizeEnumValue(value);\n normalValues.push(n);\n names[value.name] = n;\n numbers[value.no] = n;\n }\n return {\n typeName,\n values: normalValues,\n // We do not surface options at this time\n // options: opt?.options ?? Object.create(null),\n findName(name) {\n return names[name];\n },\n findNumber(no) {\n return numbers[no];\n },\n };\n}\nexports.makeEnumType = makeEnumType;\n/**\n * Create a new enum object with the given values.\n * Sets reflection information.\n */\nfunction makeEnum(typeName, values, opt) {\n const enumObject = {};\n for (const value of values) {\n const n = normalizeEnumValue(value);\n enumObject[n.localName] = n.no;\n enumObject[n.no] = n.localName;\n }\n setEnumType(enumObject, typeName, values, opt);\n return enumObject;\n}\nexports.makeEnum = makeEnum;\nfunction normalizeEnumValue(value) {\n if (\"localName\" in value) {\n return value;\n }\n return Object.assign(Object.assign({}, value), { localName: value.name });\n}\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InternalFieldList = void 0;\nclass InternalFieldList {\n constructor(fields, normalizer) {\n this._fields = fields;\n this._normalizer = normalizer;\n }\n findJsonName(jsonName) {\n if (!this.jsonNames) {\n const t = {};\n for (const f of this.list()) {\n t[f.jsonName] = t[f.name] = f;\n }\n this.jsonNames = t;\n }\n return this.jsonNames[jsonName];\n }\n find(fieldNo) {\n if (!this.numbers) {\n const t = {};\n for (const f of this.list()) {\n t[f.no] = f;\n }\n this.numbers = t;\n }\n return this.numbers[fieldNo];\n }\n list() {\n if (!this.all) {\n this.all = this._normalizer(this._fields);\n }\n return this.all;\n }\n byNumber() {\n if (!this.numbersAsc) {\n this.numbersAsc = this.list()\n .concat()\n .sort((a, b) => a.no - b.no);\n }\n return this.numbersAsc;\n }\n byMember() {\n if (!this.members) {\n this.members = [];\n const a = this.members;\n let o;\n for (const f of this.list()) {\n if (f.oneof) {\n if (f.oneof !== o) {\n o = f.oneof;\n a.push(o);\n }\n }\n else {\n a.push(f);\n }\n }\n }\n return this.members;\n }\n}\nexports.InternalFieldList = InternalFieldList;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getUnwrappedFieldType = exports.wrapField = void 0;\nconst message_js_1 = require(\"../message.js\");\nconst field_js_1 = require(\"../field.js\");\n/**\n * Wrap a primitive message field value in its corresponding wrapper\n * message. This function is idempotent.\n */\nfunction wrapField(type, value) {\n if (value instanceof message_js_1.Message || !type.fieldWrapper) {\n return value;\n }\n return type.fieldWrapper.wrapField(value);\n}\nexports.wrapField = wrapField;\n/**\n * If the given field uses one of the well-known wrapper types, return\n * the primitive type it wraps.\n */\nfunction getUnwrappedFieldType(field) {\n if (field.fieldKind !== \"message\") {\n return undefined;\n }\n if (field.repeated) {\n return undefined;\n }\n if (field.oneof != undefined) {\n return undefined;\n }\n return wktWrapperToScalarType[field.message.typeName];\n}\nexports.getUnwrappedFieldType = getUnwrappedFieldType;\nconst wktWrapperToScalarType = {\n \"google.protobuf.DoubleValue\": field_js_1.ScalarType.DOUBLE,\n \"google.protobuf.FloatValue\": field_js_1.ScalarType.FLOAT,\n \"google.protobuf.Int64Value\": field_js_1.ScalarType.INT64,\n \"google.protobuf.UInt64Value\": field_js_1.ScalarType.UINT64,\n \"google.protobuf.Int32Value\": field_js_1.ScalarType.INT32,\n \"google.protobuf.UInt32Value\": field_js_1.ScalarType.UINT32,\n \"google.protobuf.BoolValue\": field_js_1.ScalarType.BOOL,\n \"google.protobuf.StringValue\": field_js_1.ScalarType.STRING,\n \"google.protobuf.BytesValue\": field_js_1.ScalarType.BYTES,\n};\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InternalOneofInfo = void 0;\nconst names_js_1 = require(\"./names.js\");\nconst assert_js_1 = require(\"./assert.js\");\nclass InternalOneofInfo {\n constructor(name) {\n this.kind = \"oneof\";\n this.repeated = false;\n this.packed = false;\n this.opt = false;\n this.default = undefined;\n this.fields = [];\n this.name = name;\n this.localName = (0, names_js_1.localOneofName)(name);\n }\n addField(field) {\n (0, assert_js_1.assert)(field.oneof === this, `field ${field.name} not one of ${this.name}`);\n this.fields.push(field);\n }\n findField(localName) {\n if (!this._lookup) {\n this._lookup = Object.create(null);\n for (let i = 0; i < this.fields.length; i++) {\n this._lookup[this.fields[i].localName] = this.fields[i];\n }\n }\n return this._lookup[localName];\n }\n}\nexports.InternalOneofInfo = InternalOneofInfo;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeJsonFormatCommon = void 0;\nconst message_js_1 = require(\"../message.js\");\nconst field_js_1 = require(\"../field.js\");\nconst assert_js_1 = require(\"./assert.js\");\nconst proto_int64_js_1 = require(\"../proto-int64.js\");\nconst proto_base64_js_1 = require(\"../proto-base64.js\");\n/* eslint-disable no-case-declarations, @typescript-eslint/restrict-plus-operands,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */\n// Default options for parsing JSON.\nconst jsonReadDefaults = {\n ignoreUnknownFields: false,\n};\n// Default options for serializing to JSON.\nconst jsonWriteDefaults = {\n emitDefaultValues: false,\n enumAsInteger: false,\n useProtoFieldName: false,\n prettySpaces: 0,\n};\nfunction makeReadOptions(options) {\n return options ? Object.assign(Object.assign({}, jsonReadDefaults), options) : jsonReadDefaults;\n}\nfunction makeWriteOptions(options) {\n return options ? Object.assign(Object.assign({}, jsonWriteDefaults), options) : jsonWriteDefaults;\n}\nfunction makeJsonFormatCommon(makeWriteField) {\n const writeField = makeWriteField(writeEnum, writeScalar);\n return {\n makeReadOptions,\n makeWriteOptions,\n readMessage(type, json, options, message) {\n if (json == null || Array.isArray(json) || typeof json != \"object\") {\n throw new Error(`cannot decode message ${type.typeName} from JSON: ${this.debug(json)}`);\n }\n message = message !== null && message !== void 0 ? message : new type();\n const oneofSeen = {};\n for (const [jsonKey, jsonValue] of Object.entries(json)) {\n const field = type.fields.findJsonName(jsonKey);\n if (!field) {\n if (!options.ignoreUnknownFields) {\n throw new Error(`cannot decode message ${type.typeName} from JSON: key \"${jsonKey}\" is unknown`);\n }\n continue;\n }\n let localName = field.localName;\n let target = message;\n if (field.oneof) {\n if (jsonValue === null && field.kind == \"scalar\") {\n // see conformance test Required.Proto3.JsonInput.OneofFieldNull{First,Second}\n continue;\n }\n const seen = oneofSeen[field.oneof.localName];\n if (seen) {\n throw new Error(`cannot decode message ${type.typeName} from JSON: multiple keys for oneof \"${field.oneof.name}\" present: \"${seen}\", \"${jsonKey}\"`);\n }\n oneofSeen[field.oneof.localName] = jsonKey;\n target = target[field.oneof.localName] = { case: localName };\n localName = \"value\";\n }\n if (field.repeated) {\n if (jsonValue === null) {\n continue;\n }\n if (!Array.isArray(jsonValue)) {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`);\n }\n const targetArray = target[localName];\n for (const jsonItem of jsonValue) {\n if (jsonItem === null) {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonItem)}`);\n }\n let val;\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- \"map\" is invalid for repeated fields\n switch (field.kind) {\n case \"message\":\n val = field.T.fromJson(jsonItem, options);\n break;\n case \"enum\":\n val = readEnum(field.T, jsonItem, options.ignoreUnknownFields);\n if (val === undefined)\n continue;\n break;\n case \"scalar\":\n try {\n val = readScalar(field.T, jsonItem);\n }\n catch (e) {\n let m = `cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonItem)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n break;\n }\n targetArray.push(val);\n }\n }\n else if (field.kind == \"map\") {\n if (jsonValue === null) {\n continue;\n }\n if (Array.isArray(jsonValue) || typeof jsonValue != \"object\") {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`);\n }\n const targetMap = target[localName];\n for (const [jsonMapKey, jsonMapValue] of Object.entries(jsonValue)) {\n if (jsonMapValue === null) {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: map value null`);\n }\n let val;\n switch (field.V.kind) {\n case \"message\":\n val = field.V.T.fromJson(jsonMapValue, options);\n break;\n case \"enum\":\n val = readEnum(field.V.T, jsonMapValue, options.ignoreUnknownFields);\n if (val === undefined)\n continue;\n break;\n case \"scalar\":\n try {\n val = readScalar(field.V.T, jsonMapValue);\n }\n catch (e) {\n let m = `cannot decode map value for field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n break;\n }\n try {\n targetMap[readScalar(field.K, field.K == field_js_1.ScalarType.BOOL\n ? jsonMapKey == \"true\"\n ? true\n : jsonMapKey == \"false\"\n ? false\n : jsonMapKey\n : jsonMapKey).toString()] = val;\n }\n catch (e) {\n let m = `cannot decode map key for field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n }\n }\n else {\n switch (field.kind) {\n case \"message\":\n const messageType = field.T;\n if (jsonValue === null &&\n messageType.typeName != \"google.protobuf.Value\") {\n if (field.oneof) {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: null is invalid for oneof field \"${jsonKey}\"`);\n }\n continue;\n }\n if (target[localName] instanceof message_js_1.Message) {\n target[localName].fromJson(jsonValue, options);\n }\n else {\n target[localName] = messageType.fromJson(jsonValue, options);\n if (messageType.fieldWrapper && !field.oneof) {\n target[localName] = messageType.fieldWrapper.unwrapField(target[localName]);\n }\n }\n break;\n case \"enum\":\n const enumValue = readEnum(field.T, jsonValue, options.ignoreUnknownFields);\n if (enumValue !== undefined) {\n target[localName] = enumValue;\n }\n break;\n case \"scalar\":\n try {\n target[localName] = readScalar(field.T, jsonValue);\n }\n catch (e) {\n let m = `cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n break;\n }\n }\n }\n return message;\n },\n writeMessage(message, options) {\n const type = message.getType();\n const json = {};\n let field;\n try {\n for (const member of type.fields.byMember()) {\n let jsonValue;\n if (member.kind == \"oneof\") {\n const oneof = message[member.localName];\n if (oneof.value === undefined) {\n continue;\n }\n field = member.findField(oneof.case);\n if (!field) {\n throw \"oneof case not found: \" + oneof.case;\n }\n jsonValue = writeField(field, oneof.value, options);\n }\n else {\n field = member;\n jsonValue = writeField(field, message[field.localName], options);\n }\n if (jsonValue !== undefined) {\n json[options.useProtoFieldName ? field.name : field.jsonName] =\n jsonValue;\n }\n }\n }\n catch (e) {\n const m = field\n ? `cannot encode field ${type.typeName}.${field.name} to JSON`\n : `cannot encode message ${type.typeName} to JSON`;\n const r = e instanceof Error ? e.message : String(e);\n throw new Error(m + (r.length > 0 ? `: ${r}` : \"\"));\n }\n return json;\n },\n readScalar,\n writeScalar,\n debug: debugJsonValue,\n };\n}\nexports.makeJsonFormatCommon = makeJsonFormatCommon;\nfunction debugJsonValue(json) {\n if (json === null) {\n return \"null\";\n }\n switch (typeof json) {\n case \"object\":\n return Array.isArray(json) ? \"array\" : \"object\";\n case \"string\":\n return json.length > 100 ? \"string\" : `\"${json.split('\"').join('\\\\\"')}\"`;\n default:\n return json.toString();\n }\n}\n// May throw an error. If the error message is non-blank, it should be shown.\n// It is up to the caller to provide context.\nfunction readScalar(type, json) {\n // every valid case in the switch below returns, and every fall\n // through is regarded as a failure.\n switch (type) {\n // float, double: JSON value will be a number or one of the special string values \"NaN\", \"Infinity\", and \"-Infinity\".\n // Either numbers or strings are accepted. Exponent notation is also accepted.\n case field_js_1.ScalarType.DOUBLE:\n case field_js_1.ScalarType.FLOAT:\n if (json === null)\n return 0.0;\n if (json === \"NaN\")\n return Number.NaN;\n if (json === \"Infinity\")\n return Number.POSITIVE_INFINITY;\n if (json === \"-Infinity\")\n return Number.NEGATIVE_INFINITY;\n if (json === \"\") {\n // empty string is not a number\n break;\n }\n if (typeof json == \"string\" && json.trim().length !== json.length) {\n // extra whitespace\n break;\n }\n if (typeof json != \"string\" && typeof json != \"number\") {\n break;\n }\n const float = Number(json);\n if (Number.isNaN(float)) {\n // not a number\n break;\n }\n if (!Number.isFinite(float)) {\n // infinity and -infinity are handled by string representation above, so this is an error\n break;\n }\n if (type == field_js_1.ScalarType.FLOAT)\n (0, assert_js_1.assertFloat32)(float);\n return float;\n // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.\n case field_js_1.ScalarType.INT32:\n case field_js_1.ScalarType.FIXED32:\n case field_js_1.ScalarType.SFIXED32:\n case field_js_1.ScalarType.SINT32:\n case field_js_1.ScalarType.UINT32:\n if (json === null)\n return 0;\n let int32;\n if (typeof json == \"number\")\n int32 = json;\n else if (typeof json == \"string\" && json.length > 0) {\n if (json.trim().length === json.length)\n int32 = Number(json);\n }\n if (int32 === undefined)\n break;\n if (type == field_js_1.ScalarType.UINT32)\n (0, assert_js_1.assertUInt32)(int32);\n else\n (0, assert_js_1.assertInt32)(int32);\n return int32;\n // int64, fixed64, uint64: JSON value will be a decimal string. Either numbers or strings are accepted.\n case field_js_1.ScalarType.INT64:\n case field_js_1.ScalarType.SFIXED64:\n case field_js_1.ScalarType.SINT64:\n if (json === null)\n return proto_int64_js_1.protoInt64.zero;\n if (typeof json != \"number\" && typeof json != \"string\")\n break;\n return proto_int64_js_1.protoInt64.parse(json);\n case field_js_1.ScalarType.FIXED64:\n case field_js_1.ScalarType.UINT64:\n if (json === null)\n return proto_int64_js_1.protoInt64.zero;\n if (typeof json != \"number\" && typeof json != \"string\")\n break;\n return proto_int64_js_1.protoInt64.uParse(json);\n // bool:\n case field_js_1.ScalarType.BOOL:\n if (json === null)\n return false;\n if (typeof json !== \"boolean\")\n break;\n return json;\n // string:\n case field_js_1.ScalarType.STRING:\n if (json === null)\n return \"\";\n if (typeof json !== \"string\") {\n break;\n }\n // A string must always contain UTF-8 encoded or 7-bit ASCII.\n // We validate with encodeURIComponent, which appears to be the fastest widely available option.\n try {\n encodeURIComponent(json);\n }\n catch (e) {\n throw new Error(\"invalid UTF8\");\n }\n return json;\n // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.\n // Either standard or URL-safe base64 encoding with/without paddings are accepted.\n case field_js_1.ScalarType.BYTES:\n if (json === null || json === \"\")\n return new Uint8Array(0);\n if (typeof json !== \"string\")\n break;\n return proto_base64_js_1.protoBase64.dec(json);\n }\n throw new Error();\n}\nfunction readEnum(type, json, ignoreUnknownFields) {\n if (json === null) {\n // proto3 requires 0 to be default value for all enums\n return 0;\n }\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (typeof json) {\n case \"number\":\n if (Number.isInteger(json)) {\n return json;\n }\n break;\n case \"string\":\n const value = type.findName(json);\n if (value || ignoreUnknownFields) {\n return value === null || value === void 0 ? void 0 : value.no;\n }\n break;\n }\n throw new Error(`cannot decode enum ${type.typeName} from JSON: ${debugJsonValue(json)}`);\n}\nfunction writeEnum(type, value, emitIntrinsicDefault, enumAsInteger) {\n var _a;\n if (value === undefined) {\n return value;\n }\n if (value === 0 && !emitIntrinsicDefault) {\n // proto3 requires 0 to be default value for all enums\n return undefined;\n }\n if (enumAsInteger) {\n return value;\n }\n if (type.typeName == \"google.protobuf.NullValue\") {\n return null;\n }\n const val = type.findNumber(value);\n return (_a = val === null || val === void 0 ? void 0 : val.name) !== null && _a !== void 0 ? _a : value; // if we don't know the enum value, just return the number\n}\nfunction writeScalar(type, value, emitIntrinsicDefault) {\n if (value === undefined) {\n return undefined;\n }\n switch (type) {\n // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.\n case field_js_1.ScalarType.INT32:\n case field_js_1.ScalarType.SFIXED32:\n case field_js_1.ScalarType.SINT32:\n case field_js_1.ScalarType.FIXED32:\n case field_js_1.ScalarType.UINT32:\n (0, assert_js_1.assert)(typeof value == \"number\");\n return value != 0 || emitIntrinsicDefault ? value : undefined;\n // float, double: JSON value will be a number or one of the special string values \"NaN\", \"Infinity\", and \"-Infinity\".\n // Either numbers or strings are accepted. Exponent notation is also accepted.\n case field_js_1.ScalarType.FLOAT:\n // assertFloat32(value);\n case field_js_1.ScalarType.DOUBLE: // eslint-disable-line no-fallthrough\n (0, assert_js_1.assert)(typeof value == \"number\");\n if (Number.isNaN(value))\n return \"NaN\";\n if (value === Number.POSITIVE_INFINITY)\n return \"Infinity\";\n if (value === Number.NEGATIVE_INFINITY)\n return \"-Infinity\";\n return value !== 0 || emitIntrinsicDefault ? value : undefined;\n // string:\n case field_js_1.ScalarType.STRING:\n (0, assert_js_1.assert)(typeof value == \"string\");\n return value.length > 0 || emitIntrinsicDefault ? value : undefined;\n // bool:\n case field_js_1.ScalarType.BOOL:\n (0, assert_js_1.assert)(typeof value == \"boolean\");\n return value || emitIntrinsicDefault ? value : undefined;\n // JSON value will be a decimal string. Either numbers or strings are accepted.\n case field_js_1.ScalarType.UINT64:\n case field_js_1.ScalarType.FIXED64:\n case field_js_1.ScalarType.INT64:\n case field_js_1.ScalarType.SFIXED64:\n case field_js_1.ScalarType.SINT64:\n (0, assert_js_1.assert)(typeof value == \"bigint\" ||\n typeof value == \"string\" ||\n typeof value == \"number\");\n // We use implicit conversion with `value != 0` to catch both 0n and \"0\"\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return emitIntrinsicDefault || value != 0\n ? value.toString(10)\n : undefined;\n // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.\n // Either standard or URL-safe base64 encoding with/without paddings are accepted.\n case field_js_1.ScalarType.BYTES:\n (0, assert_js_1.assert)(value instanceof Uint8Array);\n return emitIntrinsicDefault || value.byteLength > 0\n ? proto_base64_js_1.protoBase64.enc(value)\n : undefined;\n }\n}\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeJsonFormatProto2 = void 0;\nconst field_wrapper_js_1 = require(\"./field-wrapper.js\");\nconst assert_js_1 = require(\"./assert.js\");\nconst json_format_common_js_1 = require(\"./json-format-common.js\");\n/* eslint-disable no-case-declarations, @typescript-eslint/restrict-plus-operands,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */\nfunction makeJsonFormatProto2() {\n return (0, json_format_common_js_1.makeJsonFormatCommon)((writeEnum, writeScalar) => {\n return function writeField(field, value, options) {\n if (field.kind == \"map\") {\n const jsonObj = {};\n switch (field.V.kind) {\n case \"scalar\":\n for (const [entryKey, entryValue] of Object.entries(value)) {\n const val = writeScalar(field.V.T, entryValue, true);\n (0, assert_js_1.assert)(val !== undefined);\n jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n }\n break;\n case \"message\":\n for (const [entryKey, entryValue] of Object.entries(value)) {\n // JSON standard allows only (double quoted) string as property key\n jsonObj[entryKey.toString()] = entryValue.toJson(options);\n }\n break;\n case \"enum\":\n const enumType = field.V.T;\n for (const [entryKey, entryValue] of Object.entries(value)) {\n (0, assert_js_1.assert)(entryValue === undefined || typeof entryValue == \"number\");\n const val = writeEnum(enumType, entryValue, true, options.enumAsInteger);\n (0, assert_js_1.assert)(val !== undefined);\n jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n }\n break;\n }\n return options.emitDefaultValues || Object.keys(jsonObj).length > 0\n ? jsonObj\n : undefined;\n }\n else if (field.repeated) {\n const jsonArr = [];\n switch (field.kind) {\n case \"scalar\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(writeScalar(field.T, value[i], true));\n }\n break;\n case \"enum\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(writeEnum(field.T, value[i], true, options.enumAsInteger));\n }\n break;\n case \"message\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(value[i].toJson(options));\n }\n break;\n }\n return options.emitDefaultValues || jsonArr.length > 0\n ? jsonArr\n : undefined;\n }\n else {\n // In contrast to proto3, we raise an error if a non-optional (proto2 required)\n // field is missing a value.\n if (value === undefined) {\n if (!field.oneof && !field.opt) {\n throw `required field not set`;\n }\n return undefined;\n }\n switch (field.kind) {\n case \"scalar\":\n // In contrast to proto3, we do not skip intrinsic default values.\n // Explicit default values are not special cased either.\n return writeScalar(field.T, value, true);\n case \"enum\":\n // In contrast to proto3, we do not skip intrinsic default values.\n // Explicit default values are not special cased either.\n return writeEnum(field.T, value, true, options.enumAsInteger);\n case \"message\":\n return (0, field_wrapper_js_1.wrapField)(field.T, value).toJson(options);\n }\n }\n };\n });\n}\nexports.makeJsonFormatProto2 = makeJsonFormatProto2;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeJsonFormatProto3 = void 0;\nconst field_wrapper_js_1 = require(\"./field-wrapper.js\");\nconst assert_js_1 = require(\"./assert.js\");\nconst json_format_common_js_1 = require(\"./json-format-common.js\");\n/* eslint-disable no-case-declarations, @typescript-eslint/restrict-plus-operands,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */\nfunction makeJsonFormatProto3() {\n return (0, json_format_common_js_1.makeJsonFormatCommon)((writeEnum, writeScalar) => {\n return function writeField(field, value, options) {\n if (field.kind == \"map\") {\n const jsonObj = {};\n switch (field.V.kind) {\n case \"scalar\":\n for (const [entryKey, entryValue] of Object.entries(value)) {\n const val = writeScalar(field.V.T, entryValue, true);\n (0, assert_js_1.assert)(val !== undefined);\n jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n }\n break;\n case \"message\":\n for (const [entryKey, entryValue] of Object.entries(value)) {\n // JSON standard allows only (double quoted) string as property key\n jsonObj[entryKey.toString()] = entryValue.toJson(options);\n }\n break;\n case \"enum\":\n const enumType = field.V.T;\n for (const [entryKey, entryValue] of Object.entries(value)) {\n (0, assert_js_1.assert)(entryValue === undefined || typeof entryValue == \"number\");\n const val = writeEnum(enumType, entryValue, true, options.enumAsInteger);\n (0, assert_js_1.assert)(val !== undefined);\n jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n }\n break;\n }\n return options.emitDefaultValues || Object.keys(jsonObj).length > 0\n ? jsonObj\n : undefined;\n }\n else if (field.repeated) {\n const jsonArr = [];\n switch (field.kind) {\n case \"scalar\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(writeScalar(field.T, value[i], true));\n }\n break;\n case \"enum\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(writeEnum(field.T, value[i], true, options.enumAsInteger));\n }\n break;\n case \"message\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push((0, field_wrapper_js_1.wrapField)(field.T, value[i]).toJson(options));\n }\n break;\n }\n return options.emitDefaultValues || jsonArr.length > 0\n ? jsonArr\n : undefined;\n }\n else {\n switch (field.kind) {\n case \"scalar\":\n return writeScalar(field.T, value, !!field.oneof || field.opt || options.emitDefaultValues);\n case \"enum\":\n return writeEnum(field.T, value, !!field.oneof || field.opt || options.emitDefaultValues, options.enumAsInteger);\n case \"message\":\n return value !== undefined\n ? (0, field_wrapper_js_1.wrapField)(field.T, value).toJson(options)\n : undefined;\n }\n }\n };\n });\n}\nexports.makeJsonFormatProto3 = makeJsonFormatProto3;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeMessageType = void 0;\nconst message_js_1 = require(\"../message.js\");\n/**\n * Create a new message type using the given runtime.\n */\nfunction makeMessageType(runtime, typeName, fields, opt) {\n var _a;\n const localName = (_a = opt === null || opt === void 0 ? void 0 : opt.localName) !== null && _a !== void 0 ? _a : typeName.substring(typeName.lastIndexOf(\".\") + 1);\n const type = {\n [localName]: function (data) {\n runtime.util.initFields(this);\n runtime.util.initPartial(data, this);\n },\n }[localName];\n Object.setPrototypeOf(type.prototype, new message_js_1.Message());\n Object.assign(type, {\n runtime,\n typeName,\n fields: runtime.util.newFieldList(fields),\n fromBinary(bytes, options) {\n return new type().fromBinary(bytes, options);\n },\n fromJson(jsonValue, options) {\n return new type().fromJson(jsonValue, options);\n },\n fromJsonString(jsonString, options) {\n return new type().fromJsonString(jsonString, options);\n },\n equals(a, b) {\n return runtime.util.equals(type, a, b);\n },\n });\n return type;\n}\nexports.makeMessageType = makeMessageType;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.safeIdentifier = exports.safeObjectProperty = exports.findEnumSharedPrefix = exports.fieldJsonName = exports.localOneofName = exports.localFieldName = exports.localName = void 0;\n/**\n * Returns the name of a protobuf element in generated code.\n *\n * Field names - including oneofs - are converted to lowerCamelCase. For\n * messages, enumerations and services, the package name is stripped from\n * the type name. For nested messages and enumerations, the names are joined\n * with an underscore. For methods, the first character is made lowercase.\n */\nfunction localName(desc) {\n switch (desc.kind) {\n case \"field\":\n return localFieldName(desc.name, desc.oneof !== undefined);\n case \"oneof\":\n return localOneofName(desc.name);\n case \"enum\":\n case \"message\":\n case \"service\": {\n const pkg = desc.file.proto.package;\n const offset = pkg === undefined ? 0 : pkg.length + 1;\n const name = desc.typeName.substring(offset).replace(/\\./g, \"_\");\n // For services, we only care about safe identifiers, not safe object properties,\n // but we have shipped v1 with a bug that respected object properties, and we\n // do not want to introduce a breaking change, so we continue to escape for\n // safe object properties.\n // See https://github.com/bufbuild/protobuf-es/pull/391\n return (0, exports.safeObjectProperty)((0, exports.safeIdentifier)(name));\n }\n case \"enum_value\": {\n const sharedPrefix = desc.parent.sharedPrefix;\n if (sharedPrefix === undefined) {\n return desc.name;\n }\n const name = desc.name.substring(sharedPrefix.length);\n return (0, exports.safeObjectProperty)(name);\n }\n case \"rpc\": {\n let name = desc.name;\n if (name.length == 0) {\n return name;\n }\n name = name[0].toLowerCase() + name.substring(1);\n return (0, exports.safeObjectProperty)(name);\n }\n }\n}\nexports.localName = localName;\n/**\n * Returns the name of a field in generated code.\n */\nfunction localFieldName(protoName, inOneof) {\n const name = protoCamelCase(protoName);\n if (inOneof) {\n // oneof member names are not properties, but values of the `case` property.\n return name;\n }\n return (0, exports.safeObjectProperty)(safeMessageProperty(name));\n}\nexports.localFieldName = localFieldName;\n/**\n * Returns the name of a oneof group in generated code.\n */\nfunction localOneofName(protoName) {\n return localFieldName(protoName, false);\n}\nexports.localOneofName = localOneofName;\n/**\n * Returns the JSON name for a protobuf field, exactly like protoc does.\n */\nexports.fieldJsonName = protoCamelCase;\n/**\n * Finds a prefix shared by enum values, for example `MY_ENUM_` for\n * `enum MyEnum {MY_ENUM_A=0; MY_ENUM_B=1;}`.\n */\nfunction findEnumSharedPrefix(enumName, valueNames) {\n const prefix = camelToSnakeCase(enumName) + \"_\";\n for (const name of valueNames) {\n if (!name.toLowerCase().startsWith(prefix)) {\n return undefined;\n }\n const shortName = name.substring(prefix.length);\n if (shortName.length == 0) {\n return undefined;\n }\n if (/^\\d/.test(shortName)) {\n // identifiers must not start with numbers\n return undefined;\n }\n }\n return prefix;\n}\nexports.findEnumSharedPrefix = findEnumSharedPrefix;\n/**\n * Converts lowerCamelCase or UpperCamelCase into lower_snake_case.\n * This is used to find shared prefixes in an enum.\n */\nfunction camelToSnakeCase(camel) {\n return (camel.substring(0, 1) + camel.substring(1).replace(/[A-Z]/g, (c) => \"_\" + c)).toLowerCase();\n}\n/**\n * Converts snake_case to protoCamelCase according to the convention\n * used by protoc to convert a field name to a JSON name.\n */\nfunction protoCamelCase(snakeCase) {\n let capNext = false;\n const b = [];\n for (let i = 0; i < snakeCase.length; i++) {\n let c = snakeCase.charAt(i);\n switch (c) {\n case \"_\":\n capNext = true;\n break;\n case \"0\":\n case \"1\":\n case \"2\":\n case \"3\":\n case \"4\":\n case \"5\":\n case \"6\":\n case \"7\":\n case \"8\":\n case \"9\":\n b.push(c);\n capNext = false;\n break;\n default:\n if (capNext) {\n capNext = false;\n c = c.toUpperCase();\n }\n b.push(c);\n break;\n }\n }\n return b.join(\"\");\n}\n/**\n * Names that cannot be used for identifiers, such as class names,\n * but _can_ be used for object properties.\n */\nconst reservedIdentifiers = new Set([\n // ECMAScript 2015 keywords\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"null\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n // ECMAScript 2015 future reserved keywords\n \"enum\",\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n // Class name cannot be 'Object' when targeting ES5 with module CommonJS\n \"Object\",\n // TypeScript keywords that cannot be used for types (as opposed to variables)\n \"bigint\",\n \"number\",\n \"boolean\",\n \"string\",\n \"object\",\n // Identifiers reserved for the runtime, so we can generate legible code\n \"globalThis\",\n \"Uint8Array\",\n \"Partial\",\n]);\n/**\n * Names that cannot be used for object properties because they are reserved\n * by built-in JavaScript properties.\n */\nconst reservedObjectProperties = new Set([\n // names reserved by JavaScript\n \"constructor\",\n \"toString\",\n \"toJSON\",\n \"valueOf\",\n]);\n/**\n * Names that cannot be used for object properties because they are reserved\n * by the runtime.\n */\nconst reservedMessageProperties = new Set([\n // names reserved by the runtime\n \"getType\",\n \"clone\",\n \"equals\",\n \"fromBinary\",\n \"fromJson\",\n \"fromJsonString\",\n \"toBinary\",\n \"toJson\",\n \"toJsonString\",\n // names reserved by the runtime for the future\n \"toObject\",\n]);\nconst fallback = (name) => `${name}$`;\n/**\n * Will wrap names that are Object prototype properties or names reserved\n * for `Message`s.\n */\nconst safeMessageProperty = (name) => {\n if (reservedMessageProperties.has(name)) {\n return fallback(name);\n }\n return name;\n};\n/**\n * Names that cannot be used for object properties because they are reserved\n * by built-in JavaScript properties.\n */\nconst safeObjectProperty = (name) => {\n if (reservedObjectProperties.has(name)) {\n return fallback(name);\n }\n return name;\n};\nexports.safeObjectProperty = safeObjectProperty;\n/**\n * Names that can be used for identifiers or class properties\n */\nconst safeIdentifier = (name) => {\n if (reservedIdentifiers.has(name)) {\n return fallback(name);\n }\n return name;\n};\nexports.safeIdentifier = safeIdentifier;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeProtoRuntime = void 0;\nconst enum_js_1 = require(\"./enum.js\");\nconst message_type_js_1 = require(\"./message-type.js\");\nfunction makeProtoRuntime(syntax, json, bin, util) {\n return {\n syntax,\n json,\n bin,\n util,\n makeMessageType(typeName, fields, opt) {\n return (0, message_type_js_1.makeMessageType)(this, typeName, fields, opt);\n },\n makeEnum: enum_js_1.makeEnum,\n makeEnumType: enum_js_1.makeEnumType,\n getEnumType: enum_js_1.getEnumType,\n };\n}\nexports.makeProtoRuntime = makeProtoRuntime;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.reifyWkt = void 0;\nconst field_js_1 = require(\"../field.js\");\n/**\n * Reifies a given DescMessage into a more concrete object representing its\n * respective well-known type. The returned object will contain properties\n * representing the WKT's defined fields.\n *\n * Useful during code generation when immediate access to a particular field\n * is needed without having to search the object's typename and DescField list.\n *\n * Returns undefined if the WKT cannot be completely constructed via the\n * DescMessage.\n */\nfunction reifyWkt(message) {\n switch (message.typeName) {\n case \"google.protobuf.Any\": {\n const typeUrl = message.fields.find((f) => f.number == 1 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.STRING);\n const value = message.fields.find((f) => f.number == 2 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.BYTES);\n if (typeUrl && value) {\n return {\n typeName: message.typeName,\n typeUrl,\n value,\n };\n }\n break;\n }\n case \"google.protobuf.Timestamp\": {\n const seconds = message.fields.find((f) => f.number == 1 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.INT64);\n const nanos = message.fields.find((f) => f.number == 2 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.INT32);\n if (seconds && nanos) {\n return {\n typeName: message.typeName,\n seconds,\n nanos,\n };\n }\n break;\n }\n case \"google.protobuf.Duration\": {\n const seconds = message.fields.find((f) => f.number == 1 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.INT64);\n const nanos = message.fields.find((f) => f.number == 2 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.INT32);\n if (seconds && nanos) {\n return {\n typeName: message.typeName,\n seconds,\n nanos,\n };\n }\n break;\n }\n case \"google.protobuf.Struct\": {\n const fields = message.fields.find((f) => f.number == 1 && !f.repeated);\n if ((fields === null || fields === void 0 ? void 0 : fields.fieldKind) !== \"map\" ||\n fields.mapValue.kind !== \"message\" ||\n fields.mapValue.message.typeName !== \"google.protobuf.Value\") {\n break;\n }\n return { typeName: message.typeName, fields };\n }\n case \"google.protobuf.Value\": {\n const kind = message.oneofs.find((o) => o.name === \"kind\");\n const nullValue = message.fields.find((f) => f.number == 1 && f.oneof === kind);\n if ((nullValue === null || nullValue === void 0 ? void 0 : nullValue.fieldKind) !== \"enum\" ||\n nullValue.enum.typeName !== \"google.protobuf.NullValue\") {\n return undefined;\n }\n const numberValue = message.fields.find((f) => f.number == 2 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.DOUBLE &&\n f.oneof === kind);\n const stringValue = message.fields.find((f) => f.number == 3 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.STRING &&\n f.oneof === kind);\n const boolValue = message.fields.find((f) => f.number == 4 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.BOOL &&\n f.oneof === kind);\n const structValue = message.fields.find((f) => f.number == 5 && f.oneof === kind);\n if ((structValue === null || structValue === void 0 ? void 0 : structValue.fieldKind) !== \"message\" ||\n structValue.message.typeName !== \"google.protobuf.Struct\") {\n return undefined;\n }\n const listValue = message.fields.find((f) => f.number == 6 && f.oneof === kind);\n if ((listValue === null || listValue === void 0 ? void 0 : listValue.fieldKind) !== \"message\" ||\n listValue.message.typeName !== \"google.protobuf.ListValue\") {\n return undefined;\n }\n if (kind && numberValue && stringValue && boolValue) {\n return {\n typeName: message.typeName,\n kind,\n nullValue,\n numberValue,\n stringValue,\n boolValue,\n structValue,\n listValue,\n };\n }\n break;\n }\n case \"google.protobuf.ListValue\": {\n const values = message.fields.find((f) => f.number == 1 && f.repeated);\n if ((values === null || values === void 0 ? void 0 : values.fieldKind) != \"message\" ||\n values.message.typeName !== \"google.protobuf.Value\") {\n break;\n }\n return { typeName: message.typeName, values };\n }\n case \"google.protobuf.FieldMask\": {\n const paths = message.fields.find((f) => f.number == 1 &&\n f.fieldKind == \"scalar\" &&\n f.scalar === field_js_1.ScalarType.STRING &&\n f.repeated);\n if (paths) {\n return { typeName: message.typeName, paths };\n }\n break;\n }\n case \"google.protobuf.DoubleValue\":\n case \"google.protobuf.FloatValue\":\n case \"google.protobuf.Int64Value\":\n case \"google.protobuf.UInt64Value\":\n case \"google.protobuf.Int32Value\":\n case \"google.protobuf.UInt32Value\":\n case \"google.protobuf.BoolValue\":\n case \"google.protobuf.StringValue\":\n case \"google.protobuf.BytesValue\": {\n const value = message.fields.find((f) => f.number == 1 && f.name == \"value\");\n if (!value) {\n break;\n }\n if (value.fieldKind !== \"scalar\") {\n break;\n }\n return { typeName: message.typeName, value };\n }\n }\n return undefined;\n}\nexports.reifyWkt = reifyWkt;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.scalarTypeInfo = exports.scalarDefaultValue = exports.scalarEquals = void 0;\nconst field_js_1 = require(\"../field.js\");\nconst binary_encoding_js_1 = require(\"../binary-encoding.js\");\nconst proto_int64_js_1 = require(\"../proto-int64.js\");\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Returns true if both scalar values are equal.\n */\nfunction scalarEquals(type, a, b) {\n if (a === b) {\n // This correctly matches equal values except BYTES and (possibly) 64-bit integers.\n return true;\n }\n // Special case BYTES - we need to compare each byte individually\n if (type == field_js_1.ScalarType.BYTES) {\n if (!(a instanceof Uint8Array) || !(b instanceof Uint8Array)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n // Special case 64-bit integers - we support number, string and bigint representation.\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (type) {\n case field_js_1.ScalarType.UINT64:\n case field_js_1.ScalarType.FIXED64:\n case field_js_1.ScalarType.INT64:\n case field_js_1.ScalarType.SFIXED64:\n case field_js_1.ScalarType.SINT64:\n // Loose comparison will match between 0n, 0 and \"0\".\n return a == b;\n }\n // Anything that hasn't been caught by strict comparison or special cased\n // BYTES and 64-bit integers is not equal.\n return false;\n}\nexports.scalarEquals = scalarEquals;\n/**\n * Returns the default value for the given scalar type, following\n * proto3 semantics.\n */\nfunction scalarDefaultValue(type) {\n switch (type) {\n case field_js_1.ScalarType.BOOL:\n return false;\n case field_js_1.ScalarType.UINT64:\n case field_js_1.ScalarType.FIXED64:\n case field_js_1.ScalarType.INT64:\n case field_js_1.ScalarType.SFIXED64:\n case field_js_1.ScalarType.SINT64:\n return proto_int64_js_1.protoInt64.zero;\n case field_js_1.ScalarType.DOUBLE:\n case field_js_1.ScalarType.FLOAT:\n return 0.0;\n case field_js_1.ScalarType.BYTES:\n return new Uint8Array(0);\n case field_js_1.ScalarType.STRING:\n return \"\";\n default:\n // Handles INT32, UINT32, SINT32, FIXED32, SFIXED32.\n // We do not use individual cases to save a few bytes code size.\n return 0;\n }\n}\nexports.scalarDefaultValue = scalarDefaultValue;\n/**\n * Get information for writing a scalar value.\n *\n * Returns tuple:\n * [0]: appropriate WireType\n * [1]: name of the appropriate method of IBinaryWriter\n * [2]: whether the given value is a default value for proto3 semantics\n *\n * If argument `value` is omitted, [2] is always false.\n */\nfunction scalarTypeInfo(type, value) {\n const isUndefined = value === undefined;\n let wireType = binary_encoding_js_1.WireType.Varint;\n let isIntrinsicDefault = value === 0;\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- INT32, UINT32, SINT32 are covered by the defaults\n switch (type) {\n case field_js_1.ScalarType.STRING:\n isIntrinsicDefault = isUndefined || !value.length;\n wireType = binary_encoding_js_1.WireType.LengthDelimited;\n break;\n case field_js_1.ScalarType.BOOL:\n isIntrinsicDefault = value === false;\n break;\n case field_js_1.ScalarType.DOUBLE:\n wireType = binary_encoding_js_1.WireType.Bit64;\n break;\n case field_js_1.ScalarType.FLOAT:\n wireType = binary_encoding_js_1.WireType.Bit32;\n break;\n case field_js_1.ScalarType.INT64:\n isIntrinsicDefault = isUndefined || value == 0;\n break;\n case field_js_1.ScalarType.UINT64:\n isIntrinsicDefault = isUndefined || value == 0;\n break;\n case field_js_1.ScalarType.FIXED64:\n isIntrinsicDefault = isUndefined || value == 0;\n wireType = binary_encoding_js_1.WireType.Bit64;\n break;\n case field_js_1.ScalarType.BYTES:\n isIntrinsicDefault = isUndefined || !value.byteLength;\n wireType = binary_encoding_js_1.WireType.LengthDelimited;\n break;\n case field_js_1.ScalarType.FIXED32:\n wireType = binary_encoding_js_1.WireType.Bit32;\n break;\n case field_js_1.ScalarType.SFIXED32:\n wireType = binary_encoding_js_1.WireType.Bit32;\n break;\n case field_js_1.ScalarType.SFIXED64:\n isIntrinsicDefault = isUndefined || value == 0;\n wireType = binary_encoding_js_1.WireType.Bit64;\n break;\n case field_js_1.ScalarType.SINT64:\n isIntrinsicDefault = isUndefined || value == 0;\n break;\n }\n const method = field_js_1.ScalarType[type].toLowerCase();\n return [wireType, method, isUndefined || isIntrinsicDefault];\n}\nexports.scalarTypeInfo = scalarTypeInfo;\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.makeUtilCommon = void 0;\nconst enum_js_1 = require(\"./enum.js\");\nconst message_js_1 = require(\"../message.js\");\nconst field_js_1 = require(\"../field.js\");\nconst scalars_js_1 = require(\"./scalars.js\");\n/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */\nfunction makeUtilCommon() {\n return {\n setEnumType: enum_js_1.setEnumType,\n initPartial(source, target) {\n if (source === undefined) {\n return;\n }\n const type = target.getType();\n for (const member of type.fields.byMember()) {\n const localName = member.localName, t = target, s = source;\n if (s[localName] === undefined) {\n continue;\n }\n switch (member.kind) {\n case \"oneof\":\n const sk = s[localName].case;\n if (sk === undefined) {\n continue;\n }\n const sourceField = member.findField(sk);\n let val = s[localName].value;\n if (sourceField &&\n sourceField.kind == \"message\" &&\n !(val instanceof sourceField.T)) {\n val = new sourceField.T(val);\n }\n t[localName] = { case: sk, value: val };\n break;\n case \"scalar\":\n case \"enum\":\n t[localName] = s[localName];\n break;\n case \"map\":\n switch (member.V.kind) {\n case \"scalar\":\n case \"enum\":\n Object.assign(t[localName], s[localName]);\n break;\n case \"message\":\n const messageType = member.V.T;\n for (const k of Object.keys(s[localName])) {\n let val = s[localName][k];\n if (!messageType.fieldWrapper) {\n // We only take partial input for messages that are not a wrapper type.\n // For those messages, we recursively normalize the partial input.\n val = new messageType(val);\n }\n t[localName][k] = val;\n }\n break;\n }\n break;\n case \"message\":\n const mt = member.T;\n if (member.repeated) {\n t[localName] = s[localName].map((val) => val instanceof mt ? val : new mt(val));\n }\n else if (s[localName] !== undefined) {\n const val = s[localName];\n if (mt.fieldWrapper) {\n t[localName] = val;\n }\n else {\n t[localName] = val instanceof mt ? val : new mt(val);\n }\n }\n break;\n }\n }\n },\n equals(type, a, b) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return type.fields.byMember().every((m) => {\n const va = a[m.localName];\n const vb = b[m.localName];\n if (m.repeated) {\n if (va.length !== vb.length) {\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- repeated fields are never \"map\"\n switch (m.kind) {\n case \"message\":\n return va.every((a, i) => m.T.equals(a, vb[i]));\n case \"scalar\":\n return va.every((a, i) => (0, scalars_js_1.scalarEquals)(m.T, a, vb[i]));\n case \"enum\":\n return va.every((a, i) => (0, scalars_js_1.scalarEquals)(field_js_1.ScalarType.INT32, a, vb[i]));\n }\n throw new Error(`repeated cannot contain ${m.kind}`);\n }\n switch (m.kind) {\n case \"message\":\n return m.T.equals(va, vb);\n case \"enum\":\n return (0, scalars_js_1.scalarEquals)(field_js_1.ScalarType.INT32, va, vb);\n case \"scalar\":\n return (0, scalars_js_1.scalarEquals)(m.T, va, vb);\n case \"oneof\":\n if (va.case !== vb.case) {\n return false;\n }\n const s = m.findField(va.case);\n if (s === undefined) {\n return true;\n }\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- oneof fields are never \"map\"\n switch (s.kind) {\n case \"message\":\n return s.T.equals(va.value, vb.value);\n case \"enum\":\n return (0, scalars_js_1.scalarEquals)(field_js_1.ScalarType.INT32, va.value, vb.value);\n case \"scalar\":\n return (0, scalars_js_1.scalarEquals)(s.T, va.value, vb.value);\n }\n throw new Error(`oneof cannot contain ${s.kind}`);\n case \"map\":\n const keys = Object.keys(va).concat(Object.keys(vb));\n switch (m.V.kind) {\n case \"message\":\n const messageType = m.V.T;\n return keys.every((k) => messageType.equals(va[k], vb[k]));\n case \"enum\":\n return keys.every((k) => (0, scalars_js_1.scalarEquals)(field_js_1.ScalarType.INT32, va[k], vb[k]));\n case \"scalar\":\n const scalarType = m.V.T;\n return keys.every((k) => (0, scalars_js_1.scalarEquals)(scalarType, va[k], vb[k]));\n }\n break;\n }\n });\n },\n clone(message) {\n const type = message.getType(), target = new type(), any = target;\n for (const member of type.fields.byMember()) {\n const source = message[member.localName];\n let copy;\n if (member.repeated) {\n copy = source.map((e) => cloneSingularField(member, e));\n }\n else if (member.kind == \"map\") {\n copy = any[member.localName];\n for (const [key, v] of Object.entries(source)) {\n copy[key] = cloneSingularField(member.V, v);\n }\n }\n else if (member.kind == \"oneof\") {\n const f = member.findField(source.case);\n copy = f\n ? { case: source.case, value: cloneSingularField(f, source.value) }\n : { case: undefined };\n }\n else {\n copy = cloneSingularField(member, source);\n }\n any[member.localName] = copy;\n }\n return target;\n },\n };\n}\nexports.makeUtilCommon = makeUtilCommon;\n// clone a single field value - i.e. the element type of repeated fields, the value type of maps\nfunction cloneSingularField(field, value) {\n if (value === undefined) {\n return value;\n }\n if (value instanceof message_js_1.Message) {\n return value.clone();\n }\n if (value instanceof Uint8Array) {\n const c = new Uint8Array(value.byteLength);\n c.set(value);\n return c;\n }\n return value;\n}\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.protoBase64 = void 0;\n/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition, prefer-const */\n// lookup table from base64 character to byte\nlet encTable = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\");\n// lookup table from base64 character *code* to byte because lookup by number is fast\nlet decTable = [];\nfor (let i = 0; i < encTable.length; i++)\n decTable[encTable[i].charCodeAt(0)] = i;\n// support base64url variants\ndecTable[\"-\".charCodeAt(0)] = encTable.indexOf(\"+\");\ndecTable[\"_\".charCodeAt(0)] = encTable.indexOf(\"/\");\nexports.protoBase64 = {\n /**\n * Decodes a base64 string to a byte array.\n *\n * - ignores white-space, including line breaks and tabs\n * - allows inner padding (can decode concatenated base64 strings)\n * - does not require padding\n * - understands base64url encoding:\n * \"-\" instead of \"+\",\n * \"_\" instead of \"/\",\n * no padding\n */\n dec(base64Str) {\n // estimate byte size, not accounting for inner padding and whitespace\n let es = (base64Str.length * 3) / 4;\n if (base64Str[base64Str.length - 2] == \"=\")\n es -= 2;\n else if (base64Str[base64Str.length - 1] == \"=\")\n es -= 1;\n let bytes = new Uint8Array(es), bytePos = 0, // position in byte array\n groupPos = 0, // position in base64 group\n b, // current byte\n p = 0; // previous byte\n for (let i = 0; i < base64Str.length; i++) {\n b = decTable[base64Str.charCodeAt(i)];\n if (b === undefined) {\n switch (base64Str[i]) {\n // @ts-ignore TS7029: Fallthrough case in switch\n case \"=\":\n groupPos = 0; // reset state when padding found\n // @ts-ignore TS7029: Fallthrough case in switch\n case \"\\n\":\n case \"\\r\":\n case \"\\t\":\n case \" \":\n continue; // skip white-space, and padding\n default:\n throw Error(\"invalid base64 string.\");\n }\n }\n switch (groupPos) {\n case 0:\n p = b;\n groupPos = 1;\n break;\n case 1:\n bytes[bytePos++] = (p << 2) | ((b & 48) >> 4);\n p = b;\n groupPos = 2;\n break;\n case 2:\n bytes[bytePos++] = ((p & 15) << 4) | ((b & 60) >> 2);\n p = b;\n groupPos = 3;\n break;\n case 3:\n bytes[bytePos++] = ((p & 3) << 6) | b;\n groupPos = 0;\n break;\n }\n }\n if (groupPos == 1)\n throw Error(\"invalid base64 string.\");\n return bytes.subarray(0, bytePos);\n },\n /**\n * Encode a byte array to a base64 string.\n */\n enc(bytes) {\n let base64 = \"\", groupPos = 0, // position in base64 group\n b, // current byte\n p = 0; // carry over from previous byte\n for (let i = 0; i < bytes.length; i++) {\n b = bytes[i];\n switch (groupPos) {\n case 0:\n base64 += encTable[b >> 2];\n p = (b & 3) << 4;\n groupPos = 1;\n break;\n case 1:\n base64 += encTable[p | (b >> 4)];\n p = (b & 15) << 2;\n groupPos = 2;\n break;\n case 2:\n base64 += encTable[p | (b >> 6)];\n base64 += encTable[b & 63];\n groupPos = 0;\n break;\n }\n }\n // add output padding\n if (groupPos) {\n base64 += encTable[p];\n base64 += \"=\";\n if (groupPos == 1)\n base64 += \"=\";\n }\n return base64;\n },\n};\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nvar __asyncValues = (this && this.__asyncValues) || function (o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n};\nvar __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }\nvar __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.protoDelimited = void 0;\nconst binary_format_common_js_1 = require(\"./private/binary-format-common.js\");\nconst binary_encoding_js_1 = require(\"./binary-encoding.js\");\n/**\n * protoDelimited provides functions to serialize and parse size-delimited\n * messages.\n *\n * A size-delimited message is a varint size in bytes, followed by exactly\n * that many bytes of a message serialized with the binary format.\n *\n * This size-delimited format is compatible with other implementations.\n * For details, see https://github.com/protocolbuffers/protobuf/issues/10229\n */\nexports.protoDelimited = {\n /**\n * Serialize a message, prefixing it with its size.\n */\n enc(message, options) {\n const opt = (0, binary_format_common_js_1.makeBinaryFormatCommon)().makeWriteOptions(options);\n return opt.writerFactory().bytes(message.toBinary(opt)).finish();\n },\n /**\n * Parse a size-delimited message, ignoring extra bytes.\n */\n dec(type, bytes, options) {\n const opt = (0, binary_format_common_js_1.makeBinaryFormatCommon)().makeReadOptions(options);\n return type.fromBinary(opt.readerFactory(bytes).bytes(), opt);\n },\n /**\n * Parse a stream of size-delimited messages.\n */\n decStream(type, iterable) {\n return __asyncGenerator(this, arguments, function* decStream_1() {\n var _a, e_1, _b, _c;\n // append chunk to buffer, returning updated buffer\n function append(buffer, chunk) {\n const n = new Uint8Array(buffer.byteLength + chunk.byteLength);\n n.set(buffer);\n n.set(chunk, buffer.length);\n return n;\n }\n let buffer = new Uint8Array(0);\n try {\n for (var _d = true, iterable_1 = __asyncValues(iterable), iterable_1_1; iterable_1_1 = yield __await(iterable_1.next()), _a = iterable_1_1.done, !_a; _d = true) {\n _c = iterable_1_1.value;\n _d = false;\n const chunk = _c;\n buffer = append(buffer, chunk);\n for (;;) {\n const size = exports.protoDelimited.peekSize(buffer);\n if (size.eof) {\n // size is incomplete, buffer more data\n break;\n }\n if (size.offset + size.size > buffer.byteLength) {\n // message is incomplete, buffer more data\n break;\n }\n yield yield __await(exports.protoDelimited.dec(type, buffer));\n buffer = buffer.subarray(size.offset + size.size);\n }\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_1.return)) yield __await(_b.call(iterable_1));\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (buffer.byteLength > 0) {\n throw new Error(\"incomplete data\");\n }\n });\n },\n /**\n * Decodes the size from the given size-delimited message, which may be\n * incomplete.\n *\n * Returns an object with the following properties:\n * - size: The size of the delimited message in bytes\n * - offset: The offset in the given byte array where the message starts\n * - eof: true\n *\n * If the size-delimited data does not include all bytes of the varint size,\n * the following object is returned:\n * - size: null\n * - offset: null\n * - eof: false\n *\n * This function can be used to implement parsing of size-delimited messages\n * from a stream.\n */\n peekSize(data) {\n const sizeEof = { eof: true, size: null, offset: null };\n for (let i = 0; i < 10; i++) {\n if (i > data.byteLength) {\n return sizeEof;\n }\n if ((data[i] & 0x80) == 0) {\n const reader = new binary_encoding_js_1.BinaryReader(data);\n let size;\n try {\n size = reader.uint32();\n }\n catch (e) {\n if (e instanceof RangeError) {\n return sizeEof;\n }\n throw e;\n }\n return {\n eof: false,\n size,\n offset: reader.pos,\n };\n }\n }\n throw new Error(\"invalid varint\");\n },\n};\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.protoDouble = void 0;\n// Export global Number constants. This is done so that we can safely use\n// these global constants when generating code and be assured we're using\n// the correct values. We cannot rely on globalThis since we support ES2017\n// and globalThis was introduced in ES2020. We also don't want to explicitly\n// generate code using, for example, Number.NaN, since this could clash with\n// a message name of Number. Instead we can export them here since this will\n// be in a different scope as the generated code and we are guaranteed to use\n// the intended global values.\nexports.protoDouble = {\n NaN: Number.NaN,\n POSITIVE_INFINITY: Number.POSITIVE_INFINITY,\n NEGATIVE_INFINITY: Number.NEGATIVE_INFINITY,\n};\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.protoInt64 = void 0;\nconst assert_js_1 = require(\"./private/assert.js\");\nconst varint_js_1 = require(\"./google/varint.js\");\nfunction makeInt64Support() {\n const dv = new DataView(new ArrayBuffer(8));\n // note that Safari 14 implements BigInt, but not the DataView methods\n const ok = typeof BigInt === \"function\" &&\n typeof dv.getBigInt64 === \"function\" &&\n typeof dv.getBigUint64 === \"function\" &&\n typeof dv.setBigInt64 === \"function\" &&\n typeof dv.setBigUint64 === \"function\" &&\n (typeof process != \"object\" ||\n typeof process.env != \"object\" ||\n process.env.BUF_BIGINT_DISABLE !== \"1\");\n if (ok) {\n const MIN = BigInt(\"-9223372036854775808\"), MAX = BigInt(\"9223372036854775807\"), UMIN = BigInt(\"0\"), UMAX = BigInt(\"18446744073709551615\");\n return {\n zero: BigInt(0),\n supported: true,\n parse(value) {\n const bi = typeof value == \"bigint\" ? value : BigInt(value);\n if (bi > MAX || bi < MIN) {\n throw new Error(`int64 invalid: ${value}`);\n }\n return bi;\n },\n uParse(value) {\n const bi = typeof value == \"bigint\" ? value : BigInt(value);\n if (bi > UMAX || bi < UMIN) {\n throw new Error(`uint64 invalid: ${value}`);\n }\n return bi;\n },\n enc(value) {\n dv.setBigInt64(0, this.parse(value), true);\n return {\n lo: dv.getInt32(0, true),\n hi: dv.getInt32(4, true),\n };\n },\n uEnc(value) {\n dv.setBigInt64(0, this.uParse(value), true);\n return {\n lo: dv.getInt32(0, true),\n hi: dv.getInt32(4, true),\n };\n },\n dec(lo, hi) {\n dv.setInt32(0, lo, true);\n dv.setInt32(4, hi, true);\n return dv.getBigInt64(0, true);\n },\n uDec(lo, hi) {\n dv.setInt32(0, lo, true);\n dv.setInt32(4, hi, true);\n return dv.getBigUint64(0, true);\n },\n };\n }\n const assertInt64String = (value) => (0, assert_js_1.assert)(/^-?[0-9]+$/.test(value), `int64 invalid: ${value}`);\n const assertUInt64String = (value) => (0, assert_js_1.assert)(/^[0-9]+$/.test(value), `uint64 invalid: ${value}`);\n return {\n zero: \"0\",\n supported: false,\n parse(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertInt64String(value);\n return value;\n },\n uParse(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertUInt64String(value);\n return value;\n },\n enc(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertInt64String(value);\n return (0, varint_js_1.int64FromString)(value);\n },\n uEnc(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertUInt64String(value);\n return (0, varint_js_1.int64FromString)(value);\n },\n dec(lo, hi) {\n return (0, varint_js_1.int64ToString)(lo, hi);\n },\n uDec(lo, hi) {\n return (0, varint_js_1.uInt64ToString)(lo, hi);\n },\n };\n}\nexports.protoInt64 = makeInt64Support();\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.proto2 = void 0;\nconst proto_runtime_js_1 = require(\"./private/proto-runtime.js\");\nconst binary_format_proto2_js_1 = require(\"./private/binary-format-proto2.js\");\nconst util_common_js_1 = require(\"./private/util-common.js\");\nconst field_list_js_1 = require(\"./private/field-list.js\");\nconst field_js_1 = require(\"./private/field.js\");\nconst names_js_1 = require(\"./private/names.js\");\nconst json_format_proto2_js_1 = require(\"./private/json-format-proto2.js\");\n/**\n * Provides functionality for messages defined with the proto2 syntax.\n */\nexports.proto2 = (0, proto_runtime_js_1.makeProtoRuntime)(\"proto2\", (0, json_format_proto2_js_1.makeJsonFormatProto2)(), (0, binary_format_proto2_js_1.makeBinaryFormatProto2)(), Object.assign(Object.assign({}, (0, util_common_js_1.makeUtilCommon)()), { newFieldList(fields) {\n return new field_list_js_1.InternalFieldList(fields, normalizeFieldInfosProto2);\n },\n initFields(target) {\n for (const member of target.getType().fields.byMember()) {\n const name = member.localName, t = target;\n if (member.repeated) {\n t[name] = [];\n continue;\n }\n switch (member.kind) {\n case \"oneof\":\n t[name] = { case: undefined };\n break;\n case \"map\":\n t[name] = {};\n break;\n case \"scalar\":\n case \"enum\":\n case \"message\":\n // In contrast to proto3, enum and scalar fields have no intrinsic default value,\n // only an optional explicit default value.\n // Unlike proto3 intrinsic default values, proto2 explicit default values are not\n // set on construction, because they are not omitted on the wire. If we did set\n // default values on construction, a deserialize-serialize round-trip would add\n // fields to a message.\n break;\n }\n }\n } }));\n/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */\nfunction normalizeFieldInfosProto2(fieldInfos) {\n var _a, _b, _c;\n const r = [];\n let o;\n for (const field of typeof fieldInfos == \"function\"\n ? fieldInfos()\n : fieldInfos) {\n const f = field;\n f.localName = (0, names_js_1.localFieldName)(field.name, field.oneof !== undefined);\n f.jsonName = (_a = field.jsonName) !== null && _a !== void 0 ? _a : (0, names_js_1.fieldJsonName)(field.name);\n f.repeated = (_b = field.repeated) !== null && _b !== void 0 ? _b : false;\n // In contrast to proto3, repeated fields are unpacked except when explicitly specified.\n f.packed = (_c = field.packed) !== null && _c !== void 0 ? _c : false;\n // We do not surface options at this time\n // f.options = field.options ?? emptyReadonlyObject;\n if (field.oneof !== undefined) {\n const ooname = typeof field.oneof == \"string\" ? field.oneof : field.oneof.name;\n if (!o || o.name != ooname) {\n o = new field_js_1.InternalOneofInfo(ooname);\n }\n f.oneof = o;\n o.addField(f);\n }\n r.push(f);\n }\n return r;\n}\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.proto3 = void 0;\nconst proto_runtime_js_1 = require(\"./private/proto-runtime.js\");\nconst binary_format_proto3_js_1 = require(\"./private/binary-format-proto3.js\");\nconst json_format_proto3_js_1 = require(\"./private/json-format-proto3.js\");\nconst util_common_js_1 = require(\"./private/util-common.js\");\nconst field_list_js_1 = require(\"./private/field-list.js\");\nconst scalars_js_1 = require(\"./private/scalars.js\");\nconst field_js_1 = require(\"./field.js\");\nconst field_js_2 = require(\"./private/field.js\");\nconst names_js_1 = require(\"./private/names.js\");\n/**\n * Provides functionality for messages defined with the proto3 syntax.\n */\nexports.proto3 = (0, proto_runtime_js_1.makeProtoRuntime)(\"proto3\", (0, json_format_proto3_js_1.makeJsonFormatProto3)(), (0, binary_format_proto3_js_1.makeBinaryFormatProto3)(), Object.assign(Object.assign({}, (0, util_common_js_1.makeUtilCommon)()), { newFieldList(fields) {\n return new field_list_js_1.InternalFieldList(fields, normalizeFieldInfosProto3);\n },\n initFields(target) {\n for (const member of target.getType().fields.byMember()) {\n if (member.opt) {\n continue;\n }\n const name = member.localName, t = target;\n if (member.repeated) {\n t[name] = [];\n continue;\n }\n switch (member.kind) {\n case \"oneof\":\n t[name] = { case: undefined };\n break;\n case \"enum\":\n t[name] = 0;\n break;\n case \"map\":\n t[name] = {};\n break;\n case \"scalar\":\n t[name] = (0, scalars_js_1.scalarDefaultValue)(member.T); // eslint-disable-line @typescript-eslint/no-unsafe-assignment\n break;\n case \"message\":\n // message fields are always optional in proto3\n break;\n }\n }\n } }));\n/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */\nfunction normalizeFieldInfosProto3(fieldInfos) {\n var _a, _b, _c;\n const r = [];\n let o;\n for (const field of typeof fieldInfos == \"function\"\n ? fieldInfos()\n : fieldInfos) {\n const f = field;\n f.localName = (0, names_js_1.localFieldName)(field.name, field.oneof !== undefined);\n f.jsonName = (_a = field.jsonName) !== null && _a !== void 0 ? _a : (0, names_js_1.fieldJsonName)(field.name);\n f.repeated = (_b = field.repeated) !== null && _b !== void 0 ? _b : false;\n // From the proto3 language guide:\n // > In proto3, repeated fields of scalar numeric types are packed by default.\n // This information is incomplete - according to the conformance tests, BOOL\n // and ENUM are packed by default as well. This means only STRING and BYTES\n // are not packed by default, which makes sense because they are length-delimited.\n f.packed =\n (_c = field.packed) !== null && _c !== void 0 ? _c : (field.kind == \"enum\" ||\n (field.kind == \"scalar\" &&\n field.T != field_js_1.ScalarType.BYTES &&\n field.T != field_js_1.ScalarType.STRING));\n // We do not surface options at this time\n // f.options = field.options ?? emptyReadonlyObject;\n if (field.oneof !== undefined) {\n const ooname = typeof field.oneof == \"string\" ? field.oneof : field.oneof.name;\n if (!o || o.name != ooname) {\n o = new field_js_2.InternalOneofInfo(ooname);\n }\n f.oneof = o;\n o.addField(f);\n }\n r.push(f);\n }\n return r;\n}\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MethodIdempotency = exports.MethodKind = void 0;\n/**\n * MethodKind represents the four method types that can be declared in\n * protobuf with the `stream` keyword:\n *\n * 1. Unary: rpc (Input) returns (Output)\n * 2. ServerStreaming: rpc (Input) returns (stream Output)\n * 3. ClientStreaming: rpc (stream Input) returns (Output)\n * 4. BiDiStreaming: rpc (stream Input) returns (stream Output)\n */\nvar MethodKind;\n(function (MethodKind) {\n MethodKind[MethodKind[\"Unary\"] = 0] = \"Unary\";\n MethodKind[MethodKind[\"ServerStreaming\"] = 1] = \"ServerStreaming\";\n MethodKind[MethodKind[\"ClientStreaming\"] = 2] = \"ClientStreaming\";\n MethodKind[MethodKind[\"BiDiStreaming\"] = 3] = \"BiDiStreaming\";\n})(MethodKind || (exports.MethodKind = MethodKind = {}));\n/**\n * Is this method side-effect-free (or safe in HTTP parlance), or just\n * idempotent, or neither? HTTP based RPC implementation may choose GET verb\n * for safe methods, and PUT verb for idempotent methods instead of the\n * default POST.\n *\n * This enum matches the protobuf enum google.protobuf.MethodOptions.IdempotencyLevel,\n * defined in the well-known type google/protobuf/descriptor.proto, but\n * drops UNKNOWN.\n */\nvar MethodIdempotency;\n(function (MethodIdempotency) {\n /**\n * Idempotent, no side effects.\n */\n MethodIdempotency[MethodIdempotency[\"NoSideEffects\"] = 1] = \"NoSideEffects\";\n /**\n * Idempotent, but may have side effects.\n */\n MethodIdempotency[MethodIdempotency[\"Idempotent\"] = 2] = \"Idempotent\";\n})(MethodIdempotency || (exports.MethodIdempotency = MethodIdempotency = {}));\n","\"use strict\";\n// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.toPlainMessage = void 0;\n/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */\nconst message_js_1 = require(\"./message.js\");\n/**\n * toPlainMessage returns a new object by striping\n * all methods from a message, leaving only fields and\n * oneof groups. It is recursive, meaning it applies this\n * same logic to all nested message fields as well.\n */\nfunction toPlainMessage(message) {\n const type = message.getType();\n const target = {};\n for (const member of type.fields.byMember()) {\n const source = message[member.localName];\n let copy;\n if (member.repeated) {\n copy = source.map((e) => toPlainValue(e));\n }\n else if (member.kind == \"map\") {\n copy = {};\n for (const [key, v] of Object.entries(source)) {\n copy[key] = toPlainValue(v);\n }\n }\n else if (member.kind == \"oneof\") {\n const f = member.findField(source.case);\n copy = f\n ? { case: source.case, value: toPlainValue(source.value) }\n : { case: undefined };\n }\n else {\n copy = toPlainValue(source);\n }\n target[member.localName] = copy;\n }\n return target;\n}\nexports.toPlainMessage = toPlainMessage;\nfunction toPlainValue(value) {\n if (value === undefined) {\n return value;\n }\n if (value instanceof message_js_1.Message) {\n return toPlainMessage(value);\n }\n if (value instanceof Uint8Array) {\n const c = new Uint8Array(value.byteLength);\n c.set(value);\n return c;\n }\n return value;\n}\n","export default function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}","export default function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return self;\n}","export default function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nexport default function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}","import unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nexport default function _createForOfIteratorHelper(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (!it) {\n if (Array.isArray(o) || (it = unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n var F = function F() {};\n return {\n s: F,\n n: function n() {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function e(_e) {\n throw _e;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function s() {\n it = it.call(o);\n },\n n: function n() {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function e(_e2) {\n didErr = true;\n err = _e2;\n },\n f: function f() {\n try {\n if (!normalCompletion && it[\"return\"] != null) it[\"return\"]();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n}","import getPrototypeOf from \"./getPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nimport possibleConstructorReturn from \"./possibleConstructorReturn.js\";\nexport default function _createSuper(Derived) {\n var hasNativeReflectConstruct = isNativeReflectConstruct();\n return function _createSuperInternal() {\n var Super = getPrototypeOf(Derived),\n result;\n if (hasNativeReflectConstruct) {\n var NewTarget = getPrototypeOf(this).constructor;\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n return possibleConstructorReturn(this, result);\n };\n}","import _typeof from \"./typeof.js\";\nimport assertThisInitialized from \"./assertThisInitialized.js\";\nexport default function _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n } else if (call !== void 0) {\n throw new TypeError(\"Derived constructors may only return object or undefined\");\n }\n return assertThisInitialized(self);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","export default function _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n Object.defineProperty(subClass, \"prototype\", {\n writable: false\n });\n if (superClass) setPrototypeOf(subClass, superClass);\n}","export default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}","export default function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import arrayWithHoles from \"./arrayWithHoles.js\";\nimport iterableToArrayLimit from \"./iterableToArrayLimit.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableRest from \"./nonIterableRest.js\";\nexport default function _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}","export default function _iterableToArrayLimit(arr, i) {\n var _i = null == arr ? null : \"undefined\" != typeof Symbol && arr[Symbol.iterator] || arr[\"@@iterator\"];\n if (null != _i) {\n var _s,\n _e,\n _x,\n _r,\n _arr = [],\n _n = !0,\n _d = !1;\n try {\n if (_x = (_i = _i.call(arr)).next, 0 === i) {\n if (Object(_i) !== _i) return;\n _n = !1;\n } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);\n } catch (err) {\n _d = !0, _e = err;\n } finally {\n try {\n if (!_n && null != _i[\"return\"] && (_r = _i[\"return\"](), Object(_r) !== _r)) return;\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n}","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}","// Copyright 2008 Google Inc. All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n//\n// Code generated by the Protocol Buffer compiler is owned by the owner\n// of the input file used when generating it. This code is not\n// standalone and requires a support library to be linked with it. This\n// support library is itself covered by the above license.\n/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */\n/**\n * Read a 64 bit varint as two JS numbers.\n *\n * Returns tuple:\n * [0]: low bits\n * [1]: high bits\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175\n */\nexport function varint64read() {\n let lowBits = 0;\n let highBits = 0;\n for (let shift = 0; shift < 28; shift += 7) {\n let b = this.buf[this.pos++];\n lowBits |= (b & 0x7f) << shift;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n }\n let middleByte = this.buf[this.pos++];\n // last four bits of the first 32 bit number\n lowBits |= (middleByte & 0x0f) << 28;\n // 3 upper bits are part of the next 32 bit number\n highBits = (middleByte & 0x70) >> 4;\n if ((middleByte & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n for (let shift = 3; shift <= 31; shift += 7) {\n let b = this.buf[this.pos++];\n highBits |= (b & 0x7f) << shift;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return [lowBits, highBits];\n }\n }\n throw new Error(\"invalid varint\");\n}\n/**\n * Write a 64 bit varint, given as two JS numbers, to the given bytes array.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344\n */\nexport function varint64write(lo, hi, bytes) {\n for (let i = 0; i < 28; i = i + 7) {\n const shift = lo >>> i;\n const hasNext = !(shift >>> 7 == 0 && hi == 0);\n const byte = (hasNext ? shift | 0x80 : shift) & 0xff;\n bytes.push(byte);\n if (!hasNext) {\n return;\n }\n }\n const splitBits = ((lo >>> 28) & 0x0f) | ((hi & 0x07) << 4);\n const hasMoreBits = !(hi >> 3 == 0);\n bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xff);\n if (!hasMoreBits) {\n return;\n }\n for (let i = 3; i < 31; i = i + 7) {\n const shift = hi >>> i;\n const hasNext = !(shift >>> 7 == 0);\n const byte = (hasNext ? shift | 0x80 : shift) & 0xff;\n bytes.push(byte);\n if (!hasNext) {\n return;\n }\n }\n bytes.push((hi >>> 31) & 0x01);\n}\n// constants for binary math\nconst TWO_PWR_32_DBL = 0x100000000;\n/**\n * Parse decimal string of 64 bit integer value as two JS numbers.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nexport function int64FromString(dec) {\n // Check for minus sign.\n const minus = dec[0] === \"-\";\n if (minus) {\n dec = dec.slice(1);\n }\n // Work 6 decimal digits at a time, acting like we're converting base 1e6\n // digits to binary. This is safe to do with floating point math because\n // Number.isSafeInteger(ALL_32_BITS * 1e6) == true.\n const base = 1e6;\n let lowBits = 0;\n let highBits = 0;\n function add1e6digit(begin, end) {\n // Note: Number('') is 0.\n const digit1e6 = Number(dec.slice(begin, end));\n highBits *= base;\n lowBits = lowBits * base + digit1e6;\n // Carry bits from lowBits to\n if (lowBits >= TWO_PWR_32_DBL) {\n highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0);\n lowBits = lowBits % TWO_PWR_32_DBL;\n }\n }\n add1e6digit(-24, -18);\n add1e6digit(-18, -12);\n add1e6digit(-12, -6);\n add1e6digit(-6);\n return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits);\n}\n/**\n * Losslessly converts a 64-bit signed integer in 32:32 split representation\n * into a decimal string.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nexport function int64ToString(lo, hi) {\n let bits = newBits(lo, hi);\n // If we're treating the input as a signed value and the high bit is set, do\n // a manual two's complement conversion before the decimal conversion.\n const negative = (bits.hi & 0x80000000);\n if (negative) {\n bits = negate(bits.lo, bits.hi);\n }\n const result = uInt64ToString(bits.lo, bits.hi);\n return negative ? \"-\" + result : result;\n}\n/**\n * Losslessly converts a 64-bit unsigned integer in 32:32 split representation\n * into a decimal string.\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10\n */\nexport function uInt64ToString(lo, hi) {\n ({ lo, hi } = toUnsigned(lo, hi));\n // Skip the expensive conversion if the number is small enough to use the\n // built-in conversions.\n // Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with\n // highBits <= 0x1FFFFF can be safely expressed with a double and retain\n // integer precision.\n // Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true.\n if (hi <= 0x1FFFFF) {\n return String(TWO_PWR_32_DBL * hi + lo);\n }\n // What this code is doing is essentially converting the input number from\n // base-2 to base-1e7, which allows us to represent the 64-bit range with\n // only 3 (very large) digits. Those digits are then trivial to convert to\n // a base-10 string.\n // The magic numbers used here are -\n // 2^24 = 16777216 = (1,6777216) in base-1e7.\n // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7.\n // Split 32:32 representation into 16:24:24 representation so our\n // intermediate digits don't overflow.\n const low = lo & 0xFFFFFF;\n const mid = ((lo >>> 24) | (hi << 8)) & 0xFFFFFF;\n const high = (hi >> 16) & 0xFFFF;\n // Assemble our three base-1e7 digits, ignoring carries. The maximum\n // value in a digit at this step is representable as a 48-bit integer, which\n // can be stored in a 64-bit floating point number.\n let digitA = low + (mid * 6777216) + (high * 6710656);\n let digitB = mid + (high * 8147497);\n let digitC = (high * 2);\n // Apply carries from A to B and from B to C.\n const base = 10000000;\n if (digitA >= base) {\n digitB += Math.floor(digitA / base);\n digitA %= base;\n }\n if (digitB >= base) {\n digitC += Math.floor(digitB / base);\n digitB %= base;\n }\n // If digitC is 0, then we should have returned in the trivial code path\n // at the top for non-safe integers. Given this, we can assume both digitB\n // and digitA need leading zeros.\n return digitC.toString() + decimalFrom1e7WithLeadingZeros(digitB) +\n decimalFrom1e7WithLeadingZeros(digitA);\n}\nfunction toUnsigned(lo, hi) {\n return { lo: lo >>> 0, hi: hi >>> 0 };\n}\nfunction newBits(lo, hi) {\n return { lo: lo | 0, hi: hi | 0 };\n}\n/**\n * Returns two's compliment negation of input.\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers\n */\nfunction negate(lowBits, highBits) {\n highBits = ~highBits;\n if (lowBits) {\n lowBits = ~lowBits + 1;\n }\n else {\n // If lowBits is 0, then bitwise-not is 0xFFFFFFFF,\n // adding 1 to that, results in 0x100000000, which leaves\n // the low bits 0x0 and simply adds one to the high bits.\n highBits += 1;\n }\n return newBits(lowBits, highBits);\n}\n/**\n * Returns decimal representation of digit1e7 with leading zeros.\n */\nconst decimalFrom1e7WithLeadingZeros = (digit1e7) => {\n const partial = String(digit1e7);\n return \"0000000\".slice(partial.length) + partial;\n};\n/**\n * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)`\n *\n * Copyright 2008 Google Inc. All rights reserved.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144\n */\nexport function varint32write(value, bytes) {\n if (value >= 0) {\n // write value as varint 32\n while (value > 0x7f) {\n bytes.push((value & 0x7f) | 0x80);\n value = value >>> 7;\n }\n bytes.push(value);\n }\n else {\n for (let i = 0; i < 9; i++) {\n bytes.push((value & 127) | 128);\n value = value >> 7;\n }\n bytes.push(1);\n }\n}\n/**\n * Read an unsigned 32 bit varint.\n *\n * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220\n */\nexport function varint32read() {\n let b = this.buf[this.pos++];\n let result = b & 0x7f;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 7;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 14;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n b = this.buf[this.pos++];\n result |= (b & 0x7f) << 21;\n if ((b & 0x80) == 0) {\n this.assertBounds();\n return result;\n }\n // Extract only last 4 bits\n b = this.buf[this.pos++];\n result |= (b & 0x0f) << 28;\n for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++)\n b = this.buf[this.pos++];\n if ((b & 0x80) != 0)\n throw new Error(\"invalid varint\");\n this.assertBounds();\n // Result can have 32 bits, convert it to unsigned\n return result >>> 0;\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n/**\n * Message is the base class of every message, generated, or created at\n * runtime.\n *\n * It is _not_ safe to extend this class. If you want to create a message at\n * run time, use proto3.makeMessageType().\n */\nexport class Message {\n /**\n * Compare with a message of the same type.\n */\n equals(other) {\n return this.getType().runtime.util.equals(this.getType(), this, other);\n }\n /**\n * Create a deep copy.\n */\n clone() {\n return this.getType().runtime.util.clone(this);\n }\n /**\n * Parse from binary data, merging fields.\n *\n * Repeated fields are appended. Map entries are added, overwriting\n * existing keys.\n *\n * If a message field is already present, it will be merged with the\n * new data.\n */\n fromBinary(bytes, options) {\n const type = this.getType(), format = type.runtime.bin, opt = format.makeReadOptions(options);\n format.readMessage(this, opt.readerFactory(bytes), bytes.byteLength, opt);\n return this;\n }\n /**\n * Parse a message from a JSON value.\n */\n fromJson(jsonValue, options) {\n const type = this.getType(), format = type.runtime.json, opt = format.makeReadOptions(options);\n format.readMessage(type, jsonValue, opt, this);\n return this;\n }\n /**\n * Parse a message from a JSON string.\n */\n fromJsonString(jsonString, options) {\n let json;\n try {\n json = JSON.parse(jsonString);\n }\n catch (e) {\n throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${e instanceof Error ? e.message : String(e)}`);\n }\n return this.fromJson(json, options);\n }\n /**\n * Serialize the message to binary data.\n */\n toBinary(options) {\n const type = this.getType(), bin = type.runtime.bin, opt = bin.makeWriteOptions(options), writer = opt.writerFactory();\n bin.writeMessage(this, writer, opt);\n return writer.finish();\n }\n /**\n * Serialize the message to a JSON value, a JavaScript value that can be\n * passed to JSON.stringify().\n */\n toJson(options) {\n const type = this.getType(), json = type.runtime.json, opt = json.makeWriteOptions(options);\n return json.writeMessage(this, opt);\n }\n /**\n * Serialize the message to a JSON string.\n */\n toJsonString(options) {\n var _a;\n const value = this.toJson(options);\n return JSON.stringify(value, null, (_a = options === null || options === void 0 ? void 0 : options.prettySpaces) !== null && _a !== void 0 ? _a : 0);\n }\n /**\n * Override for serialization behavior. This will be invoked when calling\n * JSON.stringify on this message (i.e. JSON.stringify(msg)).\n *\n * Note that this will not serialize google.protobuf.Any with a packed\n * message because the protobuf JSON format specifies that it needs to be\n * unpacked, and this is only possible with a type registry to look up the\n * message type. As a result, attempting to serialize a message with this\n * type will throw an Error.\n *\n * This method is protected because you should not need to invoke it\n * directly -- instead use JSON.stringify or toJsonString for\n * stringified JSON. Alternatively, if actual JSON is desired, you should\n * use toJson.\n */\n toJSON() {\n return this.toJson({\n emitDefaultValues: true,\n });\n }\n /**\n * Retrieve the MessageType of this message - a singleton that represents\n * the protobuf message declaration and provides metadata for reflection-\n * based operations.\n */\n getType() {\n // Any class that extends Message _must_ provide a complete static\n // implementation of MessageType.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return\n return Object.getPrototypeOf(this).constructor;\n }\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n/**\n * Assert that condition is truthy or throw error (with message)\n */\nexport function assert(condition, msg) {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions -- we want the implicit conversion to boolean\n if (!condition) {\n throw new Error(msg);\n }\n}\nconst FLOAT32_MAX = 3.4028234663852886e38, FLOAT32_MIN = -3.4028234663852886e38, UINT32_MAX = 0xffffffff, INT32_MAX = 0x7fffffff, INT32_MIN = -0x80000000;\n/**\n * Assert a valid signed protobuf 32-bit integer.\n */\nexport function assertInt32(arg) {\n if (typeof arg !== \"number\")\n throw new Error(\"invalid int 32: \" + typeof arg);\n if (!Number.isInteger(arg) || arg > INT32_MAX || arg < INT32_MIN)\n throw new Error(\"invalid int 32: \" + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string\n}\n/**\n * Assert a valid unsigned protobuf 32-bit integer.\n */\nexport function assertUInt32(arg) {\n if (typeof arg !== \"number\")\n throw new Error(\"invalid uint 32: \" + typeof arg);\n if (!Number.isInteger(arg) || arg > UINT32_MAX || arg < 0)\n throw new Error(\"invalid uint 32: \" + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string\n}\n/**\n * Assert a valid protobuf float value.\n */\nexport function assertFloat32(arg) {\n if (typeof arg !== \"number\")\n throw new Error(\"invalid float 32: \" + typeof arg);\n if (!Number.isFinite(arg))\n return;\n if (arg > FLOAT32_MAX || arg < FLOAT32_MIN)\n throw new Error(\"invalid float 32: \" + arg); // eslint-disable-line @typescript-eslint/restrict-plus-operands -- we want the implicit conversion to string\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n/* eslint-disable @typescript-eslint/ban-ts-comment, @typescript-eslint/no-unnecessary-condition, prefer-const */\n// lookup table from base64 character to byte\nlet encTable = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\".split(\"\");\n// lookup table from base64 character *code* to byte because lookup by number is fast\nlet decTable = [];\nfor (let i = 0; i < encTable.length; i++)\n decTable[encTable[i].charCodeAt(0)] = i;\n// support base64url variants\ndecTable[\"-\".charCodeAt(0)] = encTable.indexOf(\"+\");\ndecTable[\"_\".charCodeAt(0)] = encTable.indexOf(\"/\");\nexport const protoBase64 = {\n /**\n * Decodes a base64 string to a byte array.\n *\n * - ignores white-space, including line breaks and tabs\n * - allows inner padding (can decode concatenated base64 strings)\n * - does not require padding\n * - understands base64url encoding:\n * \"-\" instead of \"+\",\n * \"_\" instead of \"/\",\n * no padding\n */\n dec(base64Str) {\n // estimate byte size, not accounting for inner padding and whitespace\n let es = (base64Str.length * 3) / 4;\n if (base64Str[base64Str.length - 2] == \"=\")\n es -= 2;\n else if (base64Str[base64Str.length - 1] == \"=\")\n es -= 1;\n let bytes = new Uint8Array(es), bytePos = 0, // position in byte array\n groupPos = 0, // position in base64 group\n b, // current byte\n p = 0; // previous byte\n for (let i = 0; i < base64Str.length; i++) {\n b = decTable[base64Str.charCodeAt(i)];\n if (b === undefined) {\n switch (base64Str[i]) {\n // @ts-ignore TS7029: Fallthrough case in switch\n case \"=\":\n groupPos = 0; // reset state when padding found\n // @ts-ignore TS7029: Fallthrough case in switch\n case \"\\n\":\n case \"\\r\":\n case \"\\t\":\n case \" \":\n continue; // skip white-space, and padding\n default:\n throw Error(\"invalid base64 string.\");\n }\n }\n switch (groupPos) {\n case 0:\n p = b;\n groupPos = 1;\n break;\n case 1:\n bytes[bytePos++] = (p << 2) | ((b & 48) >> 4);\n p = b;\n groupPos = 2;\n break;\n case 2:\n bytes[bytePos++] = ((p & 15) << 4) | ((b & 60) >> 2);\n p = b;\n groupPos = 3;\n break;\n case 3:\n bytes[bytePos++] = ((p & 3) << 6) | b;\n groupPos = 0;\n break;\n }\n }\n if (groupPos == 1)\n throw Error(\"invalid base64 string.\");\n return bytes.subarray(0, bytePos);\n },\n /**\n * Encode a byte array to a base64 string.\n */\n enc(bytes) {\n let base64 = \"\", groupPos = 0, // position in base64 group\n b, // current byte\n p = 0; // carry over from previous byte\n for (let i = 0; i < bytes.length; i++) {\n b = bytes[i];\n switch (groupPos) {\n case 0:\n base64 += encTable[b >> 2];\n p = (b & 3) << 4;\n groupPos = 1;\n break;\n case 1:\n base64 += encTable[p | (b >> 4)];\n p = (b & 15) << 2;\n groupPos = 2;\n break;\n case 2:\n base64 += encTable[p | (b >> 6)];\n base64 += encTable[b & 63];\n groupPos = 0;\n break;\n }\n }\n // add output padding\n if (groupPos) {\n base64 += encTable[p];\n base64 += \"=\";\n if (groupPos == 1)\n base64 += \"=\";\n }\n return base64;\n },\n};\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { assert } from \"./private/assert.js\";\nimport { int64FromString, int64ToString, uInt64ToString, } from \"./google/varint.js\";\nfunction makeInt64Support() {\n const dv = new DataView(new ArrayBuffer(8));\n // note that Safari 14 implements BigInt, but not the DataView methods\n const ok = typeof BigInt === \"function\" &&\n typeof dv.getBigInt64 === \"function\" &&\n typeof dv.getBigUint64 === \"function\" &&\n typeof dv.setBigInt64 === \"function\" &&\n typeof dv.setBigUint64 === \"function\" &&\n (typeof process != \"object\" ||\n typeof process.env != \"object\" ||\n process.env.BUF_BIGINT_DISABLE !== \"1\");\n if (ok) {\n const MIN = BigInt(\"-9223372036854775808\"), MAX = BigInt(\"9223372036854775807\"), UMIN = BigInt(\"0\"), UMAX = BigInt(\"18446744073709551615\");\n return {\n zero: BigInt(0),\n supported: true,\n parse(value) {\n const bi = typeof value == \"bigint\" ? value : BigInt(value);\n if (bi > MAX || bi < MIN) {\n throw new Error(`int64 invalid: ${value}`);\n }\n return bi;\n },\n uParse(value) {\n const bi = typeof value == \"bigint\" ? value : BigInt(value);\n if (bi > UMAX || bi < UMIN) {\n throw new Error(`uint64 invalid: ${value}`);\n }\n return bi;\n },\n enc(value) {\n dv.setBigInt64(0, this.parse(value), true);\n return {\n lo: dv.getInt32(0, true),\n hi: dv.getInt32(4, true),\n };\n },\n uEnc(value) {\n dv.setBigInt64(0, this.uParse(value), true);\n return {\n lo: dv.getInt32(0, true),\n hi: dv.getInt32(4, true),\n };\n },\n dec(lo, hi) {\n dv.setInt32(0, lo, true);\n dv.setInt32(4, hi, true);\n return dv.getBigInt64(0, true);\n },\n uDec(lo, hi) {\n dv.setInt32(0, lo, true);\n dv.setInt32(4, hi, true);\n return dv.getBigUint64(0, true);\n },\n };\n }\n const assertInt64String = (value) => assert(/^-?[0-9]+$/.test(value), `int64 invalid: ${value}`);\n const assertUInt64String = (value) => assert(/^[0-9]+$/.test(value), `uint64 invalid: ${value}`);\n return {\n zero: \"0\",\n supported: false,\n parse(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertInt64String(value);\n return value;\n },\n uParse(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertUInt64String(value);\n return value;\n },\n enc(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertInt64String(value);\n return int64FromString(value);\n },\n uEnc(value) {\n if (typeof value != \"string\") {\n value = value.toString();\n }\n assertUInt64String(value);\n return int64FromString(value);\n },\n dec(lo, hi) {\n return int64ToString(lo, hi);\n },\n uDec(lo, hi) {\n return uInt64ToString(lo, hi);\n },\n };\n}\nexport const protoInt64 = makeInt64Support();\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { assert } from \"./assert.js\";\nconst enumTypeSymbol = Symbol(\"@bufbuild/protobuf/enum-type\");\n/**\n * Get reflection information from a generated enum.\n * If this function is called on something other than a generated\n * enum, it raises an error.\n */\nexport function getEnumType(enumObject) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-explicit-any\n const t = enumObject[enumTypeSymbol];\n assert(t, \"missing enum type on enum object\");\n return t; // eslint-disable-line @typescript-eslint/no-unsafe-return\n}\n/**\n * Sets reflection information on a generated enum.\n */\nexport function setEnumType(enumObject, typeName, values, opt) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n enumObject[enumTypeSymbol] = makeEnumType(typeName, values.map((v) => ({\n no: v.no,\n name: v.name,\n localName: enumObject[v.no],\n })), opt);\n}\n/**\n * Create a new EnumType with the given values.\n */\nexport function makeEnumType(typeName, values, \n// eslint-disable-next-line @typescript-eslint/no-unused-vars\n_opt) {\n const names = Object.create(null);\n const numbers = Object.create(null);\n const normalValues = [];\n for (const value of values) {\n // We do not surface options at this time\n // const value: EnumValueInfo = {...v, options: v.options ?? emptyReadonlyObject};\n const n = normalizeEnumValue(value);\n normalValues.push(n);\n names[value.name] = n;\n numbers[value.no] = n;\n }\n return {\n typeName,\n values: normalValues,\n // We do not surface options at this time\n // options: opt?.options ?? Object.create(null),\n findName(name) {\n return names[name];\n },\n findNumber(no) {\n return numbers[no];\n },\n };\n}\n/**\n * Create a new enum object with the given values.\n * Sets reflection information.\n */\nexport function makeEnum(typeName, values, opt) {\n const enumObject = {};\n for (const value of values) {\n const n = normalizeEnumValue(value);\n enumObject[n.localName] = n.no;\n enumObject[n.no] = n.localName;\n }\n setEnumType(enumObject, typeName, values, opt);\n return enumObject;\n}\nfunction normalizeEnumValue(value) {\n if (\"localName\" in value) {\n return value;\n }\n return Object.assign(Object.assign({}, value), { localName: value.name });\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n/**\n * Scalar value types. This is a subset of field types declared by protobuf\n * enum google.protobuf.FieldDescriptorProto.Type The types GROUP and MESSAGE\n * are omitted, but the numerical values are identical.\n */\nexport var ScalarType;\n(function (ScalarType) {\n // 0 is reserved for errors.\n // Order is weird for historical reasons.\n ScalarType[ScalarType[\"DOUBLE\"] = 1] = \"DOUBLE\";\n ScalarType[ScalarType[\"FLOAT\"] = 2] = \"FLOAT\";\n // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if\n // negative values are likely.\n ScalarType[ScalarType[\"INT64\"] = 3] = \"INT64\";\n ScalarType[ScalarType[\"UINT64\"] = 4] = \"UINT64\";\n // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if\n // negative values are likely.\n ScalarType[ScalarType[\"INT32\"] = 5] = \"INT32\";\n ScalarType[ScalarType[\"FIXED64\"] = 6] = \"FIXED64\";\n ScalarType[ScalarType[\"FIXED32\"] = 7] = \"FIXED32\";\n ScalarType[ScalarType[\"BOOL\"] = 8] = \"BOOL\";\n ScalarType[ScalarType[\"STRING\"] = 9] = \"STRING\";\n // Tag-delimited aggregate.\n // Group type is deprecated and not supported in proto3. However, Proto3\n // implementations should still be able to parse the group wire format and\n // treat group fields as unknown fields.\n // TYPE_GROUP = 10,\n // TYPE_MESSAGE = 11, // Length-delimited aggregate.\n // New in version 2.\n ScalarType[ScalarType[\"BYTES\"] = 12] = \"BYTES\";\n ScalarType[ScalarType[\"UINT32\"] = 13] = \"UINT32\";\n // TYPE_ENUM = 14,\n ScalarType[ScalarType[\"SFIXED32\"] = 15] = \"SFIXED32\";\n ScalarType[ScalarType[\"SFIXED64\"] = 16] = \"SFIXED64\";\n ScalarType[ScalarType[\"SINT32\"] = 17] = \"SINT32\";\n ScalarType[ScalarType[\"SINT64\"] = 18] = \"SINT64\";\n})(ScalarType || (ScalarType = {}));\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { varint32read, varint32write, varint64read, varint64write, } from \"./google/varint.js\";\nimport { assertFloat32, assertInt32, assertUInt32 } from \"./private/assert.js\";\nimport { protoInt64 } from \"./proto-int64.js\";\n/* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/restrict-plus-operands */\n/**\n * Protobuf binary format wire types.\n *\n * A wire type provides just enough information to find the length of the\n * following value.\n *\n * See https://developers.google.com/protocol-buffers/docs/encoding#structure\n */\nexport var WireType;\n(function (WireType) {\n /**\n * Used for int32, int64, uint32, uint64, sint32, sint64, bool, enum\n */\n WireType[WireType[\"Varint\"] = 0] = \"Varint\";\n /**\n * Used for fixed64, sfixed64, double.\n * Always 8 bytes with little-endian byte order.\n */\n WireType[WireType[\"Bit64\"] = 1] = \"Bit64\";\n /**\n * Used for string, bytes, embedded messages, packed repeated fields\n *\n * Only repeated numeric types (types which use the varint, 32-bit,\n * or 64-bit wire types) can be packed. In proto3, such fields are\n * packed by default.\n */\n WireType[WireType[\"LengthDelimited\"] = 2] = \"LengthDelimited\";\n /**\n * Used for groups\n * @deprecated\n */\n WireType[WireType[\"StartGroup\"] = 3] = \"StartGroup\";\n /**\n * Used for groups\n * @deprecated\n */\n WireType[WireType[\"EndGroup\"] = 4] = \"EndGroup\";\n /**\n * Used for fixed32, sfixed32, float.\n * Always 4 bytes with little-endian byte order.\n */\n WireType[WireType[\"Bit32\"] = 5] = \"Bit32\";\n})(WireType || (WireType = {}));\nexport class BinaryWriter {\n constructor(textEncoder) {\n /**\n * Previous fork states.\n */\n this.stack = [];\n this.textEncoder = textEncoder !== null && textEncoder !== void 0 ? textEncoder : new TextEncoder();\n this.chunks = [];\n this.buf = [];\n }\n /**\n * Return all bytes written and reset this writer.\n */\n finish() {\n this.chunks.push(new Uint8Array(this.buf)); // flush the buffer\n let len = 0;\n for (let i = 0; i < this.chunks.length; i++)\n len += this.chunks[i].length;\n let bytes = new Uint8Array(len);\n let offset = 0;\n for (let i = 0; i < this.chunks.length; i++) {\n bytes.set(this.chunks[i], offset);\n offset += this.chunks[i].length;\n }\n this.chunks = [];\n return bytes;\n }\n /**\n * Start a new fork for length-delimited data like a message\n * or a packed repeated field.\n *\n * Must be joined later with `join()`.\n */\n fork() {\n this.stack.push({ chunks: this.chunks, buf: this.buf });\n this.chunks = [];\n this.buf = [];\n return this;\n }\n /**\n * Join the last fork. Write its length and bytes, then\n * return to the previous state.\n */\n join() {\n // get chunk of fork\n let chunk = this.finish();\n // restore previous state\n let prev = this.stack.pop();\n if (!prev)\n throw new Error(\"invalid state, fork stack empty\");\n this.chunks = prev.chunks;\n this.buf = prev.buf;\n // write length of chunk as varint\n this.uint32(chunk.byteLength);\n return this.raw(chunk);\n }\n /**\n * Writes a tag (field number and wire type).\n *\n * Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.\n *\n * Generated code should compute the tag ahead of time and call `uint32()`.\n */\n tag(fieldNo, type) {\n return this.uint32(((fieldNo << 3) | type) >>> 0);\n }\n /**\n * Write a chunk of raw bytes.\n */\n raw(chunk) {\n if (this.buf.length) {\n this.chunks.push(new Uint8Array(this.buf));\n this.buf = [];\n }\n this.chunks.push(chunk);\n return this;\n }\n /**\n * Write a `uint32` value, an unsigned 32 bit varint.\n */\n uint32(value) {\n assertUInt32(value);\n // write value as varint 32, inlined for speed\n while (value > 0x7f) {\n this.buf.push((value & 0x7f) | 0x80);\n value = value >>> 7;\n }\n this.buf.push(value);\n return this;\n }\n /**\n * Write a `int32` value, a signed 32 bit varint.\n */\n int32(value) {\n assertInt32(value);\n varint32write(value, this.buf);\n return this;\n }\n /**\n * Write a `bool` value, a variant.\n */\n bool(value) {\n this.buf.push(value ? 1 : 0);\n return this;\n }\n /**\n * Write a `bytes` value, length-delimited arbitrary data.\n */\n bytes(value) {\n this.uint32(value.byteLength); // write length of chunk as varint\n return this.raw(value);\n }\n /**\n * Write a `string` value, length-delimited data converted to UTF-8 text.\n */\n string(value) {\n let chunk = this.textEncoder.encode(value);\n this.uint32(chunk.byteLength); // write length of chunk as varint\n return this.raw(chunk);\n }\n /**\n * Write a `float` value, 32-bit floating point number.\n */\n float(value) {\n assertFloat32(value);\n let chunk = new Uint8Array(4);\n new DataView(chunk.buffer).setFloat32(0, value, true);\n return this.raw(chunk);\n }\n /**\n * Write a `double` value, a 64-bit floating point number.\n */\n double(value) {\n let chunk = new Uint8Array(8);\n new DataView(chunk.buffer).setFloat64(0, value, true);\n return this.raw(chunk);\n }\n /**\n * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.\n */\n fixed32(value) {\n assertUInt32(value);\n let chunk = new Uint8Array(4);\n new DataView(chunk.buffer).setUint32(0, value, true);\n return this.raw(chunk);\n }\n /**\n * Write a `sfixed32` value, a signed, fixed-length 32-bit integer.\n */\n sfixed32(value) {\n assertInt32(value);\n let chunk = new Uint8Array(4);\n new DataView(chunk.buffer).setInt32(0, value, true);\n return this.raw(chunk);\n }\n /**\n * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.\n */\n sint32(value) {\n assertInt32(value);\n // zigzag encode\n value = ((value << 1) ^ (value >> 31)) >>> 0;\n varint32write(value, this.buf);\n return this;\n }\n /**\n * Write a `fixed64` value, a signed, fixed-length 64-bit integer.\n */\n sfixed64(value) {\n let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.enc(value);\n view.setInt32(0, tc.lo, true);\n view.setInt32(4, tc.hi, true);\n return this.raw(chunk);\n }\n /**\n * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.\n */\n fixed64(value) {\n let chunk = new Uint8Array(8), view = new DataView(chunk.buffer), tc = protoInt64.uEnc(value);\n view.setInt32(0, tc.lo, true);\n view.setInt32(4, tc.hi, true);\n return this.raw(chunk);\n }\n /**\n * Write a `int64` value, a signed 64-bit varint.\n */\n int64(value) {\n let tc = protoInt64.enc(value);\n varint64write(tc.lo, tc.hi, this.buf);\n return this;\n }\n /**\n * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.\n */\n sint64(value) {\n let tc = protoInt64.enc(value), \n // zigzag encode\n sign = tc.hi >> 31, lo = (tc.lo << 1) ^ sign, hi = ((tc.hi << 1) | (tc.lo >>> 31)) ^ sign;\n varint64write(lo, hi, this.buf);\n return this;\n }\n /**\n * Write a `uint64` value, an unsigned 64-bit varint.\n */\n uint64(value) {\n let tc = protoInt64.uEnc(value);\n varint64write(tc.lo, tc.hi, this.buf);\n return this;\n }\n}\nexport class BinaryReader {\n constructor(buf, textDecoder) {\n this.varint64 = varint64read; // dirty cast for `this`\n /**\n * Read a `uint32` field, an unsigned 32 bit varint.\n */\n this.uint32 = varint32read; // dirty cast for `this` and access to protected `buf`\n this.buf = buf;\n this.len = buf.length;\n this.pos = 0;\n this.view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength);\n this.textDecoder = textDecoder !== null && textDecoder !== void 0 ? textDecoder : new TextDecoder();\n }\n /**\n * Reads a tag - field number and wire type.\n */\n tag() {\n let tag = this.uint32(), fieldNo = tag >>> 3, wireType = tag & 7;\n if (fieldNo <= 0 || wireType < 0 || wireType > 5)\n throw new Error(\"illegal tag: field no \" + fieldNo + \" wire type \" + wireType);\n return [fieldNo, wireType];\n }\n /**\n * Skip one element on the wire and return the skipped data.\n * Supports WireType.StartGroup since v2.0.0-alpha.23.\n */\n skip(wireType) {\n let start = this.pos;\n switch (wireType) {\n case WireType.Varint:\n while (this.buf[this.pos++] & 0x80) {\n // ignore\n }\n break;\n // eslint-disable-next-line\n // @ts-ignore TS7029: Fallthrough case in switch\n case WireType.Bit64:\n this.pos += 4;\n // eslint-disable-next-line\n // @ts-ignore TS7029: Fallthrough case in switch\n case WireType.Bit32:\n this.pos += 4;\n break;\n case WireType.LengthDelimited:\n let len = this.uint32();\n this.pos += len;\n break;\n case WireType.StartGroup:\n // From descriptor.proto: Group type is deprecated, not supported in proto3.\n // But we must still be able to parse and treat as unknown.\n let t;\n while ((t = this.tag()[1]) !== WireType.EndGroup) {\n this.skip(t);\n }\n break;\n default:\n throw new Error(\"cant skip wire type \" + wireType);\n }\n this.assertBounds();\n return this.buf.subarray(start, this.pos);\n }\n /**\n * Throws error if position in byte array is out of range.\n */\n assertBounds() {\n if (this.pos > this.len)\n throw new RangeError(\"premature EOF\");\n }\n /**\n * Read a `int32` field, a signed 32 bit varint.\n */\n int32() {\n return this.uint32() | 0;\n }\n /**\n * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.\n */\n sint32() {\n let zze = this.uint32();\n // decode zigzag\n return (zze >>> 1) ^ -(zze & 1);\n }\n /**\n * Read a `int64` field, a signed 64-bit varint.\n */\n int64() {\n return protoInt64.dec(...this.varint64());\n }\n /**\n * Read a `uint64` field, an unsigned 64-bit varint.\n */\n uint64() {\n return protoInt64.uDec(...this.varint64());\n }\n /**\n * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.\n */\n sint64() {\n let [lo, hi] = this.varint64();\n // decode zig zag\n let s = -(lo & 1);\n lo = ((lo >>> 1) | ((hi & 1) << 31)) ^ s;\n hi = (hi >>> 1) ^ s;\n return protoInt64.dec(lo, hi);\n }\n /**\n * Read a `bool` field, a variant.\n */\n bool() {\n let [lo, hi] = this.varint64();\n return lo !== 0 || hi !== 0;\n }\n /**\n * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.\n */\n fixed32() {\n return this.view.getUint32((this.pos += 4) - 4, true);\n }\n /**\n * Read a `sfixed32` field, a signed, fixed-length 32-bit integer.\n */\n sfixed32() {\n return this.view.getInt32((this.pos += 4) - 4, true);\n }\n /**\n * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.\n */\n fixed64() {\n return protoInt64.uDec(this.sfixed32(), this.sfixed32());\n }\n /**\n * Read a `fixed64` field, a signed, fixed-length 64-bit integer.\n */\n sfixed64() {\n return protoInt64.dec(this.sfixed32(), this.sfixed32());\n }\n /**\n * Read a `float` field, 32-bit floating point number.\n */\n float() {\n return this.view.getFloat32((this.pos += 4) - 4, true);\n }\n /**\n * Read a `double` field, a 64-bit floating point number.\n */\n double() {\n return this.view.getFloat64((this.pos += 8) - 8, true);\n }\n /**\n * Read a `bytes` field, length-delimited arbitrary data.\n */\n bytes() {\n let len = this.uint32(), start = this.pos;\n this.pos += len;\n this.assertBounds();\n return this.buf.subarray(start, start + len);\n }\n /**\n * Read a `string` field, length-delimited data converted to UTF-8 text.\n */\n string() {\n return this.textDecoder.decode(this.bytes());\n }\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { Message } from \"../message.js\";\nimport { ScalarType } from \"../field.js\";\n/**\n * Wrap a primitive message field value in its corresponding wrapper\n * message. This function is idempotent.\n */\nexport function wrapField(type, value) {\n if (value instanceof Message || !type.fieldWrapper) {\n return value;\n }\n return type.fieldWrapper.wrapField(value);\n}\n/**\n * If the given field uses one of the well-known wrapper types, return\n * the primitive type it wraps.\n */\nexport function getUnwrappedFieldType(field) {\n if (field.fieldKind !== \"message\") {\n return undefined;\n }\n if (field.repeated) {\n return undefined;\n }\n if (field.oneof != undefined) {\n return undefined;\n }\n return wktWrapperToScalarType[field.message.typeName];\n}\nconst wktWrapperToScalarType = {\n \"google.protobuf.DoubleValue\": ScalarType.DOUBLE,\n \"google.protobuf.FloatValue\": ScalarType.FLOAT,\n \"google.protobuf.Int64Value\": ScalarType.INT64,\n \"google.protobuf.UInt64Value\": ScalarType.UINT64,\n \"google.protobuf.Int32Value\": ScalarType.INT32,\n \"google.protobuf.UInt32Value\": ScalarType.UINT32,\n \"google.protobuf.BoolValue\": ScalarType.BOOL,\n \"google.protobuf.StringValue\": ScalarType.STRING,\n \"google.protobuf.BytesValue\": ScalarType.BYTES,\n};\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { ScalarType } from \"../field.js\";\nimport { WireType } from \"../binary-encoding.js\";\nimport { protoInt64 } from \"../proto-int64.js\";\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * Returns true if both scalar values are equal.\n */\nexport function scalarEquals(type, a, b) {\n if (a === b) {\n // This correctly matches equal values except BYTES and (possibly) 64-bit integers.\n return true;\n }\n // Special case BYTES - we need to compare each byte individually\n if (type == ScalarType.BYTES) {\n if (!(a instanceof Uint8Array) || !(b instanceof Uint8Array)) {\n return false;\n }\n if (a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n }\n // Special case 64-bit integers - we support number, string and bigint representation.\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (type) {\n case ScalarType.UINT64:\n case ScalarType.FIXED64:\n case ScalarType.INT64:\n case ScalarType.SFIXED64:\n case ScalarType.SINT64:\n // Loose comparison will match between 0n, 0 and \"0\".\n return a == b;\n }\n // Anything that hasn't been caught by strict comparison or special cased\n // BYTES and 64-bit integers is not equal.\n return false;\n}\n/**\n * Returns the default value for the given scalar type, following\n * proto3 semantics.\n */\nexport function scalarDefaultValue(type) {\n switch (type) {\n case ScalarType.BOOL:\n return false;\n case ScalarType.UINT64:\n case ScalarType.FIXED64:\n case ScalarType.INT64:\n case ScalarType.SFIXED64:\n case ScalarType.SINT64:\n return protoInt64.zero;\n case ScalarType.DOUBLE:\n case ScalarType.FLOAT:\n return 0.0;\n case ScalarType.BYTES:\n return new Uint8Array(0);\n case ScalarType.STRING:\n return \"\";\n default:\n // Handles INT32, UINT32, SINT32, FIXED32, SFIXED32.\n // We do not use individual cases to save a few bytes code size.\n return 0;\n }\n}\n/**\n * Get information for writing a scalar value.\n *\n * Returns tuple:\n * [0]: appropriate WireType\n * [1]: name of the appropriate method of IBinaryWriter\n * [2]: whether the given value is a default value for proto3 semantics\n *\n * If argument `value` is omitted, [2] is always false.\n */\nexport function scalarTypeInfo(type, value) {\n const isUndefined = value === undefined;\n let wireType = WireType.Varint;\n let isIntrinsicDefault = value === 0;\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- INT32, UINT32, SINT32 are covered by the defaults\n switch (type) {\n case ScalarType.STRING:\n isIntrinsicDefault = isUndefined || !value.length;\n wireType = WireType.LengthDelimited;\n break;\n case ScalarType.BOOL:\n isIntrinsicDefault = value === false;\n break;\n case ScalarType.DOUBLE:\n wireType = WireType.Bit64;\n break;\n case ScalarType.FLOAT:\n wireType = WireType.Bit32;\n break;\n case ScalarType.INT64:\n isIntrinsicDefault = isUndefined || value == 0;\n break;\n case ScalarType.UINT64:\n isIntrinsicDefault = isUndefined || value == 0;\n break;\n case ScalarType.FIXED64:\n isIntrinsicDefault = isUndefined || value == 0;\n wireType = WireType.Bit64;\n break;\n case ScalarType.BYTES:\n isIntrinsicDefault = isUndefined || !value.byteLength;\n wireType = WireType.LengthDelimited;\n break;\n case ScalarType.FIXED32:\n wireType = WireType.Bit32;\n break;\n case ScalarType.SFIXED32:\n wireType = WireType.Bit32;\n break;\n case ScalarType.SFIXED64:\n isIntrinsicDefault = isUndefined || value == 0;\n wireType = WireType.Bit64;\n break;\n case ScalarType.SINT64:\n isIntrinsicDefault = isUndefined || value == 0;\n break;\n }\n const method = ScalarType[type].toLowerCase();\n return [wireType, method, isUndefined || isIntrinsicDefault];\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { BinaryReader, BinaryWriter, WireType } from \"../binary-encoding.js\";\nimport { Message } from \"../message.js\";\nimport { ScalarType } from \"../field.js\";\nimport { wrapField } from \"./field-wrapper.js\";\nimport { scalarDefaultValue, scalarTypeInfo } from \"./scalars.js\";\nimport { assert } from \"./assert.js\";\n/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unnecessary-condition, no-case-declarations, prefer-const */\nconst unknownFieldsSymbol = Symbol(\"@bufbuild/protobuf/unknown-fields\");\n// Default options for parsing binary data.\nconst readDefaults = {\n readUnknownFields: true,\n readerFactory: (bytes) => new BinaryReader(bytes),\n};\n// Default options for serializing binary data.\nconst writeDefaults = {\n writeUnknownFields: true,\n writerFactory: () => new BinaryWriter(),\n};\nfunction makeReadOptions(options) {\n return options ? Object.assign(Object.assign({}, readDefaults), options) : readDefaults;\n}\nfunction makeWriteOptions(options) {\n return options ? Object.assign(Object.assign({}, writeDefaults), options) : writeDefaults;\n}\nexport function makeBinaryFormatCommon() {\n return {\n makeReadOptions,\n makeWriteOptions,\n listUnknownFields(message) {\n var _a;\n return (_a = message[unknownFieldsSymbol]) !== null && _a !== void 0 ? _a : [];\n },\n discardUnknownFields(message) {\n delete message[unknownFieldsSymbol];\n },\n writeUnknownFields(message, writer) {\n const m = message;\n const c = m[unknownFieldsSymbol];\n if (c) {\n for (const f of c) {\n writer.tag(f.no, f.wireType).raw(f.data);\n }\n }\n },\n onUnknownField(message, no, wireType, data) {\n const m = message;\n if (!Array.isArray(m[unknownFieldsSymbol])) {\n m[unknownFieldsSymbol] = [];\n }\n m[unknownFieldsSymbol].push({ no, wireType, data });\n },\n readMessage(message, reader, length, options) {\n const type = message.getType();\n const end = length === undefined ? reader.len : reader.pos + length;\n while (reader.pos < end) {\n const [fieldNo, wireType] = reader.tag(), field = type.fields.find(fieldNo);\n if (!field) {\n const data = reader.skip(wireType);\n if (options.readUnknownFields) {\n this.onUnknownField(message, fieldNo, wireType, data);\n }\n continue;\n }\n let target = message, repeated = field.repeated, localName = field.localName;\n if (field.oneof) {\n target = target[field.oneof.localName];\n if (target.case != localName) {\n delete target.value;\n }\n target.case = localName;\n localName = \"value\";\n }\n switch (field.kind) {\n case \"scalar\":\n case \"enum\":\n const scalarType = field.kind == \"enum\" ? ScalarType.INT32 : field.T;\n if (repeated) {\n let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values\n if (wireType == WireType.LengthDelimited &&\n scalarType != ScalarType.STRING &&\n scalarType != ScalarType.BYTES) {\n let e = reader.uint32() + reader.pos;\n while (reader.pos < e) {\n arr.push(readScalar(reader, scalarType));\n }\n }\n else {\n arr.push(readScalar(reader, scalarType));\n }\n }\n else {\n target[localName] = readScalar(reader, scalarType);\n }\n break;\n case \"message\":\n const messageType = field.T;\n if (repeated) {\n // safe to assume presence of array, oneof cannot contain repeated values\n target[localName].push(readMessageField(reader, new messageType(), options));\n }\n else {\n if (target[localName] instanceof Message) {\n readMessageField(reader, target[localName], options);\n }\n else {\n target[localName] = readMessageField(reader, new messageType(), options);\n if (messageType.fieldWrapper &&\n !field.oneof &&\n !field.repeated) {\n target[localName] = messageType.fieldWrapper.unwrapField(target[localName]);\n }\n }\n }\n break;\n case \"map\":\n let [mapKey, mapVal] = readMapEntry(field, reader, options);\n // safe to assume presence of map object, oneof cannot contain repeated values\n target[localName][mapKey] = mapVal;\n break;\n }\n }\n },\n };\n}\n// Read a message, avoiding MessageType.fromBinary() to re-use the\n// BinaryReadOptions and the IBinaryReader.\nfunction readMessageField(reader, message, options) {\n const format = message.getType().runtime.bin;\n format.readMessage(message, reader, reader.uint32(), options);\n return message;\n}\n// Read a map field, expecting key field = 1, value field = 2\nfunction readMapEntry(field, reader, options) {\n const length = reader.uint32(), end = reader.pos + length;\n let key, val;\n while (reader.pos < end) {\n let [fieldNo] = reader.tag();\n switch (fieldNo) {\n case 1:\n key = readScalar(reader, field.K);\n break;\n case 2:\n switch (field.V.kind) {\n case \"scalar\":\n val = readScalar(reader, field.V.T);\n break;\n case \"enum\":\n val = reader.int32();\n break;\n case \"message\":\n val = readMessageField(reader, new field.V.T(), options);\n break;\n }\n break;\n }\n }\n if (key === undefined) {\n let keyRaw = scalarDefaultValue(field.K);\n key =\n field.K == ScalarType.BOOL\n ? keyRaw.toString()\n : keyRaw;\n }\n if (typeof key != \"string\" && typeof key != \"number\") {\n key = key.toString();\n }\n if (val === undefined) {\n switch (field.V.kind) {\n case \"scalar\":\n val = scalarDefaultValue(field.V.T);\n break;\n case \"enum\":\n val = 0;\n break;\n case \"message\":\n val = new field.V.T();\n break;\n }\n }\n return [key, val];\n}\n// Does not use scalarTypeInfo() for better performance.\nfunction readScalar(reader, type) {\n switch (type) {\n case ScalarType.STRING:\n return reader.string();\n case ScalarType.BOOL:\n return reader.bool();\n case ScalarType.DOUBLE:\n return reader.double();\n case ScalarType.FLOAT:\n return reader.float();\n case ScalarType.INT32:\n return reader.int32();\n case ScalarType.INT64:\n return reader.int64();\n case ScalarType.UINT64:\n return reader.uint64();\n case ScalarType.FIXED64:\n return reader.fixed64();\n case ScalarType.BYTES:\n return reader.bytes();\n case ScalarType.FIXED32:\n return reader.fixed32();\n case ScalarType.SFIXED32:\n return reader.sfixed32();\n case ScalarType.SFIXED64:\n return reader.sfixed64();\n case ScalarType.SINT64:\n return reader.sint64();\n case ScalarType.UINT32:\n return reader.uint32();\n case ScalarType.SINT32:\n return reader.sint32();\n }\n}\nexport function writeMapEntry(writer, options, field, key, value) {\n writer.tag(field.no, WireType.LengthDelimited);\n writer.fork();\n // javascript only allows number or string for object properties\n // we convert from our representation to the protobuf type\n let keyValue = key;\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- we deliberately handle just the special cases for map keys\n switch (field.K) {\n case ScalarType.INT32:\n case ScalarType.FIXED32:\n case ScalarType.UINT32:\n case ScalarType.SFIXED32:\n case ScalarType.SINT32:\n keyValue = Number.parseInt(key);\n break;\n case ScalarType.BOOL:\n assert(key == \"true\" || key == \"false\");\n keyValue = key == \"true\";\n break;\n }\n // write key, expecting key field number = 1\n writeScalar(writer, field.K, 1, keyValue, true);\n // write value, expecting value field number = 2\n switch (field.V.kind) {\n case \"scalar\":\n writeScalar(writer, field.V.T, 2, value, true);\n break;\n case \"enum\":\n writeScalar(writer, ScalarType.INT32, 2, value, true);\n break;\n case \"message\":\n writeMessageField(writer, options, field.V.T, 2, value);\n break;\n }\n writer.join();\n}\nexport function writeMessageField(writer, options, type, fieldNo, value) {\n if (value !== undefined) {\n const message = wrapField(type, value);\n writer\n .tag(fieldNo, WireType.LengthDelimited)\n .bytes(message.toBinary(options));\n }\n}\nexport function writeScalar(writer, type, fieldNo, value, emitIntrinsicDefault) {\n let [wireType, method, isIntrinsicDefault] = scalarTypeInfo(type, value);\n if (!isIntrinsicDefault || emitIntrinsicDefault) {\n writer.tag(fieldNo, wireType)[method](value);\n }\n}\nexport function writePacked(writer, type, fieldNo, value) {\n if (!value.length) {\n return;\n }\n writer.tag(fieldNo, WireType.LengthDelimited).fork();\n let [, method] = scalarTypeInfo(type);\n for (let i = 0; i < value.length; i++) {\n writer[method](value[i]);\n }\n writer.join();\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { Message } from \"../message.js\";\nimport { ScalarType } from \"../field.js\";\nimport { assert, assertFloat32, assertInt32, assertUInt32 } from \"./assert.js\";\nimport { protoInt64 } from \"../proto-int64.js\";\nimport { protoBase64 } from \"../proto-base64.js\";\n/* eslint-disable no-case-declarations, @typescript-eslint/restrict-plus-operands,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */\n// Default options for parsing JSON.\nconst jsonReadDefaults = {\n ignoreUnknownFields: false,\n};\n// Default options for serializing to JSON.\nconst jsonWriteDefaults = {\n emitDefaultValues: false,\n enumAsInteger: false,\n useProtoFieldName: false,\n prettySpaces: 0,\n};\nfunction makeReadOptions(options) {\n return options ? Object.assign(Object.assign({}, jsonReadDefaults), options) : jsonReadDefaults;\n}\nfunction makeWriteOptions(options) {\n return options ? Object.assign(Object.assign({}, jsonWriteDefaults), options) : jsonWriteDefaults;\n}\nexport function makeJsonFormatCommon(makeWriteField) {\n const writeField = makeWriteField(writeEnum, writeScalar);\n return {\n makeReadOptions,\n makeWriteOptions,\n readMessage(type, json, options, message) {\n if (json == null || Array.isArray(json) || typeof json != \"object\") {\n throw new Error(`cannot decode message ${type.typeName} from JSON: ${this.debug(json)}`);\n }\n message = message !== null && message !== void 0 ? message : new type();\n const oneofSeen = {};\n for (const [jsonKey, jsonValue] of Object.entries(json)) {\n const field = type.fields.findJsonName(jsonKey);\n if (!field) {\n if (!options.ignoreUnknownFields) {\n throw new Error(`cannot decode message ${type.typeName} from JSON: key \"${jsonKey}\" is unknown`);\n }\n continue;\n }\n let localName = field.localName;\n let target = message;\n if (field.oneof) {\n if (jsonValue === null && field.kind == \"scalar\") {\n // see conformance test Required.Proto3.JsonInput.OneofFieldNull{First,Second}\n continue;\n }\n const seen = oneofSeen[field.oneof.localName];\n if (seen) {\n throw new Error(`cannot decode message ${type.typeName} from JSON: multiple keys for oneof \"${field.oneof.name}\" present: \"${seen}\", \"${jsonKey}\"`);\n }\n oneofSeen[field.oneof.localName] = jsonKey;\n target = target[field.oneof.localName] = { case: localName };\n localName = \"value\";\n }\n if (field.repeated) {\n if (jsonValue === null) {\n continue;\n }\n if (!Array.isArray(jsonValue)) {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`);\n }\n const targetArray = target[localName];\n for (const jsonItem of jsonValue) {\n if (jsonItem === null) {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonItem)}`);\n }\n let val;\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- \"map\" is invalid for repeated fields\n switch (field.kind) {\n case \"message\":\n val = field.T.fromJson(jsonItem, options);\n break;\n case \"enum\":\n val = readEnum(field.T, jsonItem, options.ignoreUnknownFields);\n if (val === undefined)\n continue;\n break;\n case \"scalar\":\n try {\n val = readScalar(field.T, jsonItem);\n }\n catch (e) {\n let m = `cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonItem)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n break;\n }\n targetArray.push(val);\n }\n }\n else if (field.kind == \"map\") {\n if (jsonValue === null) {\n continue;\n }\n if (Array.isArray(jsonValue) || typeof jsonValue != \"object\") {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`);\n }\n const targetMap = target[localName];\n for (const [jsonMapKey, jsonMapValue] of Object.entries(jsonValue)) {\n if (jsonMapValue === null) {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: map value null`);\n }\n let val;\n switch (field.V.kind) {\n case \"message\":\n val = field.V.T.fromJson(jsonMapValue, options);\n break;\n case \"enum\":\n val = readEnum(field.V.T, jsonMapValue, options.ignoreUnknownFields);\n if (val === undefined)\n continue;\n break;\n case \"scalar\":\n try {\n val = readScalar(field.V.T, jsonMapValue);\n }\n catch (e) {\n let m = `cannot decode map value for field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n break;\n }\n try {\n targetMap[readScalar(field.K, field.K == ScalarType.BOOL\n ? jsonMapKey == \"true\"\n ? true\n : jsonMapKey == \"false\"\n ? false\n : jsonMapKey\n : jsonMapKey).toString()] = val;\n }\n catch (e) {\n let m = `cannot decode map key for field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n }\n }\n else {\n switch (field.kind) {\n case \"message\":\n const messageType = field.T;\n if (jsonValue === null &&\n messageType.typeName != \"google.protobuf.Value\") {\n if (field.oneof) {\n throw new Error(`cannot decode field ${type.typeName}.${field.name} from JSON: null is invalid for oneof field \"${jsonKey}\"`);\n }\n continue;\n }\n if (target[localName] instanceof Message) {\n target[localName].fromJson(jsonValue, options);\n }\n else {\n target[localName] = messageType.fromJson(jsonValue, options);\n if (messageType.fieldWrapper && !field.oneof) {\n target[localName] = messageType.fieldWrapper.unwrapField(target[localName]);\n }\n }\n break;\n case \"enum\":\n const enumValue = readEnum(field.T, jsonValue, options.ignoreUnknownFields);\n if (enumValue !== undefined) {\n target[localName] = enumValue;\n }\n break;\n case \"scalar\":\n try {\n target[localName] = readScalar(field.T, jsonValue);\n }\n catch (e) {\n let m = `cannot decode field ${type.typeName}.${field.name} from JSON: ${this.debug(jsonValue)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n break;\n }\n }\n }\n return message;\n },\n writeMessage(message, options) {\n const type = message.getType();\n const json = {};\n let field;\n try {\n for (const member of type.fields.byMember()) {\n let jsonValue;\n if (member.kind == \"oneof\") {\n const oneof = message[member.localName];\n if (oneof.value === undefined) {\n continue;\n }\n field = member.findField(oneof.case);\n if (!field) {\n throw \"oneof case not found: \" + oneof.case;\n }\n jsonValue = writeField(field, oneof.value, options);\n }\n else {\n field = member;\n jsonValue = writeField(field, message[field.localName], options);\n }\n if (jsonValue !== undefined) {\n json[options.useProtoFieldName ? field.name : field.jsonName] =\n jsonValue;\n }\n }\n }\n catch (e) {\n const m = field\n ? `cannot encode field ${type.typeName}.${field.name} to JSON`\n : `cannot encode message ${type.typeName} to JSON`;\n const r = e instanceof Error ? e.message : String(e);\n throw new Error(m + (r.length > 0 ? `: ${r}` : \"\"));\n }\n return json;\n },\n readScalar,\n writeScalar,\n debug: debugJsonValue,\n };\n}\nfunction debugJsonValue(json) {\n if (json === null) {\n return \"null\";\n }\n switch (typeof json) {\n case \"object\":\n return Array.isArray(json) ? \"array\" : \"object\";\n case \"string\":\n return json.length > 100 ? \"string\" : `\"${json.split('\"').join('\\\\\"')}\"`;\n default:\n return json.toString();\n }\n}\n// May throw an error. If the error message is non-blank, it should be shown.\n// It is up to the caller to provide context.\nfunction readScalar(type, json) {\n // every valid case in the switch below returns, and every fall\n // through is regarded as a failure.\n switch (type) {\n // float, double: JSON value will be a number or one of the special string values \"NaN\", \"Infinity\", and \"-Infinity\".\n // Either numbers or strings are accepted. Exponent notation is also accepted.\n case ScalarType.DOUBLE:\n case ScalarType.FLOAT:\n if (json === null)\n return 0.0;\n if (json === \"NaN\")\n return Number.NaN;\n if (json === \"Infinity\")\n return Number.POSITIVE_INFINITY;\n if (json === \"-Infinity\")\n return Number.NEGATIVE_INFINITY;\n if (json === \"\") {\n // empty string is not a number\n break;\n }\n if (typeof json == \"string\" && json.trim().length !== json.length) {\n // extra whitespace\n break;\n }\n if (typeof json != \"string\" && typeof json != \"number\") {\n break;\n }\n const float = Number(json);\n if (Number.isNaN(float)) {\n // not a number\n break;\n }\n if (!Number.isFinite(float)) {\n // infinity and -infinity are handled by string representation above, so this is an error\n break;\n }\n if (type == ScalarType.FLOAT)\n assertFloat32(float);\n return float;\n // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.\n case ScalarType.INT32:\n case ScalarType.FIXED32:\n case ScalarType.SFIXED32:\n case ScalarType.SINT32:\n case ScalarType.UINT32:\n if (json === null)\n return 0;\n let int32;\n if (typeof json == \"number\")\n int32 = json;\n else if (typeof json == \"string\" && json.length > 0) {\n if (json.trim().length === json.length)\n int32 = Number(json);\n }\n if (int32 === undefined)\n break;\n if (type == ScalarType.UINT32)\n assertUInt32(int32);\n else\n assertInt32(int32);\n return int32;\n // int64, fixed64, uint64: JSON value will be a decimal string. Either numbers or strings are accepted.\n case ScalarType.INT64:\n case ScalarType.SFIXED64:\n case ScalarType.SINT64:\n if (json === null)\n return protoInt64.zero;\n if (typeof json != \"number\" && typeof json != \"string\")\n break;\n return protoInt64.parse(json);\n case ScalarType.FIXED64:\n case ScalarType.UINT64:\n if (json === null)\n return protoInt64.zero;\n if (typeof json != \"number\" && typeof json != \"string\")\n break;\n return protoInt64.uParse(json);\n // bool:\n case ScalarType.BOOL:\n if (json === null)\n return false;\n if (typeof json !== \"boolean\")\n break;\n return json;\n // string:\n case ScalarType.STRING:\n if (json === null)\n return \"\";\n if (typeof json !== \"string\") {\n break;\n }\n // A string must always contain UTF-8 encoded or 7-bit ASCII.\n // We validate with encodeURIComponent, which appears to be the fastest widely available option.\n try {\n encodeURIComponent(json);\n }\n catch (e) {\n throw new Error(\"invalid UTF8\");\n }\n return json;\n // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.\n // Either standard or URL-safe base64 encoding with/without paddings are accepted.\n case ScalarType.BYTES:\n if (json === null || json === \"\")\n return new Uint8Array(0);\n if (typeof json !== \"string\")\n break;\n return protoBase64.dec(json);\n }\n throw new Error();\n}\nfunction readEnum(type, json, ignoreUnknownFields) {\n if (json === null) {\n // proto3 requires 0 to be default value for all enums\n return 0;\n }\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (typeof json) {\n case \"number\":\n if (Number.isInteger(json)) {\n return json;\n }\n break;\n case \"string\":\n const value = type.findName(json);\n if (value || ignoreUnknownFields) {\n return value === null || value === void 0 ? void 0 : value.no;\n }\n break;\n }\n throw new Error(`cannot decode enum ${type.typeName} from JSON: ${debugJsonValue(json)}`);\n}\nfunction writeEnum(type, value, emitIntrinsicDefault, enumAsInteger) {\n var _a;\n if (value === undefined) {\n return value;\n }\n if (value === 0 && !emitIntrinsicDefault) {\n // proto3 requires 0 to be default value for all enums\n return undefined;\n }\n if (enumAsInteger) {\n return value;\n }\n if (type.typeName == \"google.protobuf.NullValue\") {\n return null;\n }\n const val = type.findNumber(value);\n return (_a = val === null || val === void 0 ? void 0 : val.name) !== null && _a !== void 0 ? _a : value; // if we don't know the enum value, just return the number\n}\nfunction writeScalar(type, value, emitIntrinsicDefault) {\n if (value === undefined) {\n return undefined;\n }\n switch (type) {\n // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.\n case ScalarType.INT32:\n case ScalarType.SFIXED32:\n case ScalarType.SINT32:\n case ScalarType.FIXED32:\n case ScalarType.UINT32:\n assert(typeof value == \"number\");\n return value != 0 || emitIntrinsicDefault ? value : undefined;\n // float, double: JSON value will be a number or one of the special string values \"NaN\", \"Infinity\", and \"-Infinity\".\n // Either numbers or strings are accepted. Exponent notation is also accepted.\n case ScalarType.FLOAT:\n // assertFloat32(value);\n case ScalarType.DOUBLE: // eslint-disable-line no-fallthrough\n assert(typeof value == \"number\");\n if (Number.isNaN(value))\n return \"NaN\";\n if (value === Number.POSITIVE_INFINITY)\n return \"Infinity\";\n if (value === Number.NEGATIVE_INFINITY)\n return \"-Infinity\";\n return value !== 0 || emitIntrinsicDefault ? value : undefined;\n // string:\n case ScalarType.STRING:\n assert(typeof value == \"string\");\n return value.length > 0 || emitIntrinsicDefault ? value : undefined;\n // bool:\n case ScalarType.BOOL:\n assert(typeof value == \"boolean\");\n return value || emitIntrinsicDefault ? value : undefined;\n // JSON value will be a decimal string. Either numbers or strings are accepted.\n case ScalarType.UINT64:\n case ScalarType.FIXED64:\n case ScalarType.INT64:\n case ScalarType.SFIXED64:\n case ScalarType.SINT64:\n assert(typeof value == \"bigint\" ||\n typeof value == \"string\" ||\n typeof value == \"number\");\n // We use implicit conversion with `value != 0` to catch both 0n and \"0\"\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n return emitIntrinsicDefault || value != 0\n ? value.toString(10)\n : undefined;\n // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.\n // Either standard or URL-safe base64 encoding with/without paddings are accepted.\n case ScalarType.BYTES:\n assert(value instanceof Uint8Array);\n return emitIntrinsicDefault || value.byteLength > 0\n ? protoBase64.enc(value)\n : undefined;\n }\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { setEnumType } from \"./enum.js\";\nimport { Message } from \"../message.js\";\nimport { ScalarType } from \"../field.js\";\nimport { scalarEquals } from \"./scalars.js\";\n/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-argument,no-case-declarations */\nexport function makeUtilCommon() {\n return {\n setEnumType,\n initPartial(source, target) {\n if (source === undefined) {\n return;\n }\n const type = target.getType();\n for (const member of type.fields.byMember()) {\n const localName = member.localName, t = target, s = source;\n if (s[localName] === undefined) {\n continue;\n }\n switch (member.kind) {\n case \"oneof\":\n const sk = s[localName].case;\n if (sk === undefined) {\n continue;\n }\n const sourceField = member.findField(sk);\n let val = s[localName].value;\n if (sourceField &&\n sourceField.kind == \"message\" &&\n !(val instanceof sourceField.T)) {\n val = new sourceField.T(val);\n }\n t[localName] = { case: sk, value: val };\n break;\n case \"scalar\":\n case \"enum\":\n t[localName] = s[localName];\n break;\n case \"map\":\n switch (member.V.kind) {\n case \"scalar\":\n case \"enum\":\n Object.assign(t[localName], s[localName]);\n break;\n case \"message\":\n const messageType = member.V.T;\n for (const k of Object.keys(s[localName])) {\n let val = s[localName][k];\n if (!messageType.fieldWrapper) {\n // We only take partial input for messages that are not a wrapper type.\n // For those messages, we recursively normalize the partial input.\n val = new messageType(val);\n }\n t[localName][k] = val;\n }\n break;\n }\n break;\n case \"message\":\n const mt = member.T;\n if (member.repeated) {\n t[localName] = s[localName].map((val) => val instanceof mt ? val : new mt(val));\n }\n else if (s[localName] !== undefined) {\n const val = s[localName];\n if (mt.fieldWrapper) {\n t[localName] = val;\n }\n else {\n t[localName] = val instanceof mt ? val : new mt(val);\n }\n }\n break;\n }\n }\n },\n equals(type, a, b) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n return type.fields.byMember().every((m) => {\n const va = a[m.localName];\n const vb = b[m.localName];\n if (m.repeated) {\n if (va.length !== vb.length) {\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- repeated fields are never \"map\"\n switch (m.kind) {\n case \"message\":\n return va.every((a, i) => m.T.equals(a, vb[i]));\n case \"scalar\":\n return va.every((a, i) => scalarEquals(m.T, a, vb[i]));\n case \"enum\":\n return va.every((a, i) => scalarEquals(ScalarType.INT32, a, vb[i]));\n }\n throw new Error(`repeated cannot contain ${m.kind}`);\n }\n switch (m.kind) {\n case \"message\":\n return m.T.equals(va, vb);\n case \"enum\":\n return scalarEquals(ScalarType.INT32, va, vb);\n case \"scalar\":\n return scalarEquals(m.T, va, vb);\n case \"oneof\":\n if (va.case !== vb.case) {\n return false;\n }\n const s = m.findField(va.case);\n if (s === undefined) {\n return true;\n }\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- oneof fields are never \"map\"\n switch (s.kind) {\n case \"message\":\n return s.T.equals(va.value, vb.value);\n case \"enum\":\n return scalarEquals(ScalarType.INT32, va.value, vb.value);\n case \"scalar\":\n return scalarEquals(s.T, va.value, vb.value);\n }\n throw new Error(`oneof cannot contain ${s.kind}`);\n case \"map\":\n const keys = Object.keys(va).concat(Object.keys(vb));\n switch (m.V.kind) {\n case \"message\":\n const messageType = m.V.T;\n return keys.every((k) => messageType.equals(va[k], vb[k]));\n case \"enum\":\n return keys.every((k) => scalarEquals(ScalarType.INT32, va[k], vb[k]));\n case \"scalar\":\n const scalarType = m.V.T;\n return keys.every((k) => scalarEquals(scalarType, va[k], vb[k]));\n }\n break;\n }\n });\n },\n clone(message) {\n const type = message.getType(), target = new type(), any = target;\n for (const member of type.fields.byMember()) {\n const source = message[member.localName];\n let copy;\n if (member.repeated) {\n copy = source.map((e) => cloneSingularField(member, e));\n }\n else if (member.kind == \"map\") {\n copy = any[member.localName];\n for (const [key, v] of Object.entries(source)) {\n copy[key] = cloneSingularField(member.V, v);\n }\n }\n else if (member.kind == \"oneof\") {\n const f = member.findField(source.case);\n copy = f\n ? { case: source.case, value: cloneSingularField(f, source.value) }\n : { case: undefined };\n }\n else {\n copy = cloneSingularField(member, source);\n }\n any[member.localName] = copy;\n }\n return target;\n },\n };\n}\n// clone a single field value - i.e. the element type of repeated fields, the value type of maps\nfunction cloneSingularField(field, value) {\n if (value === undefined) {\n return value;\n }\n if (value instanceof Message) {\n return value.clone();\n }\n if (value instanceof Uint8Array) {\n const c = new Uint8Array(value.byteLength);\n c.set(value);\n return c;\n }\n return value;\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nexport class InternalFieldList {\n constructor(fields, normalizer) {\n this._fields = fields;\n this._normalizer = normalizer;\n }\n findJsonName(jsonName) {\n if (!this.jsonNames) {\n const t = {};\n for (const f of this.list()) {\n t[f.jsonName] = t[f.name] = f;\n }\n this.jsonNames = t;\n }\n return this.jsonNames[jsonName];\n }\n find(fieldNo) {\n if (!this.numbers) {\n const t = {};\n for (const f of this.list()) {\n t[f.no] = f;\n }\n this.numbers = t;\n }\n return this.numbers[fieldNo];\n }\n list() {\n if (!this.all) {\n this.all = this._normalizer(this._fields);\n }\n return this.all;\n }\n byNumber() {\n if (!this.numbersAsc) {\n this.numbersAsc = this.list()\n .concat()\n .sort((a, b) => a.no - b.no);\n }\n return this.numbersAsc;\n }\n byMember() {\n if (!this.members) {\n this.members = [];\n const a = this.members;\n let o;\n for (const f of this.list()) {\n if (f.oneof) {\n if (f.oneof !== o) {\n o = f.oneof;\n a.push(o);\n }\n }\n else {\n a.push(f);\n }\n }\n }\n return this.members;\n }\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n/**\n * Returns the name of a protobuf element in generated code.\n *\n * Field names - including oneofs - are converted to lowerCamelCase. For\n * messages, enumerations and services, the package name is stripped from\n * the type name. For nested messages and enumerations, the names are joined\n * with an underscore. For methods, the first character is made lowercase.\n */\nexport function localName(desc) {\n switch (desc.kind) {\n case \"field\":\n return localFieldName(desc.name, desc.oneof !== undefined);\n case \"oneof\":\n return localOneofName(desc.name);\n case \"enum\":\n case \"message\":\n case \"service\": {\n const pkg = desc.file.proto.package;\n const offset = pkg === undefined ? 0 : pkg.length + 1;\n const name = desc.typeName.substring(offset).replace(/\\./g, \"_\");\n // For services, we only care about safe identifiers, not safe object properties,\n // but we have shipped v1 with a bug that respected object properties, and we\n // do not want to introduce a breaking change, so we continue to escape for\n // safe object properties.\n // See https://github.com/bufbuild/protobuf-es/pull/391\n return safeObjectProperty(safeIdentifier(name));\n }\n case \"enum_value\": {\n const sharedPrefix = desc.parent.sharedPrefix;\n if (sharedPrefix === undefined) {\n return desc.name;\n }\n const name = desc.name.substring(sharedPrefix.length);\n return safeObjectProperty(name);\n }\n case \"rpc\": {\n let name = desc.name;\n if (name.length == 0) {\n return name;\n }\n name = name[0].toLowerCase() + name.substring(1);\n return safeObjectProperty(name);\n }\n }\n}\n/**\n * Returns the name of a field in generated code.\n */\nexport function localFieldName(protoName, inOneof) {\n const name = protoCamelCase(protoName);\n if (inOneof) {\n // oneof member names are not properties, but values of the `case` property.\n return name;\n }\n return safeObjectProperty(safeMessageProperty(name));\n}\n/**\n * Returns the name of a oneof group in generated code.\n */\nexport function localOneofName(protoName) {\n return localFieldName(protoName, false);\n}\n/**\n * Returns the JSON name for a protobuf field, exactly like protoc does.\n */\nexport const fieldJsonName = protoCamelCase;\n/**\n * Finds a prefix shared by enum values, for example `MY_ENUM_` for\n * `enum MyEnum {MY_ENUM_A=0; MY_ENUM_B=1;}`.\n */\nexport function findEnumSharedPrefix(enumName, valueNames) {\n const prefix = camelToSnakeCase(enumName) + \"_\";\n for (const name of valueNames) {\n if (!name.toLowerCase().startsWith(prefix)) {\n return undefined;\n }\n const shortName = name.substring(prefix.length);\n if (shortName.length == 0) {\n return undefined;\n }\n if (/^\\d/.test(shortName)) {\n // identifiers must not start with numbers\n return undefined;\n }\n }\n return prefix;\n}\n/**\n * Converts lowerCamelCase or UpperCamelCase into lower_snake_case.\n * This is used to find shared prefixes in an enum.\n */\nfunction camelToSnakeCase(camel) {\n return (camel.substring(0, 1) + camel.substring(1).replace(/[A-Z]/g, (c) => \"_\" + c)).toLowerCase();\n}\n/**\n * Converts snake_case to protoCamelCase according to the convention\n * used by protoc to convert a field name to a JSON name.\n */\nfunction protoCamelCase(snakeCase) {\n let capNext = false;\n const b = [];\n for (let i = 0; i < snakeCase.length; i++) {\n let c = snakeCase.charAt(i);\n switch (c) {\n case \"_\":\n capNext = true;\n break;\n case \"0\":\n case \"1\":\n case \"2\":\n case \"3\":\n case \"4\":\n case \"5\":\n case \"6\":\n case \"7\":\n case \"8\":\n case \"9\":\n b.push(c);\n capNext = false;\n break;\n default:\n if (capNext) {\n capNext = false;\n c = c.toUpperCase();\n }\n b.push(c);\n break;\n }\n }\n return b.join(\"\");\n}\n/**\n * Names that cannot be used for identifiers, such as class names,\n * but _can_ be used for object properties.\n */\nconst reservedIdentifiers = new Set([\n // ECMAScript 2015 keywords\n \"break\",\n \"case\",\n \"catch\",\n \"class\",\n \"const\",\n \"continue\",\n \"debugger\",\n \"default\",\n \"delete\",\n \"do\",\n \"else\",\n \"export\",\n \"extends\",\n \"false\",\n \"finally\",\n \"for\",\n \"function\",\n \"if\",\n \"import\",\n \"in\",\n \"instanceof\",\n \"new\",\n \"null\",\n \"return\",\n \"super\",\n \"switch\",\n \"this\",\n \"throw\",\n \"true\",\n \"try\",\n \"typeof\",\n \"var\",\n \"void\",\n \"while\",\n \"with\",\n \"yield\",\n // ECMAScript 2015 future reserved keywords\n \"enum\",\n \"implements\",\n \"interface\",\n \"let\",\n \"package\",\n \"private\",\n \"protected\",\n \"public\",\n \"static\",\n // Class name cannot be 'Object' when targeting ES5 with module CommonJS\n \"Object\",\n // TypeScript keywords that cannot be used for types (as opposed to variables)\n \"bigint\",\n \"number\",\n \"boolean\",\n \"string\",\n \"object\",\n // Identifiers reserved for the runtime, so we can generate legible code\n \"globalThis\",\n \"Uint8Array\",\n \"Partial\",\n]);\n/**\n * Names that cannot be used for object properties because they are reserved\n * by built-in JavaScript properties.\n */\nconst reservedObjectProperties = new Set([\n // names reserved by JavaScript\n \"constructor\",\n \"toString\",\n \"toJSON\",\n \"valueOf\",\n]);\n/**\n * Names that cannot be used for object properties because they are reserved\n * by the runtime.\n */\nconst reservedMessageProperties = new Set([\n // names reserved by the runtime\n \"getType\",\n \"clone\",\n \"equals\",\n \"fromBinary\",\n \"fromJson\",\n \"fromJsonString\",\n \"toBinary\",\n \"toJson\",\n \"toJsonString\",\n // names reserved by the runtime for the future\n \"toObject\",\n]);\nconst fallback = (name) => `${name}$`;\n/**\n * Will wrap names that are Object prototype properties or names reserved\n * for `Message`s.\n */\nconst safeMessageProperty = (name) => {\n if (reservedMessageProperties.has(name)) {\n return fallback(name);\n }\n return name;\n};\n/**\n * Names that cannot be used for object properties because they are reserved\n * by built-in JavaScript properties.\n */\nexport const safeObjectProperty = (name) => {\n if (reservedObjectProperties.has(name)) {\n return fallback(name);\n }\n return name;\n};\n/**\n * Names that can be used for identifiers or class properties\n */\nexport const safeIdentifier = (name) => {\n if (reservedIdentifiers.has(name)) {\n return fallback(name);\n }\n return name;\n};\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { getEnumType, makeEnum, makeEnumType } from \"./enum.js\";\nimport { makeMessageType } from \"./message-type.js\";\nexport function makeProtoRuntime(syntax, json, bin, util) {\n return {\n syntax,\n json,\n bin,\n util,\n makeMessageType(typeName, fields, opt) {\n return makeMessageType(this, typeName, fields, opt);\n },\n makeEnum,\n makeEnumType,\n getEnumType,\n };\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { localOneofName } from \"./names.js\";\nimport { assert } from \"./assert.js\";\nexport class InternalOneofInfo {\n constructor(name) {\n this.kind = \"oneof\";\n this.repeated = false;\n this.packed = false;\n this.opt = false;\n this.default = undefined;\n this.fields = [];\n this.name = name;\n this.localName = localOneofName(name);\n }\n addField(field) {\n assert(field.oneof === this, `field ${field.name} not one of ${this.name}`);\n this.fields.push(field);\n }\n findField(localName) {\n if (!this._lookup) {\n this._lookup = Object.create(null);\n for (let i = 0; i < this.fields.length; i++) {\n this._lookup[this.fields[i].localName] = this.fields[i];\n }\n }\n return this._lookup[localName];\n }\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { makeProtoRuntime } from \"./private/proto-runtime.js\";\nimport { makeBinaryFormatProto3 } from \"./private/binary-format-proto3.js\";\nimport { makeJsonFormatProto3 } from \"./private/json-format-proto3.js\";\nimport { makeUtilCommon } from \"./private/util-common.js\";\nimport { InternalFieldList } from \"./private/field-list.js\";\nimport { scalarDefaultValue } from \"./private/scalars.js\";\nimport { ScalarType } from \"./field.js\";\nimport { InternalOneofInfo } from \"./private/field.js\";\nimport { localFieldName, fieldJsonName } from \"./private/names.js\";\n/**\n * Provides functionality for messages defined with the proto3 syntax.\n */\nexport const proto3 = makeProtoRuntime(\"proto3\", makeJsonFormatProto3(), makeBinaryFormatProto3(), Object.assign(Object.assign({}, makeUtilCommon()), { newFieldList(fields) {\n return new InternalFieldList(fields, normalizeFieldInfosProto3);\n },\n initFields(target) {\n for (const member of target.getType().fields.byMember()) {\n if (member.opt) {\n continue;\n }\n const name = member.localName, t = target;\n if (member.repeated) {\n t[name] = [];\n continue;\n }\n switch (member.kind) {\n case \"oneof\":\n t[name] = { case: undefined };\n break;\n case \"enum\":\n t[name] = 0;\n break;\n case \"map\":\n t[name] = {};\n break;\n case \"scalar\":\n t[name] = scalarDefaultValue(member.T); // eslint-disable-line @typescript-eslint/no-unsafe-assignment\n break;\n case \"message\":\n // message fields are always optional in proto3\n break;\n }\n }\n } }));\n/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */\nfunction normalizeFieldInfosProto3(fieldInfos) {\n var _a, _b, _c;\n const r = [];\n let o;\n for (const field of typeof fieldInfos == \"function\"\n ? fieldInfos()\n : fieldInfos) {\n const f = field;\n f.localName = localFieldName(field.name, field.oneof !== undefined);\n f.jsonName = (_a = field.jsonName) !== null && _a !== void 0 ? _a : fieldJsonName(field.name);\n f.repeated = (_b = field.repeated) !== null && _b !== void 0 ? _b : false;\n // From the proto3 language guide:\n // > In proto3, repeated fields of scalar numeric types are packed by default.\n // This information is incomplete - according to the conformance tests, BOOL\n // and ENUM are packed by default as well. This means only STRING and BYTES\n // are not packed by default, which makes sense because they are length-delimited.\n f.packed =\n (_c = field.packed) !== null && _c !== void 0 ? _c : (field.kind == \"enum\" ||\n (field.kind == \"scalar\" &&\n field.T != ScalarType.BYTES &&\n field.T != ScalarType.STRING));\n // We do not surface options at this time\n // f.options = field.options ?? emptyReadonlyObject;\n if (field.oneof !== undefined) {\n const ooname = typeof field.oneof == \"string\" ? field.oneof : field.oneof.name;\n if (!o || o.name != ooname) {\n o = new InternalOneofInfo(ooname);\n }\n f.oneof = o;\n o.addField(f);\n }\n r.push(f);\n }\n return r;\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { wrapField } from \"./field-wrapper.js\";\nimport { assert } from \"./assert.js\";\nimport { makeJsonFormatCommon } from \"./json-format-common.js\";\n/* eslint-disable no-case-declarations, @typescript-eslint/restrict-plus-operands,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-argument */\nexport function makeJsonFormatProto3() {\n return makeJsonFormatCommon((writeEnum, writeScalar) => {\n return function writeField(field, value, options) {\n if (field.kind == \"map\") {\n const jsonObj = {};\n switch (field.V.kind) {\n case \"scalar\":\n for (const [entryKey, entryValue] of Object.entries(value)) {\n const val = writeScalar(field.V.T, entryValue, true);\n assert(val !== undefined);\n jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n }\n break;\n case \"message\":\n for (const [entryKey, entryValue] of Object.entries(value)) {\n // JSON standard allows only (double quoted) string as property key\n jsonObj[entryKey.toString()] = entryValue.toJson(options);\n }\n break;\n case \"enum\":\n const enumType = field.V.T;\n for (const [entryKey, entryValue] of Object.entries(value)) {\n assert(entryValue === undefined || typeof entryValue == \"number\");\n const val = writeEnum(enumType, entryValue, true, options.enumAsInteger);\n assert(val !== undefined);\n jsonObj[entryKey.toString()] = val; // JSON standard allows only (double quoted) string as property key\n }\n break;\n }\n return options.emitDefaultValues || Object.keys(jsonObj).length > 0\n ? jsonObj\n : undefined;\n }\n else if (field.repeated) {\n const jsonArr = [];\n switch (field.kind) {\n case \"scalar\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(writeScalar(field.T, value[i], true));\n }\n break;\n case \"enum\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(writeEnum(field.T, value[i], true, options.enumAsInteger));\n }\n break;\n case \"message\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(wrapField(field.T, value[i]).toJson(options));\n }\n break;\n }\n return options.emitDefaultValues || jsonArr.length > 0\n ? jsonArr\n : undefined;\n }\n else {\n switch (field.kind) {\n case \"scalar\":\n return writeScalar(field.T, value, !!field.oneof || field.opt || options.emitDefaultValues);\n case \"enum\":\n return writeEnum(field.T, value, !!field.oneof || field.opt || options.emitDefaultValues, options.enumAsInteger);\n case \"message\":\n return value !== undefined\n ? wrapField(field.T, value).toJson(options)\n : undefined;\n }\n }\n };\n });\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { ScalarType } from \"../field.js\";\nimport { makeBinaryFormatCommon, writeMapEntry, writeMessageField, writePacked, writeScalar, } from \"./binary-format-common.js\";\n/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unnecessary-condition, @typescript-eslint/strict-boolean-expressions, prefer-const, no-case-declarations */\nexport function makeBinaryFormatProto3() {\n return Object.assign(Object.assign({}, makeBinaryFormatCommon()), { writeMessage(message, writer, options) {\n const type = message.getType();\n for (const field of type.fields.byNumber()) {\n let value, // this will be our field value, whether it is member of a oneof or regular field\n repeated = field.repeated, localName = field.localName;\n if (field.oneof) {\n const oneof = message[field.oneof.localName];\n if (oneof.case !== localName) {\n continue; // field is not selected, skip\n }\n value = oneof.value;\n }\n else {\n value = message[localName];\n }\n switch (field.kind) {\n case \"scalar\":\n case \"enum\":\n let scalarType = field.kind == \"enum\" ? ScalarType.INT32 : field.T;\n if (repeated) {\n if (field.packed) {\n writePacked(writer, scalarType, field.no, value);\n }\n else {\n for (const item of value) {\n writeScalar(writer, scalarType, field.no, item, true);\n }\n }\n }\n else {\n if (value !== undefined) {\n writeScalar(writer, scalarType, field.no, value, !!field.oneof || field.opt);\n }\n }\n break;\n case \"message\":\n if (repeated) {\n for (const item of value) {\n writeMessageField(writer, options, field.T, field.no, item);\n }\n }\n else {\n writeMessageField(writer, options, field.T, field.no, value);\n }\n break;\n case \"map\":\n for (const [key, val] of Object.entries(value)) {\n writeMapEntry(writer, options, field, key, val);\n }\n break;\n }\n }\n if (options.writeUnknownFields) {\n this.writeUnknownFields(message, writer);\n }\n return writer;\n } });\n}\n","// Copyright 2021-2023 Buf Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\nimport { Message } from \"../message.js\";\n/**\n * Create a new message type using the given runtime.\n */\nexport function makeMessageType(runtime, typeName, fields, opt) {\n var _a;\n const localName = (_a = opt === null || opt === void 0 ? void 0 : opt.localName) !== null && _a !== void 0 ? _a : typeName.substring(typeName.lastIndexOf(\".\") + 1);\n const type = {\n [localName]: function (data) {\n runtime.util.initFields(this);\n runtime.util.initPartial(data, this);\n },\n }[localName];\n Object.setPrototypeOf(type.prototype, new Message());\n Object.assign(type, {\n runtime,\n typeName,\n fields: runtime.util.newFieldList(fields),\n fromBinary(bytes, options) {\n return new type().fromBinary(bytes, options);\n },\n fromJson(jsonValue, options) {\n return new type().fromJson(jsonValue, options);\n },\n fromJsonString(jsonString, options) {\n return new type().fromJsonString(jsonString, options);\n },\n equals(a, b) {\n return runtime.util.equals(type, a, b);\n },\n });\n return type;\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","var getProto = Object.getPrototypeOf ? function(obj) { return Object.getPrototypeOf(obj); } : function(obj) { return obj.__proto__; };\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach(function(key) { def[key] = function() { return value[key]; }; });\n\t}\n\tdef['default'] = function() { return value; };\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import _typeof from \"./typeof.js\";\nexport default function _regeneratorRuntime() {\n \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */\n _regeneratorRuntime = function _regeneratorRuntime() {\n return exports;\n };\n var exports = {},\n Op = Object.prototype,\n hasOwn = Op.hasOwnProperty,\n defineProperty = Object.defineProperty || function (obj, key, desc) {\n obj[key] = desc.value;\n },\n $Symbol = \"function\" == typeof Symbol ? Symbol : {},\n iteratorSymbol = $Symbol.iterator || \"@@iterator\",\n asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\",\n toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n function define(obj, key, value) {\n return Object.defineProperty(obj, key, {\n value: value,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }), obj[key];\n }\n try {\n define({}, \"\");\n } catch (err) {\n define = function define(obj, key, value) {\n return obj[key] = value;\n };\n }\n function wrap(innerFn, outerFn, self, tryLocsList) {\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,\n generator = Object.create(protoGenerator.prototype),\n context = new Context(tryLocsList || []);\n return defineProperty(generator, \"_invoke\", {\n value: makeInvokeMethod(innerFn, self, context)\n }), generator;\n }\n function tryCatch(fn, obj, arg) {\n try {\n return {\n type: \"normal\",\n arg: fn.call(obj, arg)\n };\n } catch (err) {\n return {\n type: \"throw\",\n arg: err\n };\n }\n }\n exports.wrap = wrap;\n var ContinueSentinel = {};\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n var getProto = Object.getPrototypeOf,\n NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);\n var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function (method) {\n define(prototype, method, function (arg) {\n return this._invoke(method, arg);\n });\n });\n }\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (\"throw\" !== record.type) {\n var result = record.arg,\n value = result.value;\n return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) {\n invoke(\"next\", value, resolve, reject);\n }, function (err) {\n invoke(\"throw\", err, resolve, reject);\n }) : PromiseImpl.resolve(value).then(function (unwrapped) {\n result.value = unwrapped, resolve(result);\n }, function (error) {\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n reject(record.arg);\n }\n var previousPromise;\n defineProperty(this, \"_invoke\", {\n value: function value(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function (resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();\n }\n });\n }\n function makeInvokeMethod(innerFn, self, context) {\n var state = \"suspendedStart\";\n return function (method, arg) {\n if (\"executing\" === state) throw new Error(\"Generator is already running\");\n if (\"completed\" === state) {\n if (\"throw\" === method) throw arg;\n return doneResult();\n }\n for (context.method = method, context.arg = arg;;) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) {\n if (\"suspendedStart\" === state) throw state = \"completed\", context.arg;\n context.dispatchException(context.arg);\n } else \"return\" === context.method && context.abrupt(\"return\", context.arg);\n state = \"executing\";\n var record = tryCatch(innerFn, self, context);\n if (\"normal\" === record.type) {\n if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue;\n return {\n value: record.arg,\n done: context.done\n };\n }\n \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg);\n }\n };\n }\n function maybeInvokeDelegate(delegate, context) {\n var methodName = context.method,\n method = delegate.iterator[methodName];\n if (undefined === method) return context.delegate = null, \"throw\" === methodName && delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method) || \"return\" !== methodName && (context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a '\" + methodName + \"' method\")), ContinueSentinel;\n var record = tryCatch(method, delegate.iterator, context.arg);\n if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel;\n var info = record.arg;\n return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel);\n }\n function pushTryEntry(locs) {\n var entry = {\n tryLoc: locs[0]\n };\n 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);\n }\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\", delete record.arg, entry.completion = record;\n }\n function Context(tryLocsList) {\n this.tryEntries = [{\n tryLoc: \"root\"\n }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);\n }\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) return iteratorMethod.call(iterable);\n if (\"function\" == typeof iterable.next) return iterable;\n if (!isNaN(iterable.length)) {\n var i = -1,\n next = function next() {\n for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;\n return next.value = undefined, next.done = !0, next;\n };\n return next.next = next;\n }\n }\n return {\n next: doneResult\n };\n }\n function doneResult() {\n return {\n value: undefined,\n done: !0\n };\n }\n return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", {\n value: GeneratorFunctionPrototype,\n configurable: !0\n }), defineProperty(GeneratorFunctionPrototype, \"constructor\", {\n value: GeneratorFunction,\n configurable: !0\n }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) {\n var ctor = \"function\" == typeof genFun && genFun.constructor;\n return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name));\n }, exports.mark = function (genFun) {\n return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun;\n }, exports.awrap = function (arg) {\n return {\n __await: arg\n };\n }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n void 0 === PromiseImpl && (PromiseImpl = Promise);\n var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);\n return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {\n return result.done ? result.value : iter.next();\n });\n }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () {\n return this;\n }), define(Gp, \"toString\", function () {\n return \"[object Generator]\";\n }), exports.keys = function (val) {\n var object = Object(val),\n keys = [];\n for (var key in object) keys.push(key);\n return keys.reverse(), function next() {\n for (; keys.length;) {\n var key = keys.pop();\n if (key in object) return next.value = key, next.done = !1, next;\n }\n return next.done = !0, next;\n };\n }, exports.values = values, Context.prototype = {\n constructor: Context,\n reset: function reset(skipTempReset) {\n if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);\n },\n stop: function stop() {\n this.done = !0;\n var rootRecord = this.tryEntries[0].completion;\n if (\"throw\" === rootRecord.type) throw rootRecord.arg;\n return this.rval;\n },\n dispatchException: function dispatchException(exception) {\n if (this.done) throw exception;\n var context = this;\n function handle(loc, caught) {\n return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught;\n }\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i],\n record = entry.completion;\n if (\"root\" === entry.tryLoc) return handle(\"end\");\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\"),\n hasFinally = hasOwn.call(entry, \"finallyLoc\");\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);\n if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);\n } else {\n if (!hasFinally) throw new Error(\"try statement without catch or finally\");\n if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);\n }\n }\n }\n },\n abrupt: function abrupt(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);\n var record = finallyEntry ? finallyEntry.completion : {};\n return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);\n },\n complete: function complete(record, afterLoc) {\n if (\"throw\" === record.type) throw record.arg;\n return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;\n },\n finish: function finish(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;\n }\n },\n \"catch\": function _catch(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (\"throw\" === record.type) {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n throw new Error(\"illegal catch attempt\");\n },\n delegateYield: function delegateYield(iterable, resultName, nextLoc) {\n return this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel;\n }\n }, exports;\n}","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\nexport default function _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n _next(undefined);\n });\n };\n}","import defineProperty from \"./defineProperty.js\";\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n return keys;\n}\nexport default function _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n return target;\n}","import React from 'react';\n\nconst TitleBar = () => {\n return (\n \n
Kurtosis Enclave Manager
\n \n );\n};\n\nexport default TitleBar;\n","import setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nexport default function _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n _construct = Reflect.construct.bind();\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n a.push.apply(a, args);\n var Constructor = Function.bind.apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n return _construct.apply(null, arguments);\n}","import getPrototypeOf from \"./getPrototypeOf.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeFunction from \"./isNativeFunction.js\";\nimport construct from \"./construct.js\";\nexport default function _wrapNativeSuper(Class) {\n var _cache = typeof Map === \"function\" ? new Map() : undefined;\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n _cache.set(Class, Wrapper);\n }\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n Wrapper.prototype = Object.create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n return _wrapNativeSuper(Class);\n}","export default function _isNativeFunction(fn) {\n return Function.toString.call(fn).indexOf(\"[native code]\") !== -1;\n}","////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Actions represent the type of change to a location value.\n */\nexport enum Action {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Pop = \"POP\",\n\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Push = \"PUSH\",\n\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Replace = \"REPLACE\",\n}\n\n/**\n * The pathname, search, and hash values of a URL.\n */\nexport interface Path {\n /**\n * A URL pathname, beginning with a /.\n */\n pathname: string;\n\n /**\n * A URL search string, beginning with a ?.\n */\n search: string;\n\n /**\n * A URL fragment identifier, beginning with a #.\n */\n hash: string;\n}\n\n/**\n * An entry in a history stack. A location contains information about the\n * URL path, as well as possibly some arbitrary state and a key.\n */\nexport interface Location extends Path {\n /**\n * A value of arbitrary data associated with this location.\n */\n state: any;\n\n /**\n * A unique string associated with this location. May be used to safely store\n * and retrieve data in some other storage API, like `localStorage`.\n *\n * Note: This value is always \"default\" on the initial location.\n */\n key: string;\n}\n\n/**\n * A change to the current location.\n */\nexport interface Update {\n /**\n * The action that triggered the change.\n */\n action: Action;\n\n /**\n * The new location.\n */\n location: Location;\n\n /**\n * The delta between this location and the former location in the history stack\n */\n delta: number | null;\n}\n\n/**\n * A function that receives notifications about location changes.\n */\nexport interface Listener {\n (update: Update): void;\n}\n\n/**\n * Describes a location that is the destination of some navigation, either via\n * `history.push` or `history.replace`. May be either a URL or the pieces of a\n * URL path.\n */\nexport type To = string | Partial;\n\n/**\n * A history is an interface to the navigation stack. The history serves as the\n * source of truth for the current location, as well as provides a set of\n * methods that may be used to change it.\n *\n * It is similar to the DOM's `window.history` object, but with a smaller, more\n * focused API.\n */\nexport interface History {\n /**\n * The last action that modified the current location. This will always be\n * Action.Pop when a history instance is first created. This value is mutable.\n */\n readonly action: Action;\n\n /**\n * The current location. This value is mutable.\n */\n readonly location: Location;\n\n /**\n * Returns a valid href for the given `to` value that may be used as\n * the value of an attribute.\n *\n * @param to - The destination URL\n */\n createHref(to: To): string;\n\n /**\n * Returns a URL for the given `to` value\n *\n * @param to - The destination URL\n */\n createURL(to: To): URL;\n\n /**\n * Encode a location the same way window.history would do (no-op for memory\n * history) so we ensure our PUSH/REPLACE navigations for data routers\n * behave the same as POP\n *\n * @param to Unencoded path\n */\n encodeLocation(to: To): Path;\n\n /**\n * Pushes a new location onto the history stack, increasing its length by one.\n * If there were any entries in the stack after the current one, they are\n * lost.\n *\n * @param to - The new URL\n * @param state - Data to associate with the new location\n */\n push(to: To, state?: any): void;\n\n /**\n * Replaces the current location in the history stack with a new one. The\n * location that was replaced will no longer be available.\n *\n * @param to - The new URL\n * @param state - Data to associate with the new location\n */\n replace(to: To, state?: any): void;\n\n /**\n * Navigates `n` entries backward/forward in the history stack relative to the\n * current index. For example, a \"back\" navigation would use go(-1).\n *\n * @param delta - The delta in the stack index\n */\n go(delta: number): void;\n\n /**\n * Sets up a listener that will be called whenever the current location\n * changes.\n *\n * @param listener - A function that will be called when the location changes\n * @returns unlisten - A function that may be used to stop listening\n */\n listen(listener: Listener): () => void;\n}\n\ntype HistoryState = {\n usr: any;\n key?: string;\n idx: number;\n};\n\nconst PopStateEventType = \"popstate\";\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Memory History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A user-supplied object that describes a location. Used when providing\n * entries to `createMemoryHistory` via its `initialEntries` option.\n */\nexport type InitialEntry = string | Partial;\n\nexport type MemoryHistoryOptions = {\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n v5Compat?: boolean;\n};\n\n/**\n * A memory history stores locations in memory. This is useful in stateful\n * environments where there is no web browser, such as node tests or React\n * Native.\n */\nexport interface MemoryHistory extends History {\n /**\n * The current index in the history stack.\n */\n readonly index: number;\n}\n\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nexport function createMemoryHistory(\n options: MemoryHistoryOptions = {}\n): MemoryHistory {\n let { initialEntries = [\"/\"], initialIndex, v5Compat = false } = options;\n let entries: Location[]; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) =>\n createMemoryLocation(\n entry,\n typeof entry === \"string\" ? null : entry.state,\n index === 0 ? \"default\" : undefined\n )\n );\n let index = clampIndex(\n initialIndex == null ? entries.length - 1 : initialIndex\n );\n let action = Action.Pop;\n let listener: Listener | null = null;\n\n function clampIndex(n: number): number {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation(): Location {\n return entries[index];\n }\n function createMemoryLocation(\n to: To,\n state: any = null,\n key?: string\n ): Location {\n let location = createLocation(\n entries ? getCurrentLocation().pathname : \"/\",\n to,\n state,\n key\n );\n warning(\n location.pathname.charAt(0) === \"/\",\n `relative pathnames are not supported in memory history: ${JSON.stringify(\n to\n )}`\n );\n return location;\n }\n\n function createHref(to: To) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n\n let history: MemoryHistory = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to: To) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\",\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({ action, location: nextLocation, delta: 1 });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({ action, location: nextLocation, delta: 0 });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({ action, location: nextLocation, delta });\n }\n },\n listen(fn: Listener) {\n listener = fn;\n return () => {\n listener = null;\n };\n },\n };\n\n return history;\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Browser History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A browser history stores the current location in regular URLs in a web\n * browser environment. This is the standard for most web apps and provides the\n * cleanest URLs the browser's address bar.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#browserhistory\n */\nexport interface BrowserHistory extends UrlHistory {}\n\nexport type BrowserHistoryOptions = UrlHistoryOptions;\n\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nexport function createBrowserHistory(\n options: BrowserHistoryOptions = {}\n): BrowserHistory {\n function createBrowserLocation(\n window: Window,\n globalHistory: Window[\"history\"]\n ) {\n let { pathname, search, hash } = window.location;\n return createLocation(\n \"\",\n { pathname, search, hash },\n // state defaults to `null` because `window.history.state` does\n (globalHistory.state && globalHistory.state.usr) || null,\n (globalHistory.state && globalHistory.state.key) || \"default\"\n );\n }\n\n function createBrowserHref(window: Window, to: To) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n\n return getUrlBasedHistory(\n createBrowserLocation,\n createBrowserHref,\n null,\n options\n );\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Hash History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A hash history stores the current location in the fragment identifier portion\n * of the URL in a web browser environment.\n *\n * This is ideal for apps that do not control the server for some reason\n * (because the fragment identifier is never sent to the server), including some\n * shared hosting environments that do not provide fine-grained controls over\n * which pages are served at which URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#hashhistory\n */\nexport interface HashHistory extends UrlHistory {}\n\nexport type HashHistoryOptions = UrlHistoryOptions;\n\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nexport function createHashHistory(\n options: HashHistoryOptions = {}\n): HashHistory {\n function createHashLocation(\n window: Window,\n globalHistory: Window[\"history\"]\n ) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n } = parsePath(window.location.hash.substr(1));\n return createLocation(\n \"\",\n { pathname, search, hash },\n // state defaults to `null` because `window.history.state` does\n (globalHistory.state && globalHistory.state.usr) || null,\n (globalHistory.state && globalHistory.state.key) || \"default\"\n );\n }\n\n function createHashHref(window: Window, to: To) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n\n function validateHashLocation(location: Location, to: To) {\n warning(\n location.pathname.charAt(0) === \"/\",\n `relative pathnames are not supported in hash history.push(${JSON.stringify(\n to\n )})`\n );\n }\n\n return getUrlBasedHistory(\n createHashLocation,\n createHashHref,\n validateHashLocation,\n options\n );\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region UTILS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * @private\n */\nexport function invariant(value: boolean, message?: string): asserts value;\nexport function invariant(\n value: T | null | undefined,\n message?: string\n): asserts value is T;\nexport function invariant(value: any, message?: string) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\n\nexport function warning(cond: any, message: string) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location: Location, index: number): HistoryState {\n return {\n usr: location.state,\n key: location.key,\n idx: index,\n };\n}\n\n/**\n * Creates a Location object with a unique key from the given Path\n */\nexport function createLocation(\n current: string | Location,\n to: To,\n state: any = null,\n key?: string\n): Readonly {\n let location: Readonly = {\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\",\n ...(typeof to === \"string\" ? parsePath(to) : to),\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: (to && (to as Location).key) || key || createKey(),\n };\n return location;\n}\n\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nexport function createPath({\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n}: Partial) {\n if (search && search !== \"?\")\n pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\")\n pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nexport function parsePath(path: string): Partial {\n let parsedPath: Partial = {};\n\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport interface UrlHistory extends History {}\n\nexport type UrlHistoryOptions = {\n window?: Window;\n v5Compat?: boolean;\n};\n\nfunction getUrlBasedHistory(\n getLocation: (window: Window, globalHistory: Window[\"history\"]) => Location,\n createHref: (window: Window, to: To) => string,\n validateLocation: ((location: Location, to: To) => void) | null,\n options: UrlHistoryOptions = {}\n): UrlHistory {\n let { window = document.defaultView!, v5Compat = false } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener: Listener | null = null;\n\n let index = getIndex()!;\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState({ ...globalHistory.state, idx: index }, \"\");\n }\n\n function getIndex(): number {\n let state = globalHistory.state || { idx: null };\n return state.idx;\n }\n\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({ action, location: history.location, delta });\n }\n }\n\n function push(to: To, state?: any) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n if (v5Compat && listener) {\n listener({ action, location: history.location, delta: 1 });\n }\n }\n\n function replace(to: To, state?: any) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n\n if (v5Compat && listener) {\n listener({ action, location: history.location, delta: 0 });\n }\n }\n\n function createURL(to: To): URL {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base =\n window.location.origin !== \"null\"\n ? window.location.origin\n : window.location.href;\n\n let href = typeof to === \"string\" ? to : createPath(to);\n invariant(\n base,\n `No window.location.(origin|href) available to create URL for href: ${href}`\n );\n return new URL(href, base);\n }\n\n let history: History = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn: Listener) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash,\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n },\n };\n\n return history;\n}\n\n//#endregion\n","import type { Location, Path, To } from \"./history\";\nimport { warning, invariant, parsePath } from \"./history\";\n\n/**\n * Map of routeId -> data returned from a loader/action/error\n */\nexport interface RouteData {\n [routeId: string]: any;\n}\n\nexport enum ResultType {\n data = \"data\",\n deferred = \"deferred\",\n redirect = \"redirect\",\n error = \"error\",\n}\n\n/**\n * Successful result from a loader or action\n */\nexport interface SuccessResult {\n type: ResultType.data;\n data: any;\n statusCode?: number;\n headers?: Headers;\n}\n\n/**\n * Successful defer() result from a loader or action\n */\nexport interface DeferredResult {\n type: ResultType.deferred;\n deferredData: DeferredData;\n statusCode?: number;\n headers?: Headers;\n}\n\n/**\n * Redirect result from a loader or action\n */\nexport interface RedirectResult {\n type: ResultType.redirect;\n status: number;\n location: string;\n revalidate: boolean;\n}\n\n/**\n * Unsuccessful result from a loader or action\n */\nexport interface ErrorResult {\n type: ResultType.error;\n error: any;\n headers?: Headers;\n}\n\n/**\n * Result from a loader or action - potentially successful or unsuccessful\n */\nexport type DataResult =\n | SuccessResult\n | DeferredResult\n | RedirectResult\n | ErrorResult;\n\ntype LowerCaseFormMethod = \"get\" | \"post\" | \"put\" | \"patch\" | \"delete\";\ntype UpperCaseFormMethod = Uppercase;\n\n/**\n * Users can specify either lowercase or uppercase form methods on