{"version":3,"file":"@grpc-iLYBzgk5.js","sources":["../../node_modules/@connectrpc/connect/dist/esm/code.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/code-string.js","../../node_modules/@connectrpc/connect/dist/esm/connect-error.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/assert.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/enum.js","../../node_modules/@bufbuild/protobuf/dist/esm/message.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/message-type.js","../../node_modules/@bufbuild/protobuf/dist/esm/google/varint.js","../../node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js","../../node_modules/@bufbuild/protobuf/dist/esm/scalar.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/scalars.js","../../node_modules/@bufbuild/protobuf/dist/esm/binary-encoding.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/extensions.js","../../node_modules/@bufbuild/protobuf/dist/esm/proto-base64.js","../../node_modules/@bufbuild/protobuf/dist/esm/extension-accessor.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/reflect.js","../../node_modules/@bufbuild/protobuf/dist/esm/is-message.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/field-wrapper.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/json-format.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/binary-format.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/util-common.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/proto-runtime.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/field-list.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/names.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/field.js","../../node_modules/@bufbuild/protobuf/dist/esm/private/field-normalize.js","../../node_modules/@bufbuild/protobuf/dist/esm/proto3.js","../../node_modules/@bufbuild/protobuf/dist/esm/service-type.js","../../node_modules/@bufbuild/protobuf/dist/esm/google/protobuf/timestamp_pb.js","../../node_modules/@bufbuild/protobuf/dist/esm/google/protobuf/duration_pb.js","../../node_modules/@bufbuild/protobuf/dist/esm/google/protobuf/any_pb.js","../../node_modules/@bufbuild/protobuf/dist/esm/to-plain-message.js","../../node_modules/@connectrpc/connect/dist/esm/http-headers.js","../../node_modules/@connectrpc/connect/dist/esm/any-client.js","../../node_modules/@connectrpc/connect/dist/esm/protocol/envelope.js","../../node_modules/@connectrpc/connect/dist/esm/protocol/async-iterable.js","../../node_modules/@connectrpc/connect/dist/esm/promise-client.js","../../node_modules/@connectrpc/connect/dist/esm/protocol/signals.js","../../node_modules/@connectrpc/connect/dist/esm/context-values.js","../../node_modules/@connectrpc/connect/dist/esm/protocol/create-method-url.js","../../node_modules/@connectrpc/connect/dist/esm/protocol/normalize.js","../../node_modules/@connectrpc/connect/dist/esm/interceptor.js","../../node_modules/@connectrpc/connect/dist/esm/protocol/serialization.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/content-type.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/error-json.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/end-stream.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/headers.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/http-status.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/trailer-mux.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/version.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/request-header.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/validate-response.js","../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/get-request.js","../../node_modules/@connectrpc/connect/dist/esm/protocol/run-call.js","../../node_modules/@connectrpc/connect-web/dist/esm/assert-fetch-api.js","../../node_modules/@connectrpc/connect-web/dist/esm/connect-transport.js"],"sourcesContent":["// Copyright 2021-2024 The Connect Authors\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 * Connect represents categories of errors as codes, and each code maps to a\n * specific HTTP status code. The codes and their semantics were chosen to\n * match gRPC. Only the codes below are valid — there are no user-defined\n * codes.\n *\n * See the specification at https://connectrpc.com/docs/protocol#error-codes\n * for details.\n */\nexport var Code;\n(function (Code) {\n /**\n * Canceled, usually be the user\n */\n Code[Code[\"Canceled\"] = 1] = \"Canceled\";\n /**\n * Unknown error\n */\n Code[Code[\"Unknown\"] = 2] = \"Unknown\";\n /**\n * Argument invalid regardless of system state\n */\n Code[Code[\"InvalidArgument\"] = 3] = \"InvalidArgument\";\n /**\n * Operation expired, may or may not have completed.\n */\n Code[Code[\"DeadlineExceeded\"] = 4] = \"DeadlineExceeded\";\n /**\n * Entity not found.\n */\n Code[Code[\"NotFound\"] = 5] = \"NotFound\";\n /**\n * Entity already exists.\n */\n Code[Code[\"AlreadyExists\"] = 6] = \"AlreadyExists\";\n /**\n * Operation not authorized.\n */\n Code[Code[\"PermissionDenied\"] = 7] = \"PermissionDenied\";\n /**\n * Quota exhausted.\n */\n Code[Code[\"ResourceExhausted\"] = 8] = \"ResourceExhausted\";\n /**\n * Argument invalid in current system state.\n */\n Code[Code[\"FailedPrecondition\"] = 9] = \"FailedPrecondition\";\n /**\n * Operation aborted.\n */\n Code[Code[\"Aborted\"] = 10] = \"Aborted\";\n /**\n * Out of bounds, use instead of FailedPrecondition.\n */\n Code[Code[\"OutOfRange\"] = 11] = \"OutOfRange\";\n /**\n * Operation not implemented or disabled.\n */\n Code[Code[\"Unimplemented\"] = 12] = \"Unimplemented\";\n /**\n * Internal error, reserved for \"serious errors\".\n */\n Code[Code[\"Internal\"] = 13] = \"Internal\";\n /**\n * Unavailable, client should back off and retry.\n */\n Code[Code[\"Unavailable\"] = 14] = \"Unavailable\";\n /**\n * Unrecoverable data loss or corruption.\n */\n Code[Code[\"DataLoss\"] = 15] = \"DataLoss\";\n /**\n * Request isn't authenticated.\n */\n Code[Code[\"Unauthenticated\"] = 16] = \"Unauthenticated\";\n})(Code || (Code = {}));\n","// Copyright 2021-2024 The Connect Authors\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 { Code } from \"../code.js\";\n/**\n * codeToString returns the string representation of a Code.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function codeToString(value) {\n const name = Code[value];\n if (typeof name != \"string\") {\n return value.toString();\n }\n return (name[0].toLowerCase() +\n name.substring(1).replace(/[A-Z]/g, (c) => \"_\" + c.toLowerCase()));\n}\nlet stringToCode;\n/**\n * codeFromString parses the string representation of a Code in snake_case.\n * For example, the string \"permission_denied\" parses into Code.PermissionDenied.\n *\n * If the given string cannot be parsed, the function returns undefined.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function codeFromString(value) {\n if (!stringToCode) {\n stringToCode = {};\n for (const value of Object.values(Code)) {\n if (typeof value == \"string\") {\n continue;\n }\n stringToCode[codeToString(value)] = value;\n }\n }\n return stringToCode[value];\n}\n","// Copyright 2021-2024 The Connect Authors\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 { Code } from \"./code.js\";\nimport { codeToString } from \"./protocol-connect/code-string.js\";\n/**\n * ConnectError captures four pieces of information: a Code, an error\n * message, an optional cause of the error, and an optional collection of\n * arbitrary Protobuf messages called \"details\".\n *\n * Because developer tools typically show just the error message, we prefix\n * it with the status code, so that the most important information is always\n * visible immediately.\n *\n * Error details are wrapped with google.protobuf.Any on the wire, so that\n * a server or middleware can attach arbitrary data to an error. Use the\n * method findDetails() to retrieve the details.\n */\nexport class ConnectError extends Error {\n /**\n * Create a new ConnectError.\n * If no code is provided, code \"unknown\" is used.\n * Outgoing details are only relevant for the server side - a service may\n * raise an error with details, and it is up to the protocol implementation\n * to encode and send the details along with error.\n */\n constructor(message, code = Code.Unknown, metadata, outgoingDetails, cause) {\n super(createMessage(message, code));\n this.name = \"ConnectError\";\n // see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#example\n Object.setPrototypeOf(this, new.target.prototype);\n this.rawMessage = message;\n this.code = code;\n this.metadata = new Headers(metadata !== null && metadata !== void 0 ? metadata : {});\n this.details = outgoingDetails !== null && outgoingDetails !== void 0 ? outgoingDetails : [];\n this.cause = cause;\n }\n /**\n * Convert any value - typically a caught error into a ConnectError,\n * following these rules:\n * - If the value is already a ConnectError, return it as is.\n * - If the value is an AbortError from the fetch API, return the message\n * of the AbortError with code Canceled.\n * - For other Errors, return the error message with code Unknown by default.\n * - For other values, return the values String representation as a message,\n * with the code Unknown by default.\n * The original value will be used for the \"cause\" property for the new\n * ConnectError.\n */\n static from(reason, code = Code.Unknown) {\n if (reason instanceof ConnectError) {\n return reason;\n }\n if (reason instanceof Error) {\n if (reason.name == \"AbortError\") {\n // Fetch requests can only be canceled with an AbortController.\n // We detect that condition by looking at the name of the raised\n // error object, and translate to the appropriate status code.\n return new ConnectError(reason.message, Code.Canceled);\n }\n return new ConnectError(reason.message, code, undefined, undefined, reason);\n }\n return new ConnectError(String(reason), code, undefined, undefined, reason);\n }\n static [Symbol.hasInstance](v) {\n if (!(v instanceof Error)) {\n return false;\n }\n if (Object.getPrototypeOf(v) === ConnectError.prototype) {\n return true;\n }\n return (v.name === \"ConnectError\" &&\n \"code\" in v &&\n typeof v.code === \"number\" &&\n \"metadata\" in v &&\n \"details\" in v &&\n Array.isArray(v.details) &&\n \"rawMessage\" in v &&\n typeof v.rawMessage == \"string\" &&\n \"cause\" in v);\n }\n findDetails(typeOrRegistry) {\n const registry = \"typeName\" in typeOrRegistry\n ? {\n findMessage: (typeName) => typeName === typeOrRegistry.typeName ? typeOrRegistry : undefined,\n }\n : typeOrRegistry;\n const details = [];\n for (const data of this.details) {\n if (\"getType\" in data) {\n if (registry.findMessage(data.getType().typeName)) {\n details.push(data);\n }\n continue;\n }\n const type = registry.findMessage(data.type);\n if (type) {\n try {\n details.push(type.fromBinary(data.value));\n }\n catch (_) {\n // We silently give up if we are unable to parse the detail, because\n // that appears to be the least worst behavior.\n // It is very unlikely that a user surrounds a catch body handling the\n // error with another try-catch statement, and we do not want to\n // recommend doing so.\n }\n }\n }\n return details;\n }\n}\n/**\n * Create an error message, prefixing the given code.\n */\nfunction createMessage(message, code) {\n return message.length\n ? `[${codeToString(code)}] ${message}`\n : `[${codeToString(code)}]`;\n}\n","// Copyright 2021-2024 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-2024 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-2024 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-2024 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","// 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-2024 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-2024 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/**\n * JavaScript representation of fields with 64 bit integral types (int64, uint64,\n * sint64, fixed64, sfixed64).\n *\n * This is a subset of google.protobuf.FieldOptions.JSType, which defines JS_NORMAL,\n * JS_STRING, and JS_NUMBER. Protobuf-ES uses BigInt by default, but will use\n * String if `[jstype = JS_STRING]` is specified.\n *\n * ```protobuf\n * uint64 field_a = 1; // BigInt\n * uint64 field_b = 2 [jstype = JS_NORMAL]; // BigInt\n * uint64 field_b = 2 [jstype = JS_NUMBER]; // BigInt\n * uint64 field_b = 2 [jstype = JS_STRING]; // String\n * ```\n */\nexport var LongType;\n(function (LongType) {\n /**\n * Use JavaScript BigInt.\n */\n LongType[LongType[\"BIGINT\"] = 0] = \"BIGINT\";\n /**\n * Use JavaScript String.\n *\n * Field option `[jstype = JS_STRING]`.\n */\n LongType[LongType[\"STRING\"] = 1] = \"STRING\";\n})(LongType || (LongType = {}));\n","// Copyright 2021-2024 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 { protoInt64 } from \"../proto-int64.js\";\nimport { LongType, ScalarType } from \"../scalar.js\";\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 zero value for the given scalar type.\n */\nexport function scalarZeroValue(type, longType) {\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 // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- acceptable since it's covered by tests\n return (longType == 0 ? protoInt64.zero : \"0\");\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 * Returns true for a zero-value. For example, an integer has the zero-value `0`,\n * a boolean is `false`, a string is `\"\"`, and bytes is an empty Uint8Array.\n *\n * In proto3, zero-values are not written to the wire, unless the field is\n * optional or repeated.\n */\nexport function isScalarZeroValue(type, value) {\n switch (type) {\n case ScalarType.BOOL:\n return value === false;\n case ScalarType.STRING:\n return value === \"\";\n case ScalarType.BYTES:\n return value instanceof Uint8Array && !value.byteLength;\n default:\n return value == 0; // Loose comparison matches 0n, 0 and \"0\"\n }\n}\n","// Copyright 2021-2024 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 * Start of a tag-delimited aggregate, such as a proto2 group, or a message\n * in editions with message_encoding = DELIMITED.\n */\n WireType[WireType[\"StartGroup\"] = 3] = \"StartGroup\";\n /**\n * End of a tag-delimited aggregate.\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 // TODO check for matching field numbers in StartGroup / EndGroup tags\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-2024 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 { scalarZeroValue } from \"./scalars.js\";\nimport { WireType } from \"../binary-encoding.js\";\n/**\n * Create a new extension using the given runtime.\n */\nexport function makeExtension(runtime, typeName, extendee, field) {\n let fi;\n return {\n typeName,\n extendee,\n get field() {\n if (!fi) {\n const i = (typeof field == \"function\" ? field() : field);\n i.name = typeName.split(\".\").pop();\n i.jsonName = `[${typeName}]`;\n fi = runtime.util.newFieldList([i]).list()[0];\n }\n return fi;\n },\n runtime,\n };\n}\n/**\n * Create a container that allows us to read extension fields into it with the\n * same logic as regular fields.\n */\nexport function createExtensionContainer(extension) {\n const localName = extension.field.localName;\n const container = Object.create(null);\n container[localName] = initExtensionField(extension);\n return [container, () => container[localName]];\n}\nfunction initExtensionField(ext) {\n const field = ext.field;\n if (field.repeated) {\n return [];\n }\n if (field.default !== undefined) {\n return field.default;\n }\n switch (field.kind) {\n case \"enum\":\n return field.T.values[0].no;\n case \"scalar\":\n return scalarZeroValue(field.T, field.L);\n case \"message\":\n // eslint-disable-next-line no-case-declarations\n const T = field.T, value = new T();\n return T.fieldWrapper ? T.fieldWrapper.unwrapField(value) : value;\n case \"map\":\n throw \"map fields are not allowed to be extensions\";\n }\n}\n/**\n * Helper to filter unknown fields, optimized based on field type.\n */\nexport function filterUnknownFields(unknownFields, field) {\n if (!field.repeated && (field.kind == \"enum\" || field.kind == \"scalar\")) {\n // singular scalar fields do not merge, we pick the last\n for (let i = unknownFields.length - 1; i >= 0; --i) {\n if (unknownFields[i].no == field.no) {\n return [unknownFields[i]];\n }\n }\n return [];\n }\n return unknownFields.filter((uf) => uf.no === field.no);\n}\n","// Copyright 2021-2024 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-2024 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 { createExtensionContainer, filterUnknownFields, } from \"./private/extensions.js\";\n/**\n * Retrieve an extension value from a message.\n *\n * The function never returns undefined. Use hasExtension() to check whether an\n * extension is set. If the extension is not set, this function returns the\n * default value (if one was specified in the protobuf source), or the zero value\n * (for example `0` for numeric types, `[]` for repeated extension fields, and\n * an empty message instance for message fields).\n *\n * Extensions are stored as unknown fields on a message. To mutate an extension\n * value, make sure to store the new value with setExtension() after mutating.\n *\n * If the extension does not extend the given message, an error is raised.\n */\nexport function getExtension(message, extension, options) {\n assertExtendee(extension, message);\n const opt = extension.runtime.bin.makeReadOptions(options);\n const ufs = filterUnknownFields(message.getType().runtime.bin.listUnknownFields(message), extension.field);\n const [container, get] = createExtensionContainer(extension);\n for (const uf of ufs) {\n extension.runtime.bin.readField(container, opt.readerFactory(uf.data), extension.field, uf.wireType, opt);\n }\n return get();\n}\n/**\n * Set an extension value on a message. If the message already has a value for\n * this extension, the value is replaced.\n *\n * If the extension does not extend the given message, an error is raised.\n */\nexport function setExtension(message, extension, value, options) {\n assertExtendee(extension, message);\n const readOpt = extension.runtime.bin.makeReadOptions(options);\n const writeOpt = extension.runtime.bin.makeWriteOptions(options);\n if (hasExtension(message, extension)) {\n const ufs = message\n .getType()\n .runtime.bin.listUnknownFields(message)\n .filter((uf) => uf.no != extension.field.no);\n message.getType().runtime.bin.discardUnknownFields(message);\n for (const uf of ufs) {\n message\n .getType()\n .runtime.bin.onUnknownField(message, uf.no, uf.wireType, uf.data);\n }\n }\n const writer = writeOpt.writerFactory();\n let f = extension.field;\n // Implicit presence does not apply to extensions, see https://github.com/protocolbuffers/protobuf/issues/8234\n // We patch the field info to use explicit presence:\n if (!f.opt && !f.repeated && (f.kind == \"enum\" || f.kind == \"scalar\")) {\n f = Object.assign(Object.assign({}, extension.field), { opt: true });\n }\n extension.runtime.bin.writeField(f, value, writer, writeOpt);\n const reader = readOpt.readerFactory(writer.finish());\n while (reader.pos < reader.len) {\n const [no, wireType] = reader.tag();\n const data = reader.skip(wireType);\n message.getType().runtime.bin.onUnknownField(message, no, wireType, data);\n }\n}\n/**\n * Remove an extension value from a message.\n *\n * If the extension does not extend the given message, an error is raised.\n */\nexport function clearExtension(message, extension) {\n assertExtendee(extension, message);\n if (hasExtension(message, extension)) {\n const bin = message.getType().runtime.bin;\n const ufs = bin\n .listUnknownFields(message)\n .filter((uf) => uf.no != extension.field.no);\n bin.discardUnknownFields(message);\n for (const uf of ufs) {\n bin.onUnknownField(message, uf.no, uf.wireType, uf.data);\n }\n }\n}\n/**\n * Check whether an extension is set on a message.\n */\nexport function hasExtension(message, extension) {\n const messageType = message.getType();\n return (extension.extendee.typeName === messageType.typeName &&\n !!messageType.runtime.bin\n .listUnknownFields(message)\n .find((uf) => uf.no == extension.field.no));\n}\nfunction assertExtendee(extension, message) {\n assert(extension.extendee.typeName == message.getType().typeName, `extension ${extension.typeName} can only be applied to message ${extension.extendee.typeName}`);\n}\n","// Copyright 2021-2024 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 { isScalarZeroValue, scalarZeroValue } from \"./scalars.js\";\n/**\n * Returns true if the field is set.\n */\nexport function isFieldSet(field, target) {\n const localName = field.localName;\n if (field.repeated) {\n return target[localName].length > 0;\n }\n if (field.oneof) {\n return target[field.oneof.localName].case === localName; // eslint-disable-line @typescript-eslint/no-unsafe-member-access\n }\n switch (field.kind) {\n case \"enum\":\n case \"scalar\":\n if (field.opt || field.req) {\n // explicit presence\n return target[localName] !== undefined;\n }\n // implicit presence\n if (field.kind == \"enum\") {\n return target[localName] !== field.T.values[0].no;\n }\n return !isScalarZeroValue(field.T, target[localName]);\n case \"message\":\n return target[localName] !== undefined;\n case \"map\":\n return Object.keys(target[localName]).length > 0; // eslint-disable-line @typescript-eslint/no-unsafe-argument\n }\n}\n/**\n * Resets the field, so that isFieldSet() will return false.\n */\nexport function clearField(field, target) {\n const localName = field.localName;\n const implicitPresence = !field.opt && !field.req;\n if (field.repeated) {\n target[localName] = [];\n }\n else if (field.oneof) {\n target[field.oneof.localName] = { case: undefined };\n }\n else {\n switch (field.kind) {\n case \"map\":\n target[localName] = {};\n break;\n case \"enum\":\n target[localName] = implicitPresence ? field.T.values[0].no : undefined;\n break;\n case \"scalar\":\n target[localName] = implicitPresence\n ? scalarZeroValue(field.T, field.L)\n : undefined;\n break;\n case \"message\":\n target[localName] = undefined;\n break;\n }\n }\n}\n","// Copyright 2021-2024 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 * Check whether the given object is any subtype of Message or is a specific\n * Message by passing the type.\n *\n * Just like `instanceof`, `isMessage` narrows the type. The advantage of\n * `isMessage` is that it compares identity by the message type name, not by\n * class identity. This makes it robust against the dual package hazard and\n * similar situations, where the same message is duplicated.\n *\n * This function is _mostly_ equivalent to the `instanceof` operator. For\n * example, `isMessage(foo, MyMessage)` is the same as `foo instanceof MyMessage`,\n * and `isMessage(foo)` is the same as `foo instanceof Message`. In most cases,\n * `isMessage` should be preferred over `instanceof`.\n *\n * However, due to the fact that `isMessage` does not use class identity, there\n * are subtle differences between this function and `instanceof`. Notably,\n * calling `isMessage` on an explicit type of Message will return false.\n */\nexport function isMessage(arg, type) {\n if (arg === null || typeof arg != \"object\") {\n return false;\n }\n if (!Object.getOwnPropertyNames(Message.prototype).every((m) => m in arg && typeof arg[m] == \"function\")) {\n return false;\n }\n const actualType = arg.getType();\n if (actualType === null ||\n typeof actualType != \"function\" ||\n !(\"typeName\" in actualType) ||\n typeof actualType.typeName != \"string\") {\n return false;\n }\n return type === undefined ? true : actualType.typeName == type.typeName;\n}\n","// Copyright 2021-2024 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 \"../scalar.js\";\nimport { isMessage } from \"../is-message.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 (isMessage(value) || !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-2024 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 { assert, assertFloat32, assertInt32, assertUInt32 } from \"./assert.js\";\nimport { protoInt64 } from \"../proto-int64.js\";\nimport { protoBase64 } from \"../proto-base64.js\";\nimport { createExtensionContainer } from \"./extensions.js\";\nimport { getExtension, hasExtension, setExtension, } from \"../extension-accessor.js\";\nimport { clearField, isFieldSet } from \"./reflect.js\";\nimport { wrapField } from \"./field-wrapper.js\";\nimport { scalarZeroValue } from \"./scalars.js\";\nimport { isScalarZeroValue } from \"./scalars.js\";\nimport { LongType, ScalarType } from \"../scalar.js\";\nimport { isMessage } from \"../is-message.js\";\n/* eslint-disable no-case-declarations,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call */\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}\nconst tokenNull = Symbol();\nconst tokenIgnoredUnknownEnum = Symbol();\nexport function makeJsonFormat() {\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: ${debugJsonValue(json)}`);\n }\n message = message !== null && message !== void 0 ? message : new type();\n const oneofSeen = new Map();\n const registry = options.typeRegistry;\n for (const [jsonKey, jsonValue] of Object.entries(json)) {\n const field = type.fields.findJsonName(jsonKey);\n if (field) {\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.get(field.oneof);\n if (seen !== undefined) {\n throw new Error(`cannot decode message ${type.typeName} from JSON: multiple keys for oneof \"${field.oneof.name}\" present: \"${seen}\", \"${jsonKey}\"`);\n }\n oneofSeen.set(field.oneof, jsonKey);\n }\n readField(message, jsonValue, field, options, type);\n }\n else {\n let found = false;\n if ((registry === null || registry === void 0 ? void 0 : registry.findExtension) &&\n jsonKey.startsWith(\"[\") &&\n jsonKey.endsWith(\"]\")) {\n const ext = registry.findExtension(jsonKey.substring(1, jsonKey.length - 1));\n if (ext && ext.extendee.typeName == type.typeName) {\n found = true;\n const [container, get] = createExtensionContainer(ext);\n readField(container, jsonValue, ext.field, options, ext);\n // We pass on the options as BinaryReadOptions/BinaryWriteOptions,\n // so that users can bring their own binary reader and writer factories\n // if necessary.\n setExtension(message, ext, get(), options);\n }\n }\n if (!found && !options.ignoreUnknownFields) {\n throw new Error(`cannot decode message ${type.typeName} from JSON: key \"${jsonKey}\" is unknown`);\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 (field of type.fields.byNumber()) {\n if (!isFieldSet(field, message)) {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (field.req) {\n throw `required field not set`;\n }\n if (!options.emitDefaultValues) {\n continue;\n }\n if (!canEmitFieldDefaultValue(field)) {\n continue;\n }\n }\n const value = field.oneof\n ? message[field.oneof.localName].value\n : message[field.localName];\n const jsonValue = writeField(field, value, options);\n if (jsonValue !== undefined) {\n json[options.useProtoFieldName ? field.name : field.jsonName] =\n jsonValue;\n }\n }\n const registry = options.typeRegistry;\n if (registry === null || registry === void 0 ? void 0 : registry.findExtensionFor) {\n for (const uf of type.runtime.bin.listUnknownFields(message)) {\n const ext = registry.findExtensionFor(type.typeName, uf.no);\n if (ext && hasExtension(message, ext)) {\n // We pass on the options as BinaryReadOptions, so that users can bring their own\n // binary reader factory if necessary.\n const value = getExtension(message, ext, options);\n const jsonValue = writeField(ext.field, value, options);\n if (jsonValue !== undefined) {\n json[ext.field.jsonName] = jsonValue;\n }\n }\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(type, json, longType) {\n // The signature of our internal function has changed. For backwards-\n // compatibility, we support the old form that is part of the public API\n // through the interface JsonFormat.\n return readScalar(type, json, longType !== null && longType !== void 0 ? longType : LongType.BIGINT, true);\n },\n writeScalar(type, value, emitDefaultValues) {\n // The signature of our internal function has changed. For backwards-\n // compatibility, we support the old form that is part of the public API\n // through the interface JsonFormat.\n if (value === undefined) {\n return undefined;\n }\n if (emitDefaultValues || isScalarZeroValue(type, value)) {\n return writeScalar(type, value);\n }\n return undefined;\n },\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 String(json);\n }\n}\n// Read a JSON value for a field.\n// The \"parentType\" argument is only used to provide context in errors.\nfunction readField(target, jsonValue, field, options, parentType) {\n let localName = field.localName;\n if (field.repeated) {\n assert(field.kind != \"map\");\n if (jsonValue === null) {\n return;\n }\n if (!Array.isArray(jsonValue)) {\n throw new Error(`cannot decode field ${parentType.typeName}.${field.name} from JSON: ${debugJsonValue(jsonValue)}`);\n }\n const targetArray = target[localName];\n for (const jsonItem of jsonValue) {\n if (jsonItem === null) {\n throw new Error(`cannot decode field ${parentType.typeName}.${field.name} from JSON: ${debugJsonValue(jsonItem)}`);\n }\n switch (field.kind) {\n case \"message\":\n targetArray.push(field.T.fromJson(jsonItem, options));\n break;\n case \"enum\":\n const enumValue = readEnum(field.T, jsonItem, options.ignoreUnknownFields, true);\n if (enumValue !== tokenIgnoredUnknownEnum) {\n targetArray.push(enumValue);\n }\n break;\n case \"scalar\":\n try {\n targetArray.push(readScalar(field.T, jsonItem, field.L, true));\n }\n catch (e) {\n let m = `cannot decode field ${parentType.typeName}.${field.name} from JSON: ${debugJsonValue(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 }\n }\n else if (field.kind == \"map\") {\n if (jsonValue === null) {\n return;\n }\n if (typeof jsonValue != \"object\" || Array.isArray(jsonValue)) {\n throw new Error(`cannot decode field ${parentType.typeName}.${field.name} from JSON: ${debugJsonValue(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 ${parentType.typeName}.${field.name} from JSON: map value null`);\n }\n let key;\n try {\n key = readMapKey(field.K, jsonMapKey);\n }\n catch (e) {\n let m = `cannot decode map key for field ${parentType.typeName}.${field.name} from JSON: ${debugJsonValue(jsonValue)}`;\n if (e instanceof Error && e.message.length > 0) {\n m += `: ${e.message}`;\n }\n throw new Error(m);\n }\n switch (field.V.kind) {\n case \"message\":\n targetMap[key] = field.V.T.fromJson(jsonMapValue, options);\n break;\n case \"enum\":\n const enumValue = readEnum(field.V.T, jsonMapValue, options.ignoreUnknownFields, true);\n if (enumValue !== tokenIgnoredUnknownEnum) {\n targetMap[key] = enumValue;\n }\n break;\n case \"scalar\":\n try {\n targetMap[key] = readScalar(field.V.T, jsonMapValue, LongType.BIGINT, true);\n }\n catch (e) {\n let m = `cannot decode map value for field ${parentType.typeName}.${field.name} from JSON: ${debugJsonValue(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 else {\n if (field.oneof) {\n target = target[field.oneof.localName] = { case: localName };\n localName = \"value\";\n }\n switch (field.kind) {\n case \"message\":\n const messageType = field.T;\n if (jsonValue === null &&\n messageType.typeName != \"google.protobuf.Value\") {\n return;\n }\n let currentValue = target[localName];\n if (isMessage(currentValue)) {\n currentValue.fromJson(jsonValue, options);\n }\n else {\n target[localName] = currentValue = messageType.fromJson(jsonValue, options);\n if (messageType.fieldWrapper && !field.oneof) {\n target[localName] =\n messageType.fieldWrapper.unwrapField(currentValue);\n }\n }\n break;\n case \"enum\":\n const enumValue = readEnum(field.T, jsonValue, options.ignoreUnknownFields, false);\n switch (enumValue) {\n case tokenNull:\n clearField(field, target);\n break;\n case tokenIgnoredUnknownEnum:\n break;\n default:\n target[localName] = enumValue;\n break;\n }\n break;\n case \"scalar\":\n try {\n const scalarValue = readScalar(field.T, jsonValue, field.L, false);\n switch (scalarValue) {\n case tokenNull:\n clearField(field, target);\n break;\n default:\n target[localName] = scalarValue;\n break;\n }\n }\n catch (e) {\n let m = `cannot decode field ${parentType.typeName}.${field.name} from JSON: ${debugJsonValue(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}\nfunction readMapKey(type, json) {\n if (type === ScalarType.BOOL) {\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check\n switch (json) {\n case \"true\":\n json = true;\n break;\n case \"false\":\n json = false;\n break;\n }\n }\n return readScalar(type, json, LongType.BIGINT, true).toString();\n}\nfunction readScalar(type, json, longType, nullAsZeroValue) {\n if (json === null) {\n if (nullAsZeroValue) {\n return scalarZeroValue(type, longType);\n }\n return tokenNull;\n }\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 === \"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 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 (typeof json != \"number\" && typeof json != \"string\")\n break;\n const long = protoInt64.parse(json);\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return longType ? long.toString() : long;\n case ScalarType.FIXED64:\n case ScalarType.UINT64:\n if (typeof json != \"number\" && typeof json != \"string\")\n break;\n const uLong = protoInt64.uParse(json);\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return longType ? uLong.toString() : uLong;\n // bool:\n case ScalarType.BOOL:\n if (typeof json !== \"boolean\")\n break;\n return json;\n // string:\n case ScalarType.STRING:\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 === \"\")\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, nullAsZeroValue) {\n if (json === null) {\n if (type.typeName == \"google.protobuf.NullValue\") {\n return 0; // google.protobuf.NullValue.NULL_VALUE = 0\n }\n return nullAsZeroValue ? type.values[0].no : tokenNull;\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 !== undefined) {\n return value.no;\n }\n if (ignoreUnknownFields) {\n return tokenIgnoredUnknownEnum;\n }\n break;\n }\n throw new Error(`cannot decode enum ${type.typeName} from JSON: ${debugJsonValue(json)}`);\n}\n// Decide whether an unset field should be emitted with JSON write option `emitDefaultValues`\nfunction canEmitFieldDefaultValue(field) {\n if (field.repeated || field.kind == \"map\") {\n // maps are {}, repeated fields are []\n return true;\n }\n if (field.oneof) {\n // oneof fields are never emitted\n return false;\n }\n if (field.kind == \"message\") {\n // singular message field are allowed to emit JSON null, but we do not\n return false;\n }\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (field.opt || field.req) {\n // the field uses explicit presence, so we cannot emit a zero value\n return false;\n }\n return true;\n}\nfunction writeField(field, value, options) {\n if (field.kind == \"map\") {\n assert(typeof value == \"object\" && value != null);\n const jsonObj = {};\n const entries = Object.entries(value);\n switch (field.V.kind) {\n case \"scalar\":\n for (const [entryKey, entryValue] of entries) {\n jsonObj[entryKey.toString()] = writeScalar(field.V.T, entryValue); // JSON standard allows only (double quoted) string as property key\n }\n break;\n case \"message\":\n for (const [entryKey, entryValue] of entries) {\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 entries) {\n // JSON standard allows only (double quoted) string as property key\n jsonObj[entryKey.toString()] = writeEnum(enumType, entryValue, options.enumAsInteger);\n }\n break;\n }\n return options.emitDefaultValues || entries.length > 0\n ? jsonObj\n : undefined;\n }\n if (field.repeated) {\n assert(Array.isArray(value));\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]));\n }\n break;\n case \"enum\":\n for (let i = 0; i < value.length; i++) {\n jsonArr.push(writeEnum(field.T, value[i], 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 switch (field.kind) {\n case \"scalar\":\n return writeScalar(field.T, value);\n case \"enum\":\n return writeEnum(field.T, value, options.enumAsInteger);\n case \"message\":\n return wrapField(field.T, value).toJson(options);\n }\n}\nfunction writeEnum(type, value, enumAsInteger) {\n var _a;\n assert(typeof value == \"number\");\n if (type.typeName == \"google.protobuf.NullValue\") {\n return null;\n }\n if (enumAsInteger) {\n return value;\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) {\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;\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;\n // string:\n case ScalarType.STRING:\n assert(typeof value == \"string\");\n return value;\n // bool:\n case ScalarType.BOOL:\n assert(typeof value == \"boolean\");\n return value;\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 return value.toString();\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 protoBase64.enc(value);\n }\n}\n","// Copyright 2021-2024 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 { wrapField } from \"./field-wrapper.js\";\nimport { scalarZeroValue } from \"./scalars.js\";\nimport { assert } from \"./assert.js\";\nimport { isFieldSet } from \"./reflect.js\";\nimport { LongType, ScalarType } from \"../scalar.js\";\nimport { isMessage } from \"../is-message.js\";\n/* eslint-disable prefer-const,no-case-declarations,@typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-argument,@typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return */\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 makeBinaryFormat() {\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, lengthOrEndTagFieldNo, options, delimitedMessageEncoding) {\n const type = message.getType();\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n const end = delimitedMessageEncoding\n ? reader.len\n : reader.pos + lengthOrEndTagFieldNo;\n let fieldNo, wireType;\n while (reader.pos < end) {\n [fieldNo, wireType] = reader.tag();\n if (wireType == WireType.EndGroup) {\n break;\n }\n const 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 readField(message, reader, field, wireType, options);\n }\n if (delimitedMessageEncoding && // eslint-disable-line @typescript-eslint/strict-boolean-expressions\n (wireType != WireType.EndGroup || fieldNo !== lengthOrEndTagFieldNo)) {\n throw new Error(`invalid end group tag`);\n }\n },\n readField,\n writeMessage(message, writer, options) {\n const type = message.getType();\n for (const field of type.fields.byNumber()) {\n if (!isFieldSet(field, message)) {\n if (field.req) {\n throw new Error(`cannot encode field ${type.typeName}.${field.name} to binary: required field not set`);\n }\n continue;\n }\n const value = field.oneof\n ? message[field.oneof.localName].value\n : message[field.localName];\n writeField(field, value, writer, options);\n }\n if (options.writeUnknownFields) {\n this.writeUnknownFields(message, writer);\n }\n return writer;\n },\n writeField(field, value, writer, options) {\n // The behavior of our internal function has changed, it does no longer\n // accept `undefined` values for singular scalar and map.\n // For backwards-compatibility, we support the old form that is part of\n // the public API through the interface BinaryFormat.\n if (value === undefined) {\n return undefined;\n }\n writeField(field, value, writer, options);\n },\n };\n}\nfunction readField(target, // eslint-disable-line @typescript-eslint/no-explicit-any -- `any` is the best choice for dynamic access\nreader, field, wireType, options) {\n let { repeated, localName } = field;\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 let read = readScalar;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison -- acceptable since it's covered by tests\n if (field.kind == \"scalar\" && field.L > 0) {\n read = readScalarLTString;\n }\n if (repeated) {\n let arr = target[localName]; // safe to assume presence of array, oneof cannot contain repeated values\n const isPacked = wireType == WireType.LengthDelimited &&\n scalarType != ScalarType.STRING &&\n scalarType != ScalarType.BYTES;\n if (isPacked) {\n let e = reader.uint32() + reader.pos;\n while (reader.pos < e) {\n arr.push(read(reader, scalarType));\n }\n }\n else {\n arr.push(read(reader, scalarType));\n }\n }\n else {\n target[localName] = read(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, field));\n }\n else {\n if (isMessage(target[localName])) {\n readMessageField(reader, target[localName], options, field);\n }\n else {\n target[localName] = readMessageField(reader, new messageType(), options, field);\n if (messageType.fieldWrapper && !field.oneof && !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// Read a message, avoiding MessageType.fromBinary() to re-use the\n// BinaryReadOptions and the IBinaryReader.\nfunction readMessageField(reader, message, options, field) {\n const format = message.getType().runtime.bin;\n const delimited = field === null || field === void 0 ? void 0 : field.delimited;\n format.readMessage(message, reader, delimited ? field.no : reader.uint32(), // eslint-disable-line @typescript-eslint/strict-boolean-expressions\n options, delimited);\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 const [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, undefined);\n break;\n }\n break;\n }\n }\n if (key === undefined) {\n key = scalarZeroValue(field.K, LongType.BIGINT);\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 = scalarZeroValue(field.V.T, LongType.BIGINT);\n break;\n case \"enum\":\n val = field.V.T.values[0].no;\n break;\n case \"message\":\n val = new field.V.T();\n break;\n }\n }\n return [key, val];\n}\n// Read a scalar value, but return 64 bit integral types (int64, uint64,\n// sint64, fixed64, sfixed64) as string instead of bigint.\nfunction readScalarLTString(reader, type) {\n const v = readScalar(reader, type);\n return typeof v == \"bigint\" ? v.toString() : v;\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}\nfunction writeField(field, value, writer, options) {\n assert(value !== undefined);\n const repeated = field.repeated;\n switch (field.kind) {\n case \"scalar\":\n case \"enum\":\n let scalarType = field.kind == \"enum\" ? ScalarType.INT32 : field.T;\n if (repeated) {\n assert(Array.isArray(value));\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);\n }\n }\n }\n else {\n writeScalar(writer, scalarType, field.no, value);\n }\n break;\n case \"message\":\n if (repeated) {\n assert(Array.isArray(value));\n for (const item of value) {\n writeMessageField(writer, options, field, item);\n }\n }\n else {\n writeMessageField(writer, options, field, value);\n }\n break;\n case \"map\":\n assert(typeof value == \"object\" && value != null);\n for (const [key, val] of Object.entries(value)) {\n writeMapEntry(writer, options, field, key, val);\n }\n break;\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);\n // write value, expecting value field number = 2\n switch (field.V.kind) {\n case \"scalar\":\n writeScalar(writer, field.V.T, 2, value);\n break;\n case \"enum\":\n writeScalar(writer, ScalarType.INT32, 2, value);\n break;\n case \"message\":\n assert(value !== undefined);\n writer.tag(2, WireType.LengthDelimited).bytes(value.toBinary(options));\n break;\n }\n writer.join();\n}\n// Value must not be undefined\nfunction writeMessageField(writer, options, field, value) {\n const message = wrapField(field.T, value);\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (field.delimited)\n writer\n .tag(field.no, WireType.StartGroup)\n .raw(message.toBinary(options))\n .tag(field.no, WireType.EndGroup);\n else\n writer\n .tag(field.no, WireType.LengthDelimited)\n .bytes(message.toBinary(options));\n}\nfunction writeScalar(writer, type, fieldNo, value) {\n assert(value !== undefined);\n let [wireType, method] = scalarTypeInfo(type);\n writer.tag(fieldNo, wireType)[method](value);\n}\nfunction 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/**\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 */\n// TODO replace call-sites writeScalar() and writePacked(), then remove\nfunction scalarTypeInfo(type) {\n let wireType = WireType.Varint;\n // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- INT32, UINT32, SINT32 are covered by the defaults\n switch (type) {\n case ScalarType.BYTES:\n case ScalarType.STRING:\n wireType = WireType.LengthDelimited;\n break;\n case ScalarType.DOUBLE:\n case ScalarType.FIXED64:\n case ScalarType.SFIXED64:\n wireType = WireType.Bit64;\n break;\n case ScalarType.FIXED32:\n case ScalarType.SFIXED32:\n case ScalarType.FLOAT:\n wireType = WireType.Bit32;\n break;\n }\n const method = ScalarType[type].toLowerCase();\n return [wireType, method];\n}\n","// Copyright 2021-2024 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 { scalarEquals } from \"./scalars.js\";\nimport { ScalarType } from \"../scalar.js\";\nimport { isMessage } from \"../is-message.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 // TODO if source is a Message instance, we should use isFieldSet() here to support future field presence\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 !isMessage(val, sourceField.T)) {\n val = new sourceField.T(val);\n }\n else if (sourceField &&\n sourceField.kind === \"scalar\" &&\n sourceField.T === ScalarType.BYTES) {\n val = toU8Arr(val);\n }\n t[localName] = { case: sk, value: val };\n break;\n case \"scalar\":\n case \"enum\":\n let copy = s[localName];\n if (member.T === ScalarType.BYTES) {\n copy = member.repeated\n ? copy.map(toU8Arr)\n : toU8Arr(copy);\n }\n t[localName] = copy;\n break;\n case \"map\":\n switch (member.V.kind) {\n case \"scalar\":\n case \"enum\":\n if (member.V.T === ScalarType.BYTES) {\n for (const [k, v] of Object.entries(s[localName])) {\n t[localName][k] = toU8Arr(v);\n }\n }\n else {\n Object.assign(t[localName], s[localName]);\n }\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) => isMessage(val, mt) ? val : new mt(val));\n }\n else {\n const val = s[localName];\n if (mt.fieldWrapper) {\n if (\n // We can't use BytesValue.typeName as that will create a circular import\n mt.typeName === \"google.protobuf.BytesValue\") {\n t[localName] = toU8Arr(val);\n }\n else {\n t[localName] = val;\n }\n }\n else {\n t[localName] = isMessage(val, mt) ? val : new mt(val);\n }\n }\n break;\n }\n }\n },\n // TODO use isFieldSet() here to support future field presence\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 // TODO use isFieldSet() here to support future field presence\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(cloneSingularField);\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(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(source.value) }\n : { case: undefined };\n }\n else {\n copy = cloneSingularField(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(value) {\n if (value === undefined) {\n return value;\n }\n if (isMessage(value)) {\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// converts any ArrayLike to Uint8Array if necessary.\nfunction toU8Arr(input) {\n return input instanceof Uint8Array ? input : new Uint8Array(input);\n}\n","// Copyright 2021-2024 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\";\nimport { makeExtension } from \"./extensions.js\";\nimport { makeJsonFormat } from \"./json-format.js\";\nimport { makeBinaryFormat } from \"./binary-format.js\";\nimport { makeUtilCommon } from \"./util-common.js\";\nexport function makeProtoRuntime(syntax, newFieldList, initFields) {\n return {\n syntax,\n json: makeJsonFormat(),\n bin: makeBinaryFormat(),\n util: Object.assign(Object.assign({}, makeUtilCommon()), { newFieldList,\n initFields }),\n makeMessageType(typeName, fields, opt) {\n return makeMessageType(this, typeName, fields, opt);\n },\n makeEnum,\n makeEnumType,\n getEnumType,\n makeExtension(typeName, extendee, field) {\n return makeExtension(this, typeName, extendee, field);\n },\n };\n}\n","// Copyright 2021-2024 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-2024 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 case \"extension\": {\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-2024 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.req = 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-2024 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 { InternalOneofInfo } from \"./field.js\";\nimport { fieldJsonName, localFieldName } from \"./names.js\";\nimport { LongType, ScalarType } from \"../scalar.js\";\n/**\n * Convert a collection of field info to an array of normalized FieldInfo.\n *\n * The argument `packedByDefault` specifies whether fields that do not specify\n * `packed` should be packed (proto3) or unpacked (proto2).\n */\nexport function normalizeFieldInfos(fieldInfos, packedByDefault) {\n var _a, _b, _c, _d, _e, _f;\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 if (field.kind == \"scalar\") {\n f.L = (_c = field.L) !== null && _c !== void 0 ? _c : LongType.BIGINT;\n }\n f.delimited = (_d = field.delimited) !== null && _d !== void 0 ? _d : false;\n f.req = (_e = field.req) !== null && _e !== void 0 ? _e : false;\n f.opt = (_f = field.opt) !== null && _f !== void 0 ? _f : false;\n if (field.packed === undefined) {\n if (packedByDefault) {\n f.packed =\n field.kind == \"enum\" ||\n (field.kind == \"scalar\" &&\n field.T != ScalarType.BYTES &&\n field.T != ScalarType.STRING);\n }\n else {\n f.packed = false;\n }\n }\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-2024 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 { InternalFieldList } from \"./private/field-list.js\";\nimport { scalarZeroValue } from \"./private/scalars.js\";\nimport { normalizeFieldInfos } from \"./private/field-normalize.js\";\n/**\n * Provides functionality for messages defined with the proto3 syntax.\n */\nexport const proto3 = makeProtoRuntime(\"proto3\", (fields) => {\n return new InternalFieldList(fields, (source) => normalizeFieldInfos(source, true));\n}, \n// TODO merge with proto2 and initExtensionField, also see initPartial, equals, clone\n(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] = scalarZeroValue(member.T, member.L);\n break;\n case \"message\":\n // message fields are always optional in proto3\n break;\n }\n }\n});\n","// Copyright 2021-2024 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 * 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 */\nexport var 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 || (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 */\nexport var 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 || (MethodIdempotency = {}));\n","// Copyright 2021-2024 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 { protoInt64 } from \"../../proto-int64.js\";\nimport { proto3 } from \"../../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 */\nexport class Timestamp extends 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 = 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.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.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 = 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: 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.util.equals(Timestamp, a, b);\n }\n}\nTimestamp.runtime = proto3;\nTimestamp.typeName = \"google.protobuf.Timestamp\";\nTimestamp.fields = 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","// Copyright 2021-2024 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 { protoInt64 } from \"../../proto-int64.js\";\nimport { proto3 } from \"../../proto3.js\";\n/**\n * A Duration represents a signed, fixed-length span of time represented\n * as a count of seconds and fractions of seconds at nanosecond\n * resolution. It is independent of any calendar and concepts like \"day\"\n * or \"month\". It is related to Timestamp in that the difference between\n * two Timestamp values is a Duration and it can be added or subtracted\n * from a Timestamp. Range is approximately +-10,000 years.\n *\n * # Examples\n *\n * Example 1: Compute Duration from two Timestamps in pseudo code.\n *\n * Timestamp start = ...;\n * Timestamp end = ...;\n * Duration duration = ...;\n *\n * duration.seconds = end.seconds - start.seconds;\n * duration.nanos = end.nanos - start.nanos;\n *\n * if (duration.seconds < 0 && duration.nanos > 0) {\n * duration.seconds += 1;\n * duration.nanos -= 1000000000;\n * } else if (duration.seconds > 0 && duration.nanos < 0) {\n * duration.seconds -= 1;\n * duration.nanos += 1000000000;\n * }\n *\n * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.\n *\n * Timestamp start = ...;\n * Duration duration = ...;\n * Timestamp end = ...;\n *\n * end.seconds = start.seconds + duration.seconds;\n * end.nanos = start.nanos + duration.nanos;\n *\n * if (end.nanos < 0) {\n * end.seconds -= 1;\n * end.nanos += 1000000000;\n * } else if (end.nanos >= 1000000000) {\n * end.seconds += 1;\n * end.nanos -= 1000000000;\n * }\n *\n * Example 3: Compute Duration from datetime.timedelta in Python.\n *\n * td = datetime.timedelta(days=3, minutes=10)\n * duration = Duration()\n * duration.FromTimedelta(td)\n *\n * # JSON Mapping\n *\n * In JSON format, the Duration type is encoded as a string rather than an\n * object, where the string ends in the suffix \"s\" (indicating seconds) and\n * is preceded by the number of seconds, with nanoseconds expressed as\n * fractional seconds. For example, 3 seconds with 0 nanoseconds should be\n * encoded in JSON format as \"3s\", while 3 seconds and 1 nanosecond should\n * be expressed in JSON format as \"3.000000001s\", and 3 seconds and 1\n * microsecond should be expressed in JSON format as \"3.000001s\".\n *\n *\n * @generated from message google.protobuf.Duration\n */\nexport class Duration extends Message {\n constructor(data) {\n super();\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n *\n * @generated from field: int64 seconds = 1;\n */\n this.seconds = protoInt64.zero;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n *\n * @generated from field: int32 nanos = 2;\n */\n this.nanos = 0;\n proto3.util.initPartial(data, this);\n }\n fromJson(json, options) {\n if (typeof json !== \"string\") {\n throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3.json.debug(json)}`);\n }\n const match = json.match(/^(-?[0-9]+)(?:\\.([0-9]+))?s/);\n if (match === null) {\n throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3.json.debug(json)}`);\n }\n const longSeconds = Number(match[1]);\n if (longSeconds > 315576000000 || longSeconds < -315576000000) {\n throw new Error(`cannot decode google.protobuf.Duration from JSON: ${proto3.json.debug(json)}`);\n }\n this.seconds = protoInt64.parse(longSeconds);\n if (typeof match[2] == \"string\") {\n const nanosStr = match[2] + \"0\".repeat(9 - match[2].length);\n this.nanos = parseInt(nanosStr);\n if (longSeconds < 0 || Object.is(longSeconds, -0)) {\n this.nanos = -this.nanos;\n }\n }\n return this;\n }\n toJson(options) {\n if (Number(this.seconds) > 315576000000 || Number(this.seconds) < -315576000000) {\n throw new Error(`cannot encode google.protobuf.Duration to JSON: value out of range`);\n }\n let text = this.seconds.toString();\n if (this.nanos !== 0) {\n let nanosStr = Math.abs(this.nanos).toString();\n nanosStr = \"0\".repeat(9 - nanosStr.length) + nanosStr;\n if (nanosStr.substring(3) === \"000000\") {\n nanosStr = nanosStr.substring(0, 3);\n }\n else if (nanosStr.substring(6) === \"000\") {\n nanosStr = nanosStr.substring(0, 6);\n }\n text += \".\" + nanosStr;\n if (this.nanos < 0 && Number(this.seconds) == 0) {\n text = \"-\" + text;\n }\n }\n return text + \"s\";\n }\n static fromBinary(bytes, options) {\n return new Duration().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Duration().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Duration().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3.util.equals(Duration, a, b);\n }\n}\nDuration.runtime = proto3;\nDuration.typeName = \"google.protobuf.Duration\";\nDuration.fields = 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","// Copyright 2021-2024 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 { proto3 } from \"../../proto3.js\";\n/**\n * `Any` contains an arbitrary serialized protocol buffer message along with a\n * URL that describes the type of the serialized message.\n *\n * Protobuf library provides support to pack/unpack Any values in the form\n * of utility functions or additional generated methods of the Any type.\n *\n * Example 1: Pack and unpack a message in C++.\n *\n * Foo foo = ...;\n * Any any;\n * any.PackFrom(foo);\n * ...\n * if (any.UnpackTo(&foo)) {\n * ...\n * }\n *\n * Example 2: Pack and unpack a message in Java.\n *\n * Foo foo = ...;\n * Any any = Any.pack(foo);\n * ...\n * if (any.is(Foo.class)) {\n * foo = any.unpack(Foo.class);\n * }\n * // or ...\n * if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n * foo = any.unpack(Foo.getDefaultInstance());\n * }\n *\n * Example 3: Pack and unpack a message in Python.\n *\n * foo = Foo(...)\n * any = Any()\n * any.Pack(foo)\n * ...\n * if any.Is(Foo.DESCRIPTOR):\n * any.Unpack(foo)\n * ...\n *\n * Example 4: Pack and unpack a message in Go\n *\n * foo := &pb.Foo{...}\n * any, err := anypb.New(foo)\n * if err != nil {\n * ...\n * }\n * ...\n * foo := &pb.Foo{}\n * if err := any.UnmarshalTo(foo); err != nil {\n * ...\n * }\n *\n * The pack methods provided by protobuf library will by default use\n * 'type.googleapis.com/full.type.name' as the type URL and the unpack\n * methods only use the fully qualified type name after the last '/'\n * in the type URL, for example \"foo.bar.com/x/y.z\" will yield type\n * name \"y.z\".\n *\n * JSON\n * ====\n * The JSON representation of an `Any` value uses the regular\n * representation of the deserialized, embedded message, with an\n * additional field `@type` which contains the type URL. Example:\n *\n * package google.profile;\n * message Person {\n * string first_name = 1;\n * string last_name = 2;\n * }\n *\n * {\n * \"@type\": \"type.googleapis.com/google.profile.Person\",\n * \"firstName\": ,\n * \"lastName\": \n * }\n *\n * If the embedded message type is well-known and has a custom JSON\n * representation, that representation will be embedded adding a field\n * `value` which holds the custom JSON in addition to the `@type`\n * field. Example (for message [google.protobuf.Duration][]):\n *\n * {\n * \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n * \"value\": \"1.212s\"\n * }\n *\n *\n * @generated from message google.protobuf.Any\n */\nexport class Any extends Message {\n constructor(data) {\n super();\n /**\n * A URL/resource name that uniquely identifies the type of the serialized\n * protocol buffer message. This string must contain at least\n * one \"/\" character. The last segment of the URL's path must represent\n * the fully qualified name of the type (as in\n * `path/google.protobuf.Duration`). The name should be in a canonical form\n * (e.g., leading \".\" is not accepted).\n *\n * In practice, teams usually precompile into the binary all types that they\n * expect it to use in the context of Any. However, for URLs which use the\n * scheme `http`, `https`, or no scheme, one can optionally set up a type\n * server that maps type URLs to message definitions as follows:\n *\n * * If no scheme is provided, `https` is assumed.\n * * An HTTP GET on the URL must yield a [google.protobuf.Type][]\n * value in binary format, or produce an error.\n * * Applications are allowed to cache lookup results based on the\n * URL, or have them precompiled into a binary to avoid any\n * lookup. Therefore, binary compatibility needs to be preserved\n * on changes to types. (Use versioned type names to manage\n * breaking changes.)\n *\n * Note: this functionality is not currently available in the official\n * protobuf release, and it is not used for type URLs beginning with\n * type.googleapis.com. As of May 2023, there are no widely used type server\n * implementations and no plans to implement one.\n *\n * Schemes other than `http`, `https` (or the empty scheme) might be\n * used with implementation specific semantics.\n *\n *\n * @generated from field: string type_url = 1;\n */\n this.typeUrl = \"\";\n /**\n * Must be a valid serialized protocol buffer of the above specified type.\n *\n * @generated from field: bytes value = 2;\n */\n this.value = new Uint8Array(0);\n proto3.util.initPartial(data, this);\n }\n toJson(options) {\n var _a;\n if (this.typeUrl === \"\") {\n return {};\n }\n const typeName = this.typeUrlToName(this.typeUrl);\n const messageType = (_a = options === null || options === void 0 ? void 0 : options.typeRegistry) === null || _a === void 0 ? void 0 : _a.findMessage(typeName);\n if (!messageType) {\n throw new Error(`cannot encode message google.protobuf.Any to JSON: \"${this.typeUrl}\" is not in the type registry`);\n }\n const message = messageType.fromBinary(this.value);\n let json = message.toJson(options);\n if (typeName.startsWith(\"google.protobuf.\") || (json === null || Array.isArray(json) || typeof json !== \"object\")) {\n json = { value: json };\n }\n json[\"@type\"] = this.typeUrl;\n return json;\n }\n fromJson(json, options) {\n var _a;\n if (json === null || Array.isArray(json) || typeof json != \"object\") {\n throw new Error(`cannot decode message google.protobuf.Any from JSON: expected object but got ${json === null ? \"null\" : Array.isArray(json) ? \"array\" : typeof json}`);\n }\n if (Object.keys(json).length == 0) {\n return this;\n }\n const typeUrl = json[\"@type\"];\n if (typeof typeUrl != \"string\" || typeUrl == \"\") {\n throw new Error(`cannot decode message google.protobuf.Any from JSON: \"@type\" is empty`);\n }\n const typeName = this.typeUrlToName(typeUrl), messageType = (_a = options === null || options === void 0 ? void 0 : options.typeRegistry) === null || _a === void 0 ? void 0 : _a.findMessage(typeName);\n if (!messageType) {\n throw new Error(`cannot decode message google.protobuf.Any from JSON: ${typeUrl} is not in the type registry`);\n }\n let message;\n if (typeName.startsWith(\"google.protobuf.\") && Object.prototype.hasOwnProperty.call(json, \"value\")) {\n message = messageType.fromJson(json[\"value\"], options);\n }\n else {\n const copy = Object.assign({}, json);\n delete copy[\"@type\"];\n message = messageType.fromJson(copy, options);\n }\n this.packFrom(message);\n return this;\n }\n packFrom(message) {\n this.value = message.toBinary();\n this.typeUrl = this.typeNameToUrl(message.getType().typeName);\n }\n unpackTo(target) {\n if (!this.is(target.getType())) {\n return false;\n }\n target.fromBinary(this.value);\n return true;\n }\n unpack(registry) {\n if (this.typeUrl === \"\") {\n return undefined;\n }\n const messageType = registry.findMessage(this.typeUrlToName(this.typeUrl));\n if (!messageType) {\n return undefined;\n }\n return messageType.fromBinary(this.value);\n }\n is(type) {\n if (this.typeUrl === '') {\n return false;\n }\n const name = this.typeUrlToName(this.typeUrl);\n let typeName = '';\n if (typeof type === 'string') {\n typeName = type;\n }\n else {\n typeName = type.typeName;\n }\n return name === typeName;\n }\n typeNameToUrl(name) {\n return `type.googleapis.com/${name}`;\n }\n typeUrlToName(url) {\n if (!url.length) {\n throw new Error(`invalid type url: ${url}`);\n }\n const slash = url.lastIndexOf(\"/\");\n const name = slash >= 0 ? url.substring(slash + 1) : url;\n if (!name.length) {\n throw new Error(`invalid type url: ${url}`);\n }\n return name;\n }\n static pack(message) {\n const any = new Any();\n any.packFrom(message);\n return any;\n }\n static fromBinary(bytes, options) {\n return new Any().fromBinary(bytes, options);\n }\n static fromJson(jsonValue, options) {\n return new Any().fromJson(jsonValue, options);\n }\n static fromJsonString(jsonString, options) {\n return new Any().fromJsonString(jsonString, options);\n }\n static equals(a, b) {\n return proto3.util.equals(Any, a, b);\n }\n}\nAny.runtime = proto3;\nAny.typeName = \"google.protobuf.Any\";\nAny.fields = proto3.util.newFieldList(() => [\n { no: 1, name: \"type_url\", kind: \"scalar\", T: 9 /* ScalarType.STRING */ },\n { no: 2, name: \"value\", kind: \"scalar\", T: 12 /* ScalarType.BYTES */ },\n]);\n","// Copyright 2021-2024 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/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 */\nimport { Message } from \"./message.js\";\nimport { isMessage } from \"./is-message.js\";\n/**\n * toPlainMessage returns a new object by stripping\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 *\n * If the argument is already a plain message, it is\n * returned as-is.\n */\nexport function toPlainMessage(message) {\n if (!isMessage(message)) {\n return message;\n }\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}\nfunction toPlainValue(value) {\n if (value === undefined) {\n return value;\n }\n if (isMessage(value)) {\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","// Copyright 2021-2024 The Connect Authors\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 { protoBase64 } from \"@bufbuild/protobuf\";\nimport { ConnectError } from \"./connect-error.js\";\nimport { Code } from \"./code.js\";\n/**\n * Encode a single binary header value according to the Connect\n * and gRPC specifications.\n *\n * This function accepts raw binary data from a buffer, a string\n * with UTF-8 text, or a protobuf message. It encodes the input\n * with unpadded base64 and returns a string that can be used for\n * a header whose name ends with `-bin`.\n */\nexport function encodeBinaryHeader(value) {\n let bytes;\n if (typeof value == \"object\" && \"getType\" in value) {\n bytes = value.toBinary();\n }\n else if (typeof value == \"string\") {\n bytes = new TextEncoder().encode(value);\n }\n else {\n bytes = value instanceof Uint8Array ? value : new Uint8Array(value);\n }\n return protoBase64.enc(bytes).replace(/=+$/, \"\");\n}\nexport function decodeBinaryHeader(value, type, options) {\n try {\n const bytes = protoBase64.dec(value);\n if (type) {\n return type.fromBinary(bytes, options);\n }\n return bytes;\n }\n catch (e) {\n throw ConnectError.from(e, Code.DataLoss);\n }\n}\n/**\n * Merge two or more Headers objects by appending all fields from\n * all inputs to a new Headers object.\n */\nexport function appendHeaders(...headers) {\n const h = new Headers();\n for (const e of headers) {\n e.forEach((value, key) => {\n h.append(key, value);\n });\n }\n return h;\n}\n","// Copyright 2021-2024 The Connect Authors\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 * Create any client for the given service.\n *\n * The given createMethod function is called for each method definition\n * of the service. The function it returns is added to the client object\n * as a method.\n */\nexport function makeAnyClient(service, createMethod) {\n const client = {};\n for (const [localName, methodInfo] of Object.entries(service.methods)) {\n const method = createMethod(Object.assign(Object.assign({}, methodInfo), { localName,\n service }));\n if (method != null) {\n client[localName] = method;\n }\n }\n return client;\n}\n","// Copyright 2021-2024 The Connect Authors\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 { ConnectError } from \"../connect-error.js\";\nimport { Code } from \"../code.js\";\nimport { compressedFlag } from \"./compression.js\";\n/**\n * Create a WHATWG ReadableStream of enveloped messages from a ReadableStream\n * of bytes.\n *\n * Ideally, this would simply be a TransformStream, but ReadableStream.pipeThrough\n * does not have the necessary availability at this time.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function createEnvelopeReadableStream(stream) {\n let reader;\n let buffer = new Uint8Array(0);\n function append(chunk) {\n const n = new Uint8Array(buffer.length + chunk.length);\n n.set(buffer);\n n.set(chunk, buffer.length);\n buffer = n;\n }\n return new ReadableStream({\n start() {\n reader = stream.getReader();\n },\n async pull(controller) {\n let header = undefined;\n for (;;) {\n if (header === undefined && buffer.byteLength >= 5) {\n let length = 0;\n for (let i = 1; i < 5; i++) {\n length = (length << 8) + buffer[i];\n }\n header = { flags: buffer[0], length };\n }\n if (header !== undefined && buffer.byteLength >= header.length + 5) {\n break;\n }\n const result = await reader.read();\n if (result.done) {\n break;\n }\n append(result.value);\n }\n if (header === undefined) {\n if (buffer.byteLength == 0) {\n controller.close();\n return;\n }\n controller.error(new ConnectError(\"premature end of stream\", Code.DataLoss));\n return;\n }\n const data = buffer.subarray(5, 5 + header.length);\n buffer = buffer.subarray(5 + header.length);\n controller.enqueue({\n flags: header.flags,\n data,\n });\n },\n });\n}\n/**\n * Compress an EnvelopedMessage.\n *\n * Raises Internal if an enveloped message is already compressed.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport async function envelopeCompress(envelope, compression, compressMinBytes) {\n let { flags, data } = envelope;\n if ((flags & compressedFlag) === compressedFlag) {\n throw new ConnectError(\"invalid envelope, already compressed\", Code.Internal);\n }\n if (compression && data.byteLength >= compressMinBytes) {\n data = await compression.compress(data);\n flags = flags | compressedFlag;\n }\n return { data, flags };\n}\n/**\n * Decompress an EnvelopedMessage.\n *\n * Raises InvalidArgument if an envelope is compressed, but compression is null.\n *\n * Relies on the provided Compression to raise ResourceExhausted if the\n * *decompressed* message size is larger than readMaxBytes. If the envelope is\n * not compressed, readMaxBytes is not honored.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport async function envelopeDecompress(envelope, compression, readMaxBytes) {\n let { flags, data } = envelope;\n if ((flags & compressedFlag) === compressedFlag) {\n if (!compression) {\n throw new ConnectError(\"received compressed envelope, but do not know how to decompress\", Code.InvalidArgument);\n }\n data = await compression.decompress(data, readMaxBytes);\n flags = flags ^ compressedFlag;\n }\n return { data, flags };\n}\n/**\n * Encode a single enveloped message.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function encodeEnvelope(flags, data) {\n const bytes = new Uint8Array(data.length + 5);\n bytes.set(data, 5);\n const v = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);\n v.setUint8(0, flags); // first byte is flags\n v.setUint32(1, data.length); // 4 bytes message length\n return bytes;\n}\n/**\n * Encode a set of enveloped messages.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function encodeEnvelopes(...envelopes) {\n const len = envelopes.reduce((previousValue, currentValue) => previousValue + currentValue.data.length + 5, 0);\n const bytes = new Uint8Array(len);\n const v = new DataView(bytes.buffer);\n let offset = 0;\n for (const e of envelopes) {\n v.setUint8(offset, e.flags); // first byte is flags\n v.setUint32(offset + 1, e.data.length); // 4 bytes message length\n bytes.set(e.data, offset + 5);\n offset += e.data.length + 5;\n }\n return bytes;\n}\n","// Copyright 2021-2024 The Connect Authors\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\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\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};\nvar __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n};\nimport { Code } from \"../code.js\";\nimport { ConnectError } from \"../connect-error.js\";\nimport { encodeEnvelope, envelopeCompress, envelopeDecompress, } from \"./envelope.js\";\nimport { assertReadMaxBytes } from \"./limit-io.js\";\nexport function pipeTo(source, ...rest) {\n const [transforms, sink, opt] = pickTransformsAndSink(rest);\n let iterable = source;\n let abortable;\n if ((opt === null || opt === void 0 ? void 0 : opt.propagateDownStreamError) === true) {\n iterable = abortable = makeIterableAbortable(iterable);\n }\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n iterable = pipe(iterable, ...transforms, { propagateDownStreamError: false });\n return sink(iterable).catch((reason) => {\n if (abortable) {\n return abortable.abort(reason).then(() => Promise.reject(reason));\n }\n return Promise.reject(reason);\n });\n}\n// pick transforms, the sink, and options from the pipeTo() rest parameter\nfunction pickTransformsAndSink(rest) {\n let opt;\n if (typeof rest[rest.length - 1] != \"function\") {\n opt = rest.pop();\n }\n const sink = rest.pop();\n return [rest, sink, opt];\n}\n/**\n * Creates an AsyncIterableSink that concatenates all elements from the input.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function sinkAll() {\n return async function (iterable) {\n var _a, e_1, _b, _c;\n const all = [];\n try {\n for (var _d = true, iterable_1 = __asyncValues(iterable), iterable_1_1; iterable_1_1 = 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 all.push(chunk);\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)) await _b.call(iterable_1);\n }\n finally { if (e_1) throw e_1.error; }\n }\n return all;\n };\n}\n/**\n * Creates an AsyncIterableSink that concatenates all chunks from the input into\n * a single Uint8Array.\n *\n * The iterable raises an error if the more than readMaxBytes are read.\n *\n * An optional length hint can be provided to optimize allocation and validation.\n * If more or less bytes are present in the source that the length hint indicates,\n * and error is raised.\n * If the length hint is larger than readMaxBytes, an error is raised.\n * If the length hint is not a positive integer, it is ignored.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function sinkAllBytes(readMaxBytes, lengthHint) {\n return async function (iterable) {\n return await readAllBytes(iterable, readMaxBytes, lengthHint);\n };\n}\nexport function pipe(source, ...rest) {\n var _a;\n return __asyncGenerator(this, arguments, function* pipe_1() {\n const [transforms, opt] = pickTransforms(rest);\n let abortable;\n const sourceIt = source[Symbol.asyncIterator]();\n const cachedSource = {\n [Symbol.asyncIterator]() {\n return sourceIt;\n },\n };\n let iterable = cachedSource;\n if ((opt === null || opt === void 0 ? void 0 : opt.propagateDownStreamError) === true) {\n iterable = abortable = makeIterableAbortable(iterable);\n }\n for (const t of transforms) {\n iterable = t(iterable);\n }\n const it = iterable[Symbol.asyncIterator]();\n try {\n for (;;) {\n const r = yield __await(it.next());\n if (r.done === true) {\n break;\n }\n if (!abortable) {\n yield yield __await(r.value);\n continue;\n }\n try {\n yield yield __await(r.value);\n }\n catch (e) {\n yield __await(abortable.abort(e)); // propagate downstream error to the source\n throw e;\n }\n }\n }\n finally {\n if ((opt === null || opt === void 0 ? void 0 : opt.propagateDownStreamError) === true) {\n // Call return on the source iterable to indicate\n // that we will no longer consume it and it should\n // cleanup any allocated resources.\n (_a = sourceIt.return) === null || _a === void 0 ? void 0 : _a.call(sourceIt).catch(() => {\n // return returns a promise, which we don't care about.\n //\n // Uncaught promises are thrown at sometime/somewhere by the event loop,\n // this is to ensure error is caught and ignored.\n });\n }\n }\n });\n}\nfunction pickTransforms(rest) {\n let opt;\n if (typeof rest[rest.length - 1] != \"function\") {\n opt = rest.pop();\n }\n return [rest, opt];\n}\n/**\n * Creates an AsyncIterableTransform that catches any error from the input, and\n * passes it to the given catchError function.\n *\n * The catchError function may return a final value.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformCatch(catchError) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n // we deliberate avoid a for-await loop because we only want to catch upstream\n // errors, not downstream errors (yield).\n const it = iterable[Symbol.asyncIterator]();\n for (;;) {\n let r;\n try {\n r = yield __await(it.next());\n }\n catch (e) {\n const caught = yield __await(catchError(e));\n if (caught !== undefined) {\n yield yield __await(caught);\n }\n break;\n }\n if (r.done === true) {\n break;\n }\n yield yield __await(r.value);\n }\n });\n };\n}\n/**\n * Creates an AsyncIterableTransform that catches any error from the input, and\n * passes it to the given function. Unlike transformCatch(), the given function\n * is also called when no error is raised.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformCatchFinally(catchFinally) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n // we deliberate avoid a for-await loop because we only want to catch upstream\n // errors, not downstream errors (yield).\n let err;\n const it = iterable[Symbol.asyncIterator]();\n for (;;) {\n let r;\n try {\n r = yield __await(it.next());\n }\n catch (e) {\n err = e;\n break;\n }\n if (r.done === true) {\n break;\n }\n yield yield __await(r.value);\n }\n const caught = yield __await(catchFinally(err));\n if (caught !== undefined) {\n yield yield __await(caught);\n }\n });\n };\n}\n/**\n * Creates an AsyncIterableTransform that appends a value.\n *\n * The element to append is provided by a function. If the function returns\n * undefined, no element is appended.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformAppend(provide) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_2, _b, _c;\n try {\n for (var _d = true, iterable_2 = __asyncValues(iterable), iterable_2_1; iterable_2_1 = yield __await(iterable_2.next()), _a = iterable_2_1.done, !_a; _d = true) {\n _c = iterable_2_1.value;\n _d = false;\n const chunk = _c;\n yield yield __await(chunk);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_2.return)) yield __await(_b.call(iterable_2));\n }\n finally { if (e_2) throw e_2.error; }\n }\n const append = yield __await(provide());\n if (append !== undefined) {\n yield yield __await(append);\n }\n });\n };\n}\n/**\n * Creates an AsyncIterableTransform that prepends an element.\n *\n * The element to prepend is provided by a function. If the function returns\n * undefined, no element is appended.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformPrepend(provide) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_3, _b, _c;\n const prepend = yield __await(provide());\n if (prepend !== undefined) {\n yield yield __await(prepend);\n }\n try {\n for (var _d = true, iterable_3 = __asyncValues(iterable), iterable_3_1; iterable_3_1 = yield __await(iterable_3.next()), _a = iterable_3_1.done, !_a; _d = true) {\n _c = iterable_3_1.value;\n _d = false;\n const chunk = _c;\n yield yield __await(chunk);\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_3.return)) yield __await(_b.call(iterable_3));\n }\n finally { if (e_3) throw e_3.error; }\n }\n });\n };\n}\n/**\n * Creates an AsyncIterableTransform that reads all bytes from the input, and\n * concatenates them to a single Uint8Array.\n *\n * The iterable raises an error if the more than readMaxBytes are read.\n *\n * An optional length hint can be provided to optimize allocation and validation.\n * If more or less bytes are present in the source that the length hint indicates,\n * and error is raised.\n * If the length hint is larger than readMaxBytes, an error is raised.\n * If the length hint is not a positive integer, it is ignored.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformReadAllBytes(readMaxBytes, lengthHint) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n yield yield __await(yield __await(readAllBytes(iterable, readMaxBytes, lengthHint)));\n });\n };\n}\nexport function transformSerializeEnvelope(serialization, endStreamFlag, endSerialization) {\n if (endStreamFlag === undefined || endSerialization === undefined) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_4, _b, _c;\n try {\n for (var _d = true, iterable_4 = __asyncValues(iterable), iterable_4_1; iterable_4_1 = yield __await(iterable_4.next()), _a = iterable_4_1.done, !_a; _d = true) {\n _c = iterable_4_1.value;\n _d = false;\n const chunk = _c;\n const data = serialization.serialize(chunk);\n yield yield __await({ flags: 0, data });\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_4.return)) yield __await(_b.call(iterable_4));\n }\n finally { if (e_4) throw e_4.error; }\n }\n });\n };\n }\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_5, _b, _c;\n try {\n for (var _d = true, iterable_5 = __asyncValues(iterable), iterable_5_1; iterable_5_1 = yield __await(iterable_5.next()), _a = iterable_5_1.done, !_a; _d = true) {\n _c = iterable_5_1.value;\n _d = false;\n const chunk = _c;\n let data;\n let flags = 0;\n if (chunk.end) {\n flags = flags | endStreamFlag;\n data = endSerialization.serialize(chunk.value);\n }\n else {\n data = serialization.serialize(chunk.value);\n }\n yield yield __await({ flags, data });\n }\n }\n catch (e_5_1) { e_5 = { error: e_5_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_5.return)) yield __await(_b.call(iterable_5));\n }\n finally { if (e_5) throw e_5.error; }\n }\n });\n };\n}\nexport function transformParseEnvelope(serialization, endStreamFlag, endSerialization) {\n // code path always yields ParsedEnvelopedMessage\n if (endSerialization && endStreamFlag !== undefined) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_6, _b, _c;\n try {\n for (var _d = true, iterable_6 = __asyncValues(iterable), iterable_6_1; iterable_6_1 = yield __await(iterable_6.next()), _a = iterable_6_1.done, !_a; _d = true) {\n _c = iterable_6_1.value;\n _d = false;\n const { flags, data } = _c;\n if ((flags & endStreamFlag) === endStreamFlag) {\n yield yield __await({ value: endSerialization.parse(data), end: true });\n }\n else {\n yield yield __await({ value: serialization.parse(data), end: false });\n }\n }\n }\n catch (e_6_1) { e_6 = { error: e_6_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_6.return)) yield __await(_b.call(iterable_6));\n }\n finally { if (e_6) throw e_6.error; }\n }\n });\n };\n }\n // code path always yields T\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_7, _b, _c;\n try {\n for (var _d = true, iterable_7 = __asyncValues(iterable), iterable_7_1; iterable_7_1 = yield __await(iterable_7.next()), _a = iterable_7_1.done, !_a; _d = true) {\n _c = iterable_7_1.value;\n _d = false;\n const { flags, data } = _c;\n if (endStreamFlag !== undefined &&\n (flags & endStreamFlag) === endStreamFlag) {\n if (endSerialization === null) {\n throw new ConnectError(\"unexpected end flag\", Code.InvalidArgument);\n }\n // skips end-of-stream envelope\n continue;\n }\n yield yield __await(serialization.parse(data));\n }\n }\n catch (e_7_1) { e_7 = { error: e_7_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_7.return)) yield __await(_b.call(iterable_7));\n }\n finally { if (e_7) throw e_7.error; }\n }\n });\n };\n}\n/**\n * Creates an AsyncIterableTransform that takes enveloped messages as a source,\n * and compresses them if they are larger than compressMinBytes.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformCompressEnvelope(compression, compressMinBytes) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_8, _b, _c;\n try {\n for (var _d = true, iterable_8 = __asyncValues(iterable), iterable_8_1; iterable_8_1 = yield __await(iterable_8.next()), _a = iterable_8_1.done, !_a; _d = true) {\n _c = iterable_8_1.value;\n _d = false;\n const env = _c;\n yield yield __await(yield __await(envelopeCompress(env, compression, compressMinBytes)));\n }\n }\n catch (e_8_1) { e_8 = { error: e_8_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_8.return)) yield __await(_b.call(iterable_8));\n }\n finally { if (e_8) throw e_8.error; }\n }\n });\n };\n}\n/**\n * Creates an AsyncIterableTransform that takes enveloped messages as a source,\n * and decompresses them using the given compression.\n *\n * The iterable raises an error if the decompressed payload of an enveloped\n * message is larger than readMaxBytes, or if no compression is provided.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformDecompressEnvelope(compression, readMaxBytes) {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_9, _b, _c;\n try {\n for (var _d = true, iterable_9 = __asyncValues(iterable), iterable_9_1; iterable_9_1 = yield __await(iterable_9.next()), _a = iterable_9_1.done, !_a; _d = true) {\n _c = iterable_9_1.value;\n _d = false;\n const env = _c;\n yield yield __await(yield __await(envelopeDecompress(env, compression, readMaxBytes)));\n }\n }\n catch (e_9_1) { e_9 = { error: e_9_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_9.return)) yield __await(_b.call(iterable_9));\n }\n finally { if (e_9) throw e_9.error; }\n }\n });\n };\n}\n/**\n * Create an AsyncIterableTransform that takes enveloped messages as a source,\n * and joins them into a stream of raw bytes.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformJoinEnvelopes() {\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_10, _b, _c;\n try {\n for (var _d = true, iterable_10 = __asyncValues(iterable), iterable_10_1; iterable_10_1 = yield __await(iterable_10.next()), _a = iterable_10_1.done, !_a; _d = true) {\n _c = iterable_10_1.value;\n _d = false;\n const { flags, data } = _c;\n yield yield __await(encodeEnvelope(flags, data));\n }\n }\n catch (e_10_1) { e_10 = { error: e_10_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_10.return)) yield __await(_b.call(iterable_10));\n }\n finally { if (e_10) throw e_10.error; }\n }\n });\n };\n}\n/**\n * Create an AsyncIterableTransform that takes raw bytes as a source, and splits\n * them into enveloped messages.\n *\n * The iterable raises an error\n * - if the payload of an enveloped message is larger than readMaxBytes,\n * - if the stream ended before an enveloped message fully arrived,\n * - or if the stream ended with extraneous data.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformSplitEnvelope(readMaxBytes) {\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 // tuple 0: envelope, or undefined if incomplete\n // tuple 1: remainder of the buffer\n function shiftEnvelope(buffer, header) {\n if (buffer.byteLength < 5 + header.length) {\n return [undefined, buffer];\n }\n return [\n { flags: header.flags, data: buffer.subarray(5, 5 + header.length) },\n buffer.subarray(5 + header.length),\n ];\n }\n // undefined: header is incomplete\n function peekHeader(buffer) {\n if (buffer.byteLength < 5) {\n return undefined;\n }\n const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);\n const length = view.getUint32(1); // 4 bytes message length\n const flags = view.getUint8(0); // first byte is flags\n return { length, flags };\n }\n return function (iterable) {\n return __asyncGenerator(this, arguments, function* () {\n var _a, e_11, _b, _c;\n let buffer = new Uint8Array(0);\n try {\n for (var _d = true, iterable_11 = __asyncValues(iterable), iterable_11_1; iterable_11_1 = yield __await(iterable_11.next()), _a = iterable_11_1.done, !_a; _d = true) {\n _c = iterable_11_1.value;\n _d = false;\n const chunk = _c;\n buffer = append(buffer, chunk);\n for (;;) {\n const header = peekHeader(buffer);\n if (!header) {\n break;\n }\n assertReadMaxBytes(readMaxBytes, header.length, true);\n let env;\n [env, buffer] = shiftEnvelope(buffer, header);\n if (!env) {\n break;\n }\n yield yield __await(env);\n }\n }\n }\n catch (e_11_1) { e_11 = { error: e_11_1 }; }\n finally {\n try {\n if (!_d && !_a && (_b = iterable_11.return)) yield __await(_b.call(iterable_11));\n }\n finally { if (e_11) throw e_11.error; }\n }\n if (buffer.byteLength > 0) {\n const header = peekHeader(buffer);\n let message = \"protocol error: incomplete envelope\";\n if (header) {\n message = `protocol error: promised ${header.length} bytes in enveloped message, got ${buffer.byteLength - 5} bytes`;\n }\n throw new ConnectError(message, Code.InvalidArgument);\n }\n });\n };\n}\n/**\n * Reads all bytes from the source, and concatenates them to a single Uint8Array.\n *\n * Raises an error if:\n * - more than readMaxBytes are read\n * - lengthHint is a positive integer, but larger than readMaxBytes\n * - lengthHint is a positive integer, and the source contains more or less bytes\n * than promised\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport async function readAllBytes(iterable, readMaxBytes, lengthHint) {\n var _a, e_12, _b, _c, _d, e_13, _e, _f;\n const [ok, hint] = parseLengthHint(lengthHint);\n if (ok) {\n if (hint > readMaxBytes) {\n assertReadMaxBytes(readMaxBytes, hint, true);\n }\n const buffer = new Uint8Array(hint);\n let offset = 0;\n try {\n for (var _g = true, iterable_12 = __asyncValues(iterable), iterable_12_1; iterable_12_1 = await iterable_12.next(), _a = iterable_12_1.done, !_a; _g = true) {\n _c = iterable_12_1.value;\n _g = false;\n const chunk = _c;\n if (offset + chunk.byteLength > hint) {\n throw new ConnectError(`protocol error: promised ${hint} bytes, received ${offset + chunk.byteLength}`, Code.InvalidArgument);\n }\n buffer.set(chunk, offset);\n offset += chunk.byteLength;\n }\n }\n catch (e_12_1) { e_12 = { error: e_12_1 }; }\n finally {\n try {\n if (!_g && !_a && (_b = iterable_12.return)) await _b.call(iterable_12);\n }\n finally { if (e_12) throw e_12.error; }\n }\n if (offset < hint) {\n throw new ConnectError(`protocol error: promised ${hint} bytes, received ${offset}`, Code.InvalidArgument);\n }\n return buffer;\n }\n const chunks = [];\n let count = 0;\n try {\n for (var _h = true, iterable_13 = __asyncValues(iterable), iterable_13_1; iterable_13_1 = await iterable_13.next(), _d = iterable_13_1.done, !_d; _h = true) {\n _f = iterable_13_1.value;\n _h = false;\n const chunk = _f;\n count += chunk.byteLength;\n assertReadMaxBytes(readMaxBytes, count);\n chunks.push(chunk);\n }\n }\n catch (e_13_1) { e_13 = { error: e_13_1 }; }\n finally {\n try {\n if (!_h && !_d && (_e = iterable_13.return)) await _e.call(iterable_13);\n }\n finally { if (e_13) throw e_13.error; }\n }\n const all = new Uint8Array(count);\n let offset = 0;\n for (let chunk = chunks.shift(); chunk; chunk = chunks.shift()) {\n all.set(chunk, offset);\n offset += chunk.byteLength;\n }\n return all;\n}\n// parse the lengthHint argument of readAllBytes()\nfunction parseLengthHint(lengthHint) {\n if (lengthHint === undefined || lengthHint === null) {\n return [false, 0];\n }\n const n = typeof lengthHint == \"string\" ? parseInt(lengthHint, 10) : lengthHint;\n if (!Number.isSafeInteger(n) || n < 0) {\n return [false, n];\n }\n return [true, n];\n}\n/**\n * Wait for the first element of an iterable without modifying the iterable.\n * This consumes the first element, but pushes it back on the stack.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport async function untilFirst(iterable) {\n const it = iterable[Symbol.asyncIterator]();\n let first = await it.next();\n return {\n [Symbol.asyncIterator]() {\n const w = {\n async next() {\n if (first !== null) {\n const n = first;\n first = null;\n return n;\n }\n return await it.next();\n },\n };\n if (it.throw !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- can't handle mutated object sensibly\n w.throw = (e) => it.throw(e);\n }\n if (it.return !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion,@typescript-eslint/no-explicit-any -- can't handle mutated object sensibly\n w.return = (value) => it.return(value);\n }\n return w;\n },\n };\n}\n/**\n * Wrap the given iterable and return an iterable with an abort() method.\n *\n * This function exists purely for convenience. Where one would typically have\n * to access the iterator directly, advance through all elements, and call\n * AsyncIterator.throw() to notify the upstream iterable, this function allows\n * to use convenient for-await loops and still notify the upstream iterable:\n *\n * ```ts\n * const abortable = makeIterableAbortable(iterable);\n * for await (const ele of abortable) {\n * await abortable.abort(\"ERR\");\n * }\n * ```\n * There are a couple of limitations of this function:\n * - the given async iterable must implement throw\n * - the async iterable cannot be re-use\n * - if source catches errors and yields values for them, they are ignored, and\n * the source may still dangle\n *\n * There are four possible ways an async function* can handle yield errors:\n * 1. don't catch errors at all - Abortable.abort() will resolve \"rethrown\"\n * 2. catch errors and rethrow - Abortable.abort() will resolve \"rethrown\"\n * 3. catch errors and return - Abortable.abort() will resolve \"completed\"\n * 4. catch errors and yield a value - Abortable.abort() will resolve \"caught\"\n *\n * Note that catching errors and yielding a value is problematic, and it should\n * be documented that this may leave the source in a dangling state.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function makeIterableAbortable(iterable) {\n const innerCandidate = iterable[Symbol.asyncIterator]();\n if (innerCandidate.throw === undefined) {\n throw new Error(\"AsyncIterable does not implement throw\");\n }\n const inner = innerCandidate;\n let aborted;\n let resultPromise;\n let it = {\n next() {\n resultPromise = inner.next().finally(() => {\n resultPromise = undefined;\n });\n return resultPromise;\n },\n throw(e) {\n return inner.throw(e);\n },\n };\n if (innerCandidate.return !== undefined) {\n it = Object.assign(Object.assign({}, it), { return(value) {\n return inner.return(value);\n } });\n }\n let used = false;\n return {\n abort(reason) {\n if (aborted) {\n return aborted.state;\n }\n const f = () => {\n return inner.throw(reason).then((r) => (r.done === true ? \"completed\" : \"caught\"), () => \"rethrown\");\n };\n if (resultPromise) {\n aborted = { reason, state: resultPromise.then(f, f) };\n return aborted.state;\n }\n aborted = { reason, state: f() };\n return aborted.state;\n },\n [Symbol.asyncIterator]() {\n if (used) {\n throw new Error(\"AsyncIterable cannot be re-used\");\n }\n used = true;\n return it;\n },\n };\n}\n/**\n * Create a new WritableIterable.\n */\nexport function createWritableIterable() {\n // We start with two queues to capture the read and write attempts.\n //\n // The writes and reads each check of their counterpart is\n // already available and either interact/add themselves to the queue.\n const readQueue = [];\n const writeQueue = [];\n let err = undefined;\n let nextResolve;\n let nextReject;\n let nextPromise = new Promise((resolve, reject) => {\n nextResolve = resolve;\n nextReject = reject;\n });\n let closed = false;\n // drain the readQueue in case of error/writer is closed by sending a\n // done result.\n function drain() {\n for (const next of readQueue.splice(0, readQueue.length)) {\n next({ done: true, value: undefined });\n }\n }\n return {\n close() {\n closed = true;\n drain();\n },\n async write(payload) {\n if (closed) {\n throw err !== null && err !== void 0 ? err : new Error(\"cannot write, WritableIterable already closed\");\n }\n const read = readQueue.shift();\n if (read === undefined) {\n // We didn't find a pending read so we add the payload to the write queue.\n writeQueue.push(payload);\n }\n else {\n // We found a pending read so we respond with the payload.\n read({ done: false, value: payload });\n if (readQueue.length > 0) {\n // If there are more in the read queue we can mark the write as complete.\n // as the error reporting is not guaranteed to be sequential and therefore cannot\n // to linked to a specific write.\n return;\n }\n }\n // We await the next call for as many times as there are items in the queue + 1\n //\n // If there are no items in the write queue that means write happened and we just have\n // to wait for one more call likewise if we are the nth write in the queue we\n // have to wait for n writes to complete and one more.\n const limit = writeQueue.length + 1;\n for (let i = 0; i < limit; i++) {\n await nextPromise;\n }\n },\n [Symbol.asyncIterator]() {\n return {\n next() {\n // Resolve the nextPromise to indicate\n // pending writes that a read attempt has been made\n // after their write.\n //\n // We also need to reset the promise for future writes.\n nextResolve();\n nextPromise = new Promise((resolve, reject) => {\n nextResolve = resolve;\n nextReject = reject;\n });\n const write = writeQueue.shift();\n if (write !== undefined) {\n // We found a pending write so response with the payload.\n return Promise.resolve({ done: false, value: write });\n }\n if (closed) {\n return Promise.resolve({ done: true, value: undefined });\n }\n // We return a promise immediately that is either resolved/rejected\n // as writes happen.\n let readResolve;\n const readPromise = new Promise((resolve) => (readResolve = resolve));\n readQueue.push(readResolve); // eslint-disable-line @typescript-eslint/no-non-null-assertion\n return readPromise;\n },\n throw(throwErr) {\n err = throwErr;\n closed = true;\n writeQueue.splice(0, writeQueue.length);\n nextPromise.catch(() => {\n // To make sure that the nextPromise is always resolved.\n });\n // This will reject all pending writes.\n nextReject(err);\n drain();\n return Promise.resolve({ done: true, value: undefined });\n },\n return() {\n closed = true;\n writeQueue.splice(0, writeQueue.length);\n // Resolve once for the write awaiting confirmation.\n nextResolve();\n // Reject all future writes.\n nextPromise = Promise.reject(new Error(\"cannot write, consumer called return\"));\n nextPromise.catch(() => {\n // To make sure that the nextPromise is always resolved.\n });\n drain();\n return Promise.resolve({ done: true, value: undefined });\n },\n };\n },\n };\n}\n/**\n * Create an asynchronous iterable from an array.\n *\n * @private Internal code, does not follow semantic versioning.\n */\n// eslint-disable-next-line @typescript-eslint/require-await\nexport function createAsyncIterable(items) {\n return __asyncGenerator(this, arguments, function* createAsyncIterable_1() {\n yield __await(yield* __asyncDelegator(__asyncValues(items)));\n });\n}\n","// Copyright 2021-2024 The Connect Authors\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 __asyncDelegator = (this && this.__asyncDelegator) || function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n};\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\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\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};\nimport { Message, MethodKind } from \"@bufbuild/protobuf\";\nimport { makeAnyClient } from \"./any-client.js\";\nimport { ConnectError } from \"./connect-error.js\";\nimport { Code } from \"./code.js\";\nimport { createAsyncIterable } from \"./protocol/async-iterable.js\";\n/**\n * Create a PromiseClient for the given service, invoking RPCs through the\n * given transport.\n */\nexport function createPromiseClient(service, transport) {\n return makeAnyClient(service, (method) => {\n switch (method.kind) {\n case MethodKind.Unary:\n return createUnaryFn(transport, service, method);\n case MethodKind.ServerStreaming:\n return createServerStreamingFn(transport, service, method);\n case MethodKind.ClientStreaming:\n return createClientStreamingFn(transport, service, method);\n case MethodKind.BiDiStreaming:\n return createBiDiStreamingFn(transport, service, method);\n default:\n return null;\n }\n });\n}\nexport function createUnaryFn(transport, service, method) {\n return async function (input, options) {\n var _a, _b;\n const response = await transport.unary(service, method, options === null || options === void 0 ? void 0 : options.signal, options === null || options === void 0 ? void 0 : options.timeoutMs, options === null || options === void 0 ? void 0 : options.headers, input, options === null || options === void 0 ? void 0 : options.contextValues);\n (_a = options === null || options === void 0 ? void 0 : options.onHeader) === null || _a === void 0 ? void 0 : _a.call(options, response.header);\n (_b = options === null || options === void 0 ? void 0 : options.onTrailer) === null || _b === void 0 ? void 0 : _b.call(options, response.trailer);\n return response.message;\n };\n}\nexport function createServerStreamingFn(transport, service, method) {\n return function (input, options) {\n return handleStreamResponse(transport.stream(service, method, options === null || options === void 0 ? void 0 : options.signal, options === null || options === void 0 ? void 0 : options.timeoutMs, options === null || options === void 0 ? void 0 : options.headers, createAsyncIterable([input]), options === null || options === void 0 ? void 0 : options.contextValues), options);\n };\n}\nexport function createClientStreamingFn(transport, service, method) {\n return async function (request, options) {\n var _a, e_1, _b, _c;\n var _d, _e;\n const response = await transport.stream(service, method, options === null || options === void 0 ? void 0 : options.signal, options === null || options === void 0 ? void 0 : options.timeoutMs, options === null || options === void 0 ? void 0 : options.headers, request, options === null || options === void 0 ? void 0 : options.contextValues);\n (_d = options === null || options === void 0 ? void 0 : options.onHeader) === null || _d === void 0 ? void 0 : _d.call(options, response.header);\n let singleMessage;\n try {\n for (var _f = true, _g = __asyncValues(response.message), _h; _h = await _g.next(), _a = _h.done, !_a; _f = true) {\n _c = _h.value;\n _f = false;\n const message = _c;\n singleMessage = message;\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (!_f && !_a && (_b = _g.return)) await _b.call(_g);\n }\n finally { if (e_1) throw e_1.error; }\n }\n if (!singleMessage) {\n throw new ConnectError(\"protocol error: missing response message\", Code.Internal);\n }\n (_e = options === null || options === void 0 ? void 0 : options.onTrailer) === null || _e === void 0 ? void 0 : _e.call(options, response.trailer);\n return singleMessage;\n };\n}\nexport function createBiDiStreamingFn(transport, service, method) {\n return function (request, options) {\n return handleStreamResponse(transport.stream(service, method, options === null || options === void 0 ? void 0 : options.signal, options === null || options === void 0 ? void 0 : options.timeoutMs, options === null || options === void 0 ? void 0 : options.headers, request, options === null || options === void 0 ? void 0 : options.contextValues), options);\n };\n}\nfunction handleStreamResponse(stream, options) {\n const it = (function () {\n var _a, _b;\n return __asyncGenerator(this, arguments, function* () {\n const response = yield __await(stream);\n (_a = options === null || options === void 0 ? void 0 : options.onHeader) === null || _a === void 0 ? void 0 : _a.call(options, response.header);\n yield __await(yield* __asyncDelegator(__asyncValues(response.message)));\n (_b = options === null || options === void 0 ? void 0 : options.onTrailer) === null || _b === void 0 ? void 0 : _b.call(options, response.trailer);\n });\n })()[Symbol.asyncIterator]();\n // Create a new iterable to omit throw/return.\n return {\n [Symbol.asyncIterator]: () => ({\n next: () => it.next(),\n }),\n };\n}\n","// Copyright 2021-2024 The Connect Authors\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 { ConnectError } from \"../connect-error.js\";\nimport { Code } from \"../code.js\";\n/**\n * Create an AbortController that is automatically aborted if one of the given\n * signals is aborted.\n *\n * For convenience, the linked AbortSignals can be undefined.\n *\n * If the controller or any of the signals is aborted, all event listeners are\n * removed.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function createLinkedAbortController(...signals) {\n const controller = new AbortController();\n const sa = signals\n .filter((s) => s !== undefined)\n .concat(controller.signal);\n for (const signal of sa) {\n if (signal.aborted) {\n onAbort.apply(signal);\n break;\n }\n signal.addEventListener(\"abort\", onAbort);\n }\n function onAbort() {\n if (!controller.signal.aborted) {\n controller.abort(getAbortSignalReason(this));\n }\n for (const signal of sa) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n return controller;\n}\n/**\n * Create a deadline signal. The returned object contains an AbortSignal, but\n * also a cleanup function to stop the timer, which must be called once the\n * calling code is no longer interested in the signal.\n *\n * Ideally, we would simply use AbortSignal.timeout(), but it is not widely\n * available yet.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function createDeadlineSignal(timeoutMs) {\n const controller = new AbortController();\n const listener = () => {\n controller.abort(new ConnectError(\"the operation timed out\", Code.DeadlineExceeded));\n };\n let timeoutId;\n if (timeoutMs !== undefined) {\n if (timeoutMs <= 0)\n listener();\n else\n timeoutId = setTimeout(listener, timeoutMs);\n }\n return {\n signal: controller.signal,\n cleanup: () => clearTimeout(timeoutId),\n };\n}\n/**\n * Returns the reason why an AbortSignal was aborted. Returns undefined if the\n * signal has not been aborted.\n *\n * The property AbortSignal.reason is not widely available. This function\n * returns an AbortError if the signal is aborted, but reason is undefined.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function getAbortSignalReason(signal) {\n if (!signal.aborted) {\n return undefined;\n }\n if (signal.reason !== undefined) {\n return signal.reason;\n }\n // AbortSignal.reason is available in Node.js v16, v18, and later,\n // and in all browsers since early 2022.\n const e = new Error(\"This operation was aborted\");\n e.name = \"AbortError\";\n return e;\n}\n","// Copyright 2021-2024 The Connect Authors\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 * createContextValues creates a new ContextValues.\n */\nexport function createContextValues() {\n return {\n get(key) {\n return key.id in this ? this[key.id] : key.defaultValue;\n },\n set(key, value) {\n this[key.id] = value;\n return this;\n },\n delete(key) {\n delete this[key.id];\n return this;\n },\n };\n}\n/**\n * createContextKey creates a new ContextKey.\n */\nexport function createContextKey(defaultValue, options) {\n return { id: Symbol(options === null || options === void 0 ? void 0 : options.description), defaultValue };\n}\n","// Copyright 2021-2024 The Connect Authors\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 * Create a URL for the given RPC. This simply adds the qualified\n * service name, a slash, and the method name to the path of the given\n * baseUrl.\n *\n * For example, the baseUri https://example.com and method \"Say\" from\n * the service example.ElizaService results in:\n * https://example.com/example.ElizaService/Say\n *\n * This format is used by the protocols Connect, gRPC and Twirp.\n *\n * Note that this function also accepts a protocol-relative baseUrl.\n * If given an empty string or \"/\" as a baseUrl, it returns just the\n * path.\n */\nexport function createMethodUrl(baseUrl, service, method) {\n const s = typeof service == \"string\" ? service : service.typeName;\n const m = typeof method == \"string\" ? method : method.name;\n return baseUrl.toString().replace(/\\/?$/, `/${s}/${m}`);\n}\n","// Copyright 2021-2024 The Connect Authors\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 \"@bufbuild/protobuf\";\n/**\n * Takes a partial protobuf messages of the\n * specified message type as input, and returns full instances.\n */\nexport function normalize(type, message) {\n return message instanceof type\n ? message\n : new type(message);\n}\n/**\n * Takes an AsyncIterable of partial protobuf messages of the\n * specified message type as input, and yields full instances.\n */\nexport function normalizeIterable(messageType, input) {\n function transform(result) {\n if (result.done === true) {\n return result;\n }\n return {\n done: result.done,\n value: normalize(messageType, result.value),\n };\n }\n return {\n [Symbol.asyncIterator]() {\n const it = input[Symbol.asyncIterator]();\n const res = {\n next: () => it.next().then(transform),\n };\n if (it.throw !== undefined) {\n res.throw = (e) => it.throw(e).then(transform); // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n if (it.return !== undefined) {\n res.return = (v) => it.return(v).then(transform); // eslint-disable-line @typescript-eslint/no-non-null-assertion\n }\n return res;\n },\n };\n}\n","// Copyright 2021-2024 The Connect Authors\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 * applyInterceptors takes the given UnaryFn or ServerStreamingFn, and wraps\n * it with each of the given interceptors, returning a new UnaryFn or\n * ServerStreamingFn.\n */\nexport function applyInterceptors(next, interceptors) {\n var _a;\n return ((_a = interceptors === null || interceptors === void 0 ? void 0 : interceptors.concat().reverse().reduce(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n (n, i) => i(n), next)) !== null && _a !== void 0 ? _a : next);\n}\n","// Copyright 2021-2024 The Connect Authors\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 { ConnectError } from \"../connect-error.js\";\nimport { Code } from \"../code.js\";\nimport { assertReadMaxBytes, assertWriteMaxBytes } from \"./limit-io.js\";\n/**\n * Sets default JSON serialization options for connect-es.\n *\n * With standard protobuf JSON serialization, unknown JSON fields are\n * rejected by default. In connect-es, unknown JSON fields are ignored\n * by default.\n */\nexport function getJsonOptions(options) {\n var _a;\n const o = Object.assign({}, options);\n (_a = o.ignoreUnknownFields) !== null && _a !== void 0 ? _a : (o.ignoreUnknownFields = true);\n return o;\n}\n/**\n * Create an object that provides convenient access to request and response\n * message serialization for a given method.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function createMethodSerializationLookup(method, binaryOptions, jsonOptions, limitOptions) {\n const inputBinary = limitSerialization(createBinarySerialization(method.I, binaryOptions), limitOptions);\n const inputJson = limitSerialization(createJsonSerialization(method.I, jsonOptions), limitOptions);\n const outputBinary = limitSerialization(createBinarySerialization(method.O, binaryOptions), limitOptions);\n const outputJson = limitSerialization(createJsonSerialization(method.O, jsonOptions), limitOptions);\n return {\n getI(useBinaryFormat) {\n return useBinaryFormat ? inputBinary : inputJson;\n },\n getO(useBinaryFormat) {\n return useBinaryFormat ? outputBinary : outputJson;\n },\n };\n}\n/**\n * Returns functions to normalize and serialize the input message\n * of an RPC, and to parse the output message of an RPC.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function createClientMethodSerializers(method, useBinaryFormat, jsonOptions, binaryOptions) {\n const input = useBinaryFormat\n ? createBinarySerialization(method.I, binaryOptions)\n : createJsonSerialization(method.I, jsonOptions);\n const output = useBinaryFormat\n ? createBinarySerialization(method.O, binaryOptions)\n : createJsonSerialization(method.O, jsonOptions);\n return { parse: output.parse, serialize: input.serialize };\n}\n/**\n * Apply I/O limits to a Serialization object, returning a new object.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function limitSerialization(serialization, limitOptions) {\n return {\n serialize(data) {\n const bytes = serialization.serialize(data);\n assertWriteMaxBytes(limitOptions.writeMaxBytes, bytes.byteLength);\n return bytes;\n },\n parse(data) {\n assertReadMaxBytes(limitOptions.readMaxBytes, data.byteLength, true);\n return serialization.parse(data);\n },\n };\n}\n/**\n * Creates a Serialization object for serializing the given protobuf message\n * with the protobuf binary format.\n */\nexport function createBinarySerialization(messageType, options) {\n return {\n parse(data) {\n try {\n return messageType.fromBinary(data, options);\n }\n catch (e) {\n const m = e instanceof Error ? e.message : String(e);\n throw new ConnectError(`parse binary: ${m}`, Code.InvalidArgument);\n }\n },\n serialize(data) {\n try {\n return data.toBinary(options);\n }\n catch (e) {\n const m = e instanceof Error ? e.message : String(e);\n throw new ConnectError(`serialize binary: ${m}`, Code.Internal);\n }\n },\n };\n}\n/**\n * Creates a Serialization object for serializing the given protobuf message\n * with the protobuf canonical JSON encoding.\n *\n * By default, unknown fields are ignored.\n */\nexport function createJsonSerialization(messageType, options) {\n var _a, _b;\n const textEncoder = (_a = options === null || options === void 0 ? void 0 : options.textEncoder) !== null && _a !== void 0 ? _a : new TextEncoder();\n const textDecoder = (_b = options === null || options === void 0 ? void 0 : options.textDecoder) !== null && _b !== void 0 ? _b : new TextDecoder();\n const o = getJsonOptions(options);\n return {\n parse(data) {\n try {\n const json = textDecoder.decode(data);\n return messageType.fromJsonString(json, o);\n }\n catch (e) {\n throw ConnectError.from(e, Code.InvalidArgument);\n }\n },\n serialize(data) {\n try {\n const json = data.toJsonString(o);\n return textEncoder.encode(json);\n }\n catch (e) {\n throw ConnectError.from(e, Code.Internal);\n }\n },\n };\n}\n","// Copyright 2021-2024 The Connect Authors\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 * Regular Expression that matches any valid Connect Content-Type header value.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport const contentTypeRegExp = /^application\\/(connect\\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;\n/**\n * Regular Expression that matches a Connect unary Content-Type header value.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport const contentTypeUnaryRegExp = /^application\\/(?:json(?:; ?charset=utf-?8)?|proto)$/i;\n/**\n * Regular Expression that matches a Connect streaming Content-Type header value.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport const contentTypeStreamRegExp = /^application\\/connect\\+?(?:json(?:; ?charset=utf-?8)?|proto)$/i;\nexport const contentTypeUnaryProto = \"application/proto\";\nexport const contentTypeUnaryJson = \"application/json\";\nexport const contentTypeStreamProto = \"application/connect+proto\";\nexport const contentTypeStreamJson = \"application/connect+json\";\nconst encodingProto = \"proto\";\nconst encodingJson = \"json\";\n/**\n * Parse a Connect Content-Type header.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function parseContentType(contentType) {\n const match = contentType === null || contentType === void 0 ? void 0 : contentType.match(contentTypeRegExp);\n if (!match) {\n return undefined;\n }\n const stream = !!match[1];\n const binary = !!match[3];\n return { stream, binary };\n}\n/**\n * Parse a Connect Get encoding query parameter.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function parseEncodingQuery(encoding) {\n switch (encoding) {\n case encodingProto:\n return { stream: false, binary: true };\n case encodingJson:\n return { stream: false, binary: false };\n default:\n return undefined;\n }\n}\n","// Copyright 2021-2024 The Connect Authors\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 __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { protoBase64 } from \"@bufbuild/protobuf\";\nimport { Code } from \"../code.js\";\nimport { ConnectError } from \"../connect-error.js\";\nimport { codeFromString, codeToString } from \"./code-string.js\";\n/**\n * Parse a Connect error from a JSON value.\n * Will return a ConnectError, and throw the provided fallback if parsing failed.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function errorFromJson(jsonValue, metadata, fallback) {\n if (metadata) {\n new Headers(metadata).forEach((value, key) => fallback.metadata.append(key, value));\n }\n if (typeof jsonValue !== \"object\" ||\n jsonValue == null ||\n Array.isArray(jsonValue) ||\n !(\"code\" in jsonValue) ||\n typeof jsonValue.code !== \"string\") {\n throw fallback;\n }\n const code = codeFromString(jsonValue.code);\n if (code === undefined) {\n throw fallback;\n }\n const message = jsonValue.message;\n if (message != null && typeof message !== \"string\") {\n throw fallback;\n }\n const error = new ConnectError(message !== null && message !== void 0 ? message : \"\", code, metadata);\n if (\"details\" in jsonValue && Array.isArray(jsonValue.details)) {\n for (const detail of jsonValue.details) {\n if (detail === null ||\n typeof detail != \"object\" ||\n Array.isArray(detail) ||\n typeof detail.type != \"string\" ||\n typeof detail.value != \"string\" ||\n (\"debug\" in detail && typeof detail.debug != \"object\")) {\n throw fallback;\n }\n try {\n error.details.push({\n type: detail.type,\n value: protoBase64.dec(detail.value),\n debug: detail.debug,\n });\n }\n catch (e) {\n throw fallback;\n }\n }\n }\n return error;\n}\n/**\n * Parse a Connect error from a serialized JSON value.\n * Will return a ConnectError, and throw the provided fallback if parsing failed.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function errorFromJsonBytes(bytes, metadata, fallback) {\n let jsonValue;\n try {\n jsonValue = JSON.parse(new TextDecoder().decode(bytes));\n }\n catch (e) {\n throw fallback;\n }\n return errorFromJson(jsonValue, metadata, fallback);\n}\n/**\n * Serialize the given error to JSON.\n *\n * The JSON serialization options are required to produce the optional\n * human-readable representation in the \"debug\" key if the detail uses\n * google.protobuf.Any. If serialization of the \"debug\" value fails, it\n * is silently disregarded.\n *\n * See https://connectrpc.com/docs/protocol#error-end-stream\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function errorToJson(error, jsonWriteOptions) {\n const o = {\n code: codeToString(error.code),\n };\n if (error.rawMessage.length > 0) {\n o.message = error.rawMessage;\n }\n if (error.details.length > 0) {\n o.details = error.details\n .map((value) => {\n if (\"getType\" in value) {\n const i = {\n type: value.getType().typeName,\n value: value.toBinary(),\n };\n try {\n i.debug = value.toJson(jsonWriteOptions);\n }\n catch (e) {\n // We deliberately ignore errors that may occur when serializing\n // a message to JSON (the message contains an Any).\n // The rationale is that we are only trying to provide optional\n // debug information.\n }\n return i;\n }\n return value;\n })\n .map((_a) => {\n var { value } = _a, rest = __rest(_a, [\"value\"]);\n return (Object.assign(Object.assign({}, rest), { value: protoBase64.enc(value) }));\n });\n }\n return o;\n}\n/**\n * Serialize the given error to JSON. This calls errorToJson(), but stringifies\n * the result, and converts it into a UInt8Array.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function errorToJsonBytes(error, jsonWriteOptions) {\n const textEncoder = new TextEncoder();\n try {\n const jsonObject = errorToJson(error, jsonWriteOptions);\n const jsonString = JSON.stringify(jsonObject);\n return textEncoder.encode(jsonString);\n }\n catch (e) {\n const m = e instanceof Error ? e.message : String(e);\n throw new ConnectError(`failed to serialize Connect Error: ${m}`, Code.Internal);\n }\n}\n","// Copyright 2021-2024 The Connect Authors\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 { errorFromJson, errorToJson } from \"./error-json.js\";\nimport { appendHeaders } from \"../http-headers.js\";\nimport { ConnectError } from \"../connect-error.js\";\nimport { Code } from \"../code.js\";\n/**\n * endStreamFlag indicates that the data in a EnvelopedMessage\n * is a EndStreamResponse of the Connect protocol.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport const endStreamFlag = 0b00000010;\n/**\n * Parse an EndStreamResponse of the Connect protocol.\n * Throws a ConnectError on malformed input.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function endStreamFromJson(data) {\n const parseErr = new ConnectError(\"invalid end stream\", Code.InvalidArgument);\n let jsonValue;\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n jsonValue = JSON.parse(typeof data == \"string\" ? data : new TextDecoder().decode(data));\n }\n catch (e) {\n throw parseErr;\n }\n if (typeof jsonValue != \"object\" ||\n jsonValue == null ||\n Array.isArray(jsonValue)) {\n throw parseErr;\n }\n const metadata = new Headers();\n if (\"metadata\" in jsonValue) {\n if (typeof jsonValue.metadata != \"object\" ||\n jsonValue.metadata == null ||\n Array.isArray(jsonValue.metadata)) {\n throw parseErr;\n }\n for (const [key, values] of Object.entries(jsonValue.metadata)) {\n if (!Array.isArray(values) ||\n values.some((value) => typeof value != \"string\")) {\n throw parseErr;\n }\n for (const value of values) {\n metadata.append(key, value);\n }\n }\n }\n const error = \"error\" in jsonValue\n ? errorFromJson(jsonValue.error, metadata, parseErr)\n : undefined;\n return { metadata, error };\n}\n/**\n * Serialize the given EndStreamResponse to JSON.\n *\n * The JSON serialization options are required to produce the optional\n * human-readable representation of error details if the detail uses\n * google.protobuf.Any.\n *\n * See https://connectrpc.com/docs/protocol#error-end-stream\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function endStreamToJson(metadata, error, jsonWriteOptions) {\n const es = {};\n if (error !== undefined) {\n es.error = errorToJson(error, jsonWriteOptions);\n metadata = appendHeaders(metadata, error.metadata);\n }\n let hasMetadata = false;\n const md = {};\n metadata.forEach((value, key) => {\n hasMetadata = true;\n md[key] = [value];\n });\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (hasMetadata) {\n es.metadata = md;\n }\n return es;\n}\n/**\n * Create a Serialization object that serializes a Connect EndStreamResponse.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function createEndStreamSerialization(options) {\n const textEncoder = new TextEncoder();\n return {\n serialize(data) {\n try {\n const jsonObject = endStreamToJson(data.metadata, data.error, options);\n const jsonString = JSON.stringify(jsonObject);\n return textEncoder.encode(jsonString);\n }\n catch (e) {\n const m = e instanceof Error ? e.message : String(e);\n throw new ConnectError(`failed to serialize EndStreamResponse: ${m}`, Code.Internal);\n }\n },\n parse(data) {\n try {\n return endStreamFromJson(data);\n }\n catch (e) {\n const m = e instanceof Error ? e.message : String(e);\n throw new ConnectError(`failed to parse EndStreamResponse: ${m}`, Code.InvalidArgument);\n }\n },\n };\n}\n","// Copyright 2021-2024 The Connect Authors\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 * @private Internal code, does not follow semantic versioning.\n */\nexport const headerContentType = \"Content-Type\";\nexport const headerUnaryContentLength = \"Content-Length\";\nexport const headerUnaryEncoding = \"Content-Encoding\";\nexport const headerStreamEncoding = \"Connect-Content-Encoding\";\nexport const headerUnaryAcceptEncoding = \"Accept-Encoding\";\nexport const headerStreamAcceptEncoding = \"Connect-Accept-Encoding\";\nexport const headerTimeout = \"Connect-Timeout-Ms\";\nexport const headerProtocolVersion = \"Connect-Protocol-Version\";\nexport const headerUserAgent = \"User-Agent\";\n","// Copyright 2021-2024 The Connect Authors\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 { Code } from \"../code.js\";\n/**\n * Determine the Connect error code for the given HTTP status code.\n * See https://connectrpc.com/docs/protocol#error-codes\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function codeFromHttpStatus(httpStatus) {\n switch (httpStatus) {\n case 400: // Bad Request\n return Code.InvalidArgument;\n case 401: // Unauthorized\n return Code.Unauthenticated;\n case 403: // Forbidden\n return Code.PermissionDenied;\n case 404: // Not Found\n return Code.Unimplemented;\n case 408: // Request Timeout\n return Code.DeadlineExceeded;\n case 409: // Conflict\n return Code.Aborted;\n case 412: // Precondition Failed\n return Code.FailedPrecondition;\n case 413: // Payload Too Large\n return Code.ResourceExhausted;\n case 415: // Unsupported Media Type\n return Code.Internal;\n case 429: // Too Many Requests\n return Code.Unavailable;\n case 431: // Request Header Fields Too Large\n return Code.ResourceExhausted;\n case 502: // Bad Gateway\n return Code.Unavailable;\n case 503: // Service Unavailable\n return Code.Unavailable;\n case 504: // Gateway Timeout\n return Code.Unavailable;\n default:\n return Code.Unknown;\n }\n}\n/**\n * Returns a HTTP status code for the given Connect code.\n * See https://connectrpc.com/docs/protocol#error-codes\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function codeToHttpStatus(code) {\n switch (code) {\n case Code.Canceled:\n return 408; // Request Timeout\n case Code.Unknown:\n return 500; // Internal Server Error\n case Code.InvalidArgument:\n return 400; // Bad Request\n case Code.DeadlineExceeded:\n return 408; // Request Timeout\n case Code.NotFound:\n return 404; // Not Found\n case Code.AlreadyExists:\n return 409; // Conflict\n case Code.PermissionDenied:\n return 403; // Forbidden\n case Code.ResourceExhausted:\n return 429; // Too Many Requests\n case Code.FailedPrecondition:\n return 412; // Precondition Failed\n case Code.Aborted:\n return 409; // Conflict\n case Code.OutOfRange:\n return 400; // Bad Request\n case Code.Unimplemented:\n return 404; // Not Found\n case Code.Internal:\n return 500; // Internal Server Error\n case Code.Unavailable:\n return 503; // Service Unavailable\n case Code.DataLoss:\n return 500; // Internal Server Error\n case Code.Unauthenticated:\n return 401; // Unauthorized\n default:\n return 500; // same as CodeUnknown\n }\n}\n","// Copyright 2021-2024 The Connect Authors\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 * In unary RPCs, Connect transports trailing metadata as response header\n * fields, prefixed with \"trailer-\".\n *\n * This function demuxes headers and trailers into two separate Headers\n * objects.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function trailerDemux(header) {\n const h = new Headers(), t = new Headers();\n header.forEach((value, key) => {\n if (key.toLowerCase().startsWith(\"trailer-\")) {\n t.set(key.substring(8), value);\n }\n else {\n h.set(key, value);\n }\n });\n return [h, t];\n}\n/**\n * In unary RPCs, Connect transports trailing metadata as response header\n * fields, prefixed with \"trailer-\".\n *\n * This function muxes a header and a trailer into a single Headers object.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function trailerMux(header, trailer) {\n const h = new Headers(header);\n trailer.forEach((value, key) => {\n h.set(`trailer-${key}`, value);\n });\n return h;\n}\n","// Copyright 2021-2024 The Connect Authors\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 { headerProtocolVersion } from \"./headers.js\";\nimport { paramConnectVersion } from \"./query-params.js\";\nimport { ConnectError } from \"../connect-error.js\";\nimport { Code } from \"../code.js\";\n/**\n * The only know value for the header Connect-Protocol-Version.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport const protocolVersion = \"1\";\n/**\n * Requires the Connect-Protocol-Version header to be present with the expected\n * value. Raises a ConnectError with Code.InvalidArgument otherwise.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function requireProtocolVersionHeader(requestHeader) {\n const v = requestHeader.get(headerProtocolVersion);\n if (v === null) {\n throw new ConnectError(`missing required header: set ${headerProtocolVersion} to \"${protocolVersion}\"`, Code.InvalidArgument);\n }\n else if (v !== protocolVersion) {\n throw new ConnectError(`${headerProtocolVersion} must be \"${protocolVersion}\": got \"${v}\"`, Code.InvalidArgument);\n }\n}\n/**\n * Requires the connect query parameter to be present with the expected value.\n * Raises a ConnectError with Code.InvalidArgument otherwise.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function requireProtocolVersionParam(queryParams) {\n const v = queryParams.get(paramConnectVersion);\n if (v === null) {\n throw new ConnectError(`missing required parameter: set ${paramConnectVersion} to \"v${protocolVersion}\"`, Code.InvalidArgument);\n }\n else if (v !== `v${protocolVersion}`) {\n throw new ConnectError(`${paramConnectVersion} must be \"v${protocolVersion}\": got \"${v}\"`, Code.InvalidArgument);\n }\n}\n","// Copyright 2021-2024 The Connect Authors\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 { MethodKind } from \"@bufbuild/protobuf\";\nimport { headerContentType, headerStreamAcceptEncoding, headerStreamEncoding, headerUnaryAcceptEncoding, headerUnaryEncoding, headerTimeout, headerProtocolVersion, headerUserAgent, } from \"./headers.js\";\nimport { protocolVersion } from \"./version.js\";\nimport { contentTypeStreamJson, contentTypeStreamProto, contentTypeUnaryJson, contentTypeUnaryProto, } from \"./content-type.js\";\n/**\n * Creates headers for a Connect request.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function requestHeader(methodKind, useBinaryFormat, timeoutMs, userProvidedHeaders, setUserAgent) {\n const result = new Headers(userProvidedHeaders !== null && userProvidedHeaders !== void 0 ? userProvidedHeaders : {});\n if (timeoutMs !== undefined) {\n result.set(headerTimeout, `${timeoutMs}`);\n }\n result.set(headerContentType, methodKind == MethodKind.Unary\n ? useBinaryFormat\n ? contentTypeUnaryProto\n : contentTypeUnaryJson\n : useBinaryFormat\n ? contentTypeStreamProto\n : contentTypeStreamJson);\n result.set(headerProtocolVersion, protocolVersion);\n if (setUserAgent) {\n result.set(headerUserAgent, \"connect-es/1.4.0\");\n }\n return result;\n}\n/**\n * Creates headers for a Connect request with compression.\n *\n * Note that we always set the Content-Encoding header for unary methods.\n * It is up to the caller to decide whether to apply compression - and remove\n * the header if compression is not used, for example because the payload is\n * too small to make compression effective.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function requestHeaderWithCompression(methodKind, useBinaryFormat, timeoutMs, userProvidedHeaders, acceptCompression, sendCompression, setUserAgent) {\n const result = requestHeader(methodKind, useBinaryFormat, timeoutMs, userProvidedHeaders, setUserAgent);\n if (sendCompression != null) {\n const name = methodKind == MethodKind.Unary\n ? headerUnaryEncoding\n : headerStreamEncoding;\n result.set(name, sendCompression.name);\n }\n if (acceptCompression.length > 0) {\n const name = methodKind == MethodKind.Unary\n ? headerUnaryAcceptEncoding\n : headerStreamAcceptEncoding;\n result.set(name, acceptCompression.map((c) => c.name).join(\",\"));\n }\n return result;\n}\n","// Copyright 2021-2024 The Connect Authors\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 { MethodKind } from \"@bufbuild/protobuf\";\nimport { Code } from \"../code.js\";\nimport { codeFromHttpStatus } from \"./http-status.js\";\nimport { ConnectError } from \"../connect-error.js\";\nimport { parseContentType } from \"./content-type.js\";\nimport { headerStreamEncoding, headerUnaryEncoding } from \"./headers.js\";\n/**\n * Validates response status and header for the Connect protocol.\n * Throws a ConnectError if the header indicates an error, or if\n * the content type is unexpected, with the following exception:\n * For unary RPCs with an HTTP error status, this returns an error\n * derived from the HTTP status instead of throwing it, giving an\n * implementation a chance to parse a Connect error from the wire.\n *\n * @private Internal code, does not follow semantic versioning.\n */\nexport function validateResponse(methodKind, status, headers) {\n const mimeType = headers.get(\"Content-Type\");\n const parsedType = parseContentType(mimeType);\n if (status !== 200) {\n const errorFromStatus = new ConnectError(`HTTP ${status}`, codeFromHttpStatus(status), headers);\n // If parsedType is defined and it is not binary, then this is a unary JSON response\n if (methodKind == MethodKind.Unary && parsedType && !parsedType.binary) {\n return { isUnaryError: true, unaryError: errorFromStatus };\n }\n throw errorFromStatus;\n }\n return { isUnaryError: false };\n}\n/**\n * Validates response status and header for the Connect protocol.\n * This function is identical to validateResponse(), but also verifies\n * that a given encoding header is acceptable.\n *\n * @private\n */\nexport function validateResponseWithCompression(methodKind, acceptCompression, status, headers) {\n let compression;\n const encoding = headers.get(methodKind == MethodKind.Unary ? headerUnaryEncoding : headerStreamEncoding);\n if (encoding != null && encoding.toLowerCase() !== \"identity\") {\n compression = acceptCompression.find((c) => c.name === encoding);\n if (!compression) {\n throw new ConnectError(`unsupported response encoding \"${encoding}\"`, Code.InvalidArgument, headers);\n }\n }\n return Object.assign({ compression }, validateResponse(methodKind, status, headers));\n}\n","// Copyright 2021-2024 The Connect Authors\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, protoBase64 } from \"@bufbuild/protobuf\";\nimport { headerContentType, headerProtocolVersion, headerUnaryAcceptEncoding, headerUnaryContentLength, headerUnaryEncoding, } from \"./headers.js\";\nimport { protocolVersion } from \"./version.js\";\nconst contentTypePrefix = \"application/\";\nfunction encodeMessageForUrl(message, useBase64) {\n if (useBase64) {\n // TODO(jchadwick-buf): Three regex replaces seems excessive.\n // Can we make protoBase64.enc more flexible?\n return protoBase64\n .enc(message)\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=+$/, \"\");\n }\n else {\n return encodeURIComponent(new TextDecoder().decode(message));\n }\n}\n/**\n * @private Internal code, does not follow semantic versioning.\n */\nexport function transformConnectPostToGetRequest(request, message, useBase64) {\n let query = `?connect=v${protocolVersion}`;\n const contentType = request.header.get(headerContentType);\n if ((contentType === null || contentType === void 0 ? void 0 : contentType.indexOf(contentTypePrefix)) === 0) {\n query +=\n \"&encoding=\" +\n encodeURIComponent(contentType.slice(contentTypePrefix.length));\n }\n const compression = request.header.get(headerUnaryEncoding);\n if (compression !== null && compression !== \"identity\") {\n query += \"&compression=\" + encodeURIComponent(compression);\n // Force base64 for compressed payloads.\n useBase64 = true;\n }\n if (useBase64) {\n query += \"&base64=1\";\n }\n query += \"&message=\" + encodeMessageForUrl(message, useBase64);\n const url = request.url + query;\n // Omit headers that are not used for unary GET requests.\n const header = new Headers(request.header);\n [\n headerProtocolVersion,\n headerContentType,\n headerUnaryContentLength,\n headerUnaryEncoding,\n headerUnaryAcceptEncoding,\n ].forEach((h) => header.delete(h));\n return Object.assign(Object.assign({}, request), { init: Object.assign(Object.assign({}, request.init), { method: \"GET\" }), url,\n header });\n}\n","// Copyright 2021-2024 The Connect Authors\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 { applyInterceptors } from \"../interceptor.js\";\nimport { ConnectError } from \"../connect-error.js\";\nimport { createDeadlineSignal, createLinkedAbortController, getAbortSignalReason, } from \"./signals.js\";\nimport { normalize, normalizeIterable } from \"./normalize.js\";\n/**\n * Runs a unary method with the given interceptors. Note that this function\n * is only used when implementing a Transport.\n */\nexport function runUnaryCall(opt) {\n const next = applyInterceptors(opt.next, opt.interceptors);\n const [signal, abort, done] = setupSignal(opt);\n const req = Object.assign(Object.assign({}, opt.req), { message: normalize(opt.req.method.I, opt.req.message), signal });\n return next(req).then((res) => {\n done();\n return res;\n }, abort);\n}\n/**\n * Runs a server-streaming method with the given interceptors. Note that this\n * function is only used when implementing a Transport.\n */\nexport function runStreamingCall(opt) {\n const next = applyInterceptors(opt.next, opt.interceptors);\n const [signal, abort, done] = setupSignal(opt);\n const req = Object.assign(Object.assign({}, opt.req), { message: normalizeIterable(opt.req.method.I, opt.req.message), signal });\n let doneCalled = false;\n // Call return on the request iterable to indicate\n // that we will no longer consume it and it should\n // cleanup any allocated resources.\n signal.addEventListener(\"abort\", function () {\n var _a, _b;\n const it = opt.req.message[Symbol.asyncIterator]();\n // If the signal is aborted due to an error, we want to throw\n // the error to the request iterator.\n if (!doneCalled) {\n (_a = it.throw) === null || _a === void 0 ? void 0 : _a.call(it, this.reason).catch(() => {\n // throw returns a promise, which we don't care about.\n //\n // Uncaught promises are thrown at sometime/somewhere by the event loop,\n // this is to ensure error is caught and ignored.\n });\n }\n (_b = it.return) === null || _b === void 0 ? void 0 : _b.call(it).catch(() => {\n // return returns a promise, which we don't care about.\n //\n // Uncaught promises are thrown at sometime/somewhere by the event loop,\n // this is to ensure error is caught and ignored.\n });\n });\n return next(req).then((res) => {\n return Object.assign(Object.assign({}, res), { message: {\n [Symbol.asyncIterator]() {\n const it = res.message[Symbol.asyncIterator]();\n return {\n next() {\n return it.next().then((r) => {\n if (r.done == true) {\n doneCalled = true;\n done();\n }\n return r;\n }, abort);\n },\n // We deliberately omit throw/return.\n };\n },\n } });\n }, abort);\n}\n/**\n * Create an AbortSignal for Transport implementations. The signal is available\n * in UnaryRequest and StreamingRequest, and is triggered when the call is\n * aborted (via a timeout or explicit cancellation), errored (e.g. when reading\n * an error from the server from the wire), or finished successfully.\n *\n * Transport implementations can pass the signal to HTTP clients to ensure that\n * there are no unused connections leak.\n *\n * Returns a tuple:\n * [0]: The signal, which is also aborted if the optional deadline is reached.\n * [1]: Function to call if the Transport encountered an error.\n * [2]: Function to call if the Transport finished without an error.\n */\nfunction setupSignal(opt) {\n const { signal, cleanup } = createDeadlineSignal(opt.timeoutMs);\n const controller = createLinkedAbortController(opt.signal, signal);\n return [\n controller.signal,\n function abort(reason) {\n // We peek at the deadline signal because fetch() will throw an error on\n // abort that discards the signal reason.\n const e = ConnectError.from(signal.aborted ? getAbortSignalReason(signal) : reason);\n controller.abort(e);\n cleanup();\n return Promise.reject(e);\n },\n function done() {\n cleanup();\n controller.abort();\n },\n ];\n}\n","// Copyright 2021-2024 The Connect Authors\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 * Asserts that the fetch API is available.\n */\nexport function assertFetchApi() {\n try {\n new Headers();\n }\n catch (_) {\n throw new Error(\"connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.\");\n }\n}\n","// Copyright 2021-2024 The Connect Authors\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 __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\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\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};\nimport { Message, MethodIdempotency, MethodKind } from \"@bufbuild/protobuf\";\nimport { appendHeaders, createContextValues } from \"@connectrpc/connect\";\nimport { createClientMethodSerializers, createEnvelopeReadableStream, createMethodUrl, getJsonOptions, encodeEnvelope, runStreamingCall, runUnaryCall, } from \"@connectrpc/connect/protocol\";\nimport { endStreamFlag, endStreamFromJson, errorFromJson, requestHeader, trailerDemux, transformConnectPostToGetRequest, validateResponse, } from \"@connectrpc/connect/protocol-connect\";\nimport { assertFetchApi } from \"./assert-fetch-api.js\";\n/**\n * Create a Transport for the Connect protocol, which makes unary and\n * server-streaming methods available to web browsers. It uses the fetch\n * API to make HTTP requests.\n */\nexport function createConnectTransport(options) {\n var _a;\n assertFetchApi();\n const useBinaryFormat = (_a = options.useBinaryFormat) !== null && _a !== void 0 ? _a : false;\n return {\n async unary(service, method, signal, timeoutMs, header, message, contextValues) {\n var _a;\n const { serialize, parse } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);\n timeoutMs =\n timeoutMs === undefined\n ? options.defaultTimeoutMs\n : timeoutMs <= 0\n ? undefined\n : timeoutMs;\n return await runUnaryCall({\n interceptors: options.interceptors,\n signal,\n timeoutMs,\n req: {\n stream: false,\n service,\n method,\n url: createMethodUrl(options.baseUrl, service, method),\n init: {\n method: \"POST\",\n credentials: (_a = options.credentials) !== null && _a !== void 0 ? _a : \"same-origin\",\n redirect: \"error\",\n mode: \"cors\",\n },\n header: requestHeader(method.kind, useBinaryFormat, timeoutMs, header, false),\n contextValues: contextValues !== null && contextValues !== void 0 ? contextValues : createContextValues(),\n message,\n },\n next: async (req) => {\n var _a;\n const useGet = options.useHttpGet === true &&\n method.idempotency === MethodIdempotency.NoSideEffects;\n let body = null;\n if (useGet) {\n req = transformConnectPostToGetRequest(req, serialize(req.message), useBinaryFormat);\n }\n else {\n body = serialize(req.message);\n }\n const fetch = (_a = options.fetch) !== null && _a !== void 0 ? _a : globalThis.fetch;\n const response = await fetch(req.url, Object.assign(Object.assign({}, req.init), { headers: req.header, signal: req.signal, body }));\n const { isUnaryError, unaryError } = validateResponse(method.kind, response.status, response.headers);\n if (isUnaryError) {\n throw errorFromJson((await response.json()), appendHeaders(...trailerDemux(response.headers)), unaryError);\n }\n const [demuxedHeader, demuxedTrailer] = trailerDemux(response.headers);\n return {\n stream: false,\n service,\n method,\n header: demuxedHeader,\n message: useBinaryFormat\n ? parse(new Uint8Array(await response.arrayBuffer()))\n : method.O.fromJson((await response.json()), getJsonOptions(options.jsonOptions)),\n trailer: demuxedTrailer,\n };\n },\n });\n },\n async stream(service, method, signal, timeoutMs, header, input, contextValues) {\n var _a;\n const { serialize, parse } = createClientMethodSerializers(method, useBinaryFormat, options.jsonOptions, options.binaryOptions);\n function parseResponseBody(body, trailerTarget, header) {\n return __asyncGenerator(this, arguments, function* parseResponseBody_1() {\n const reader = createEnvelopeReadableStream(body).getReader();\n let endStreamReceived = false;\n for (;;) {\n const result = yield __await(reader.read());\n if (result.done) {\n break;\n }\n const { flags, data } = result.value;\n if ((flags & endStreamFlag) === endStreamFlag) {\n endStreamReceived = true;\n const endStream = endStreamFromJson(data);\n if (endStream.error) {\n const error = endStream.error;\n header.forEach((value, key) => {\n error.metadata.append(key, value);\n });\n throw error;\n }\n endStream.metadata.forEach((value, key) => trailerTarget.set(key, value));\n continue;\n }\n yield yield __await(parse(data));\n }\n if (!endStreamReceived) {\n throw \"missing EndStreamResponse\";\n }\n });\n }\n async function createRequestBody(input) {\n if (method.kind != MethodKind.ServerStreaming) {\n throw \"The fetch API does not support streaming request bodies\";\n }\n const r = await input[Symbol.asyncIterator]().next();\n if (r.done == true) {\n throw \"missing request message\";\n }\n return encodeEnvelope(0, serialize(r.value));\n }\n timeoutMs =\n timeoutMs === undefined\n ? options.defaultTimeoutMs\n : timeoutMs <= 0\n ? undefined\n : timeoutMs;\n return await runStreamingCall({\n interceptors: options.interceptors,\n timeoutMs,\n signal,\n req: {\n stream: true,\n service,\n method,\n url: createMethodUrl(options.baseUrl, service, method),\n init: {\n method: \"POST\",\n credentials: (_a = options.credentials) !== null && _a !== void 0 ? _a : \"same-origin\",\n redirect: \"error\",\n mode: \"cors\",\n },\n header: requestHeader(method.kind, useBinaryFormat, timeoutMs, header, false),\n contextValues: contextValues !== null && contextValues !== void 0 ? contextValues : createContextValues(),\n message: input,\n },\n next: async (req) => {\n var _a;\n const fetch = (_a = options.fetch) !== null && _a !== void 0 ? _a : globalThis.fetch;\n const fRes = await fetch(req.url, Object.assign(Object.assign({}, req.init), { headers: req.header, signal: req.signal, body: await createRequestBody(req.message) }));\n validateResponse(method.kind, fRes.status, fRes.headers);\n if (fRes.body === null) {\n throw \"missing response body\";\n }\n const trailer = new Headers();\n const res = Object.assign(Object.assign({}, req), { header: fRes.headers, trailer, message: parseResponseBody(fRes.body, trailer, fRes.headers) });\n return res;\n },\n });\n },\n };\n}\n"],"names":["Code","codeToString","value","name","c","stringToCode","codeFromString","ConnectError","message","code","metadata","outgoingDetails","cause","createMessage","reason","v","typeOrRegistry","registry","typeName","details","data","type","assert","condition","msg","FLOAT32_MAX","FLOAT32_MIN","UINT32_MAX","INT32_MAX","INT32_MIN","assertInt32","arg","assertUInt32","assertFloat32","enumTypeSymbol","getEnumType","enumObject","t","setEnumType","values","opt","makeEnumType","_opt","names","numbers","normalValues","n","normalizeEnumValue","no","makeEnum","Message","other","bytes","options","format","jsonValue","jsonString","json","e","bin","writer","_a","makeMessageType","runtime","fields","localName","b","varint64read","lowBits","highBits","shift","middleByte","varint64write","lo","hi","i","hasNext","byte","splitBits","hasMoreBits","TWO_PWR_32_DBL","int64FromString","dec","minus","base","add1e6digit","begin","end","digit1e6","negate","newBits","int64ToString","bits","negative","result","uInt64ToString","toUnsigned","low","mid","high","digitA","digitB","digitC","decimalFrom1e7WithLeadingZeros","digit1e7","partial","varint32write","varint32read","readBytes","makeInt64Support","dv","define_process_env_default","MIN","MAX","UMIN","UMAX","bi","assertInt64String","assertUInt64String","protoInt64","ScalarType","LongType","scalarEquals","a","scalarZeroValue","longType","isScalarZeroValue","WireType","BinaryWriter","textEncoder","len","offset","chunk","prev","fieldNo","view","tc","sign","BinaryReader","buf","textDecoder","tag","wireType","start","zze","s","makeExtension","extendee","field","fi","createExtensionContainer","extension","container","initExtensionField","ext","T","filterUnknownFields","unknownFields","uf","encTable","decTable","protoBase64","base64Str","es","bytePos","groupPos","p","base64","getExtension","assertExtendee","ufs","get","setExtension","readOpt","writeOpt","hasExtension","f","reader","messageType","isFieldSet","target","clearField","implicitPresence","isMessage","m","actualType","wrapField","jsonReadDefaults","jsonWriteDefaults","makeReadOptions","makeWriteOptions","tokenNull","tokenIgnoredUnknownEnum","makeJsonFormat","debugJsonValue","oneofSeen","jsonKey","seen","readField","found","canEmitFieldDefaultValue","writeField","r","readScalar","emitDefaultValues","writeScalar","parentType","targetArray","jsonItem","enumValue","readEnum","targetMap","jsonMapKey","jsonMapValue","key","readMapKey","currentValue","scalarValue","nullAsZeroValue","float","int32","long","uLong","ignoreUnknownFields","jsonObj","entries","entryKey","entryValue","enumType","writeEnum","jsonArr","enumAsInteger","val","unknownFieldsSymbol","readDefaults","writeDefaults","makeBinaryFormat","lengthOrEndTagFieldNo","delimitedMessageEncoding","repeated","scalarType","read","readScalarLTString","arr","readMessageField","mapKey","mapVal","readMapEntry","delimited","length","writePacked","item","writeMessageField","writeMapEntry","keyValue","method","scalarTypeInfo","makeUtilCommon","source","member","sk","sourceField","toU8Arr","copy","k","mt","va","vb","keys","any","cloneSingularField","input","makeProtoRuntime","syntax","newFieldList","initFields","InternalFieldList","normalizer","jsonName","o","localFieldName","protoName","inOneof","protoCamelCase","safeObjectProperty","safeMessageProperty","localOneofName","fieldJsonName","snakeCase","capNext","reservedObjectProperties","reservedMessageProperties","fallback","InternalOneofInfo","normalizeFieldInfos","fieldInfos","packedByDefault","_b","_c","_d","_e","_f","ooname","proto3","MethodKind","MethodIdempotency","Timestamp","matches","ms","z","nanosStr","date","Duration","match","longSeconds","text","Any","typeUrl","url","slash","toPlainMessage","toPlainValue","appendHeaders","headers","h","makeAnyClient","service","createMethod","client","methodInfo","createEnvelopeReadableStream","stream","buffer","append","controller","header","encodeEnvelope","flags","__asyncValues","verb","resolve","reject","settle","d","__await","__asyncGenerator","thisArg","_arguments","generator","g","q","awaitReturn","resume","step","fulfill","__asyncDelegator","createAsyncIterable","items","createPromiseClient","transport","createUnaryFn","createServerStreamingFn","createClientStreamingFn","createBiDiStreamingFn","response","handleStreamResponse","request","e_1","singleMessage","_g","_h","e_1_1","it","createLinkedAbortController","signals","sa","signal","onAbort","getAbortSignalReason","createDeadlineSignal","timeoutMs","listener","timeoutId","createContextValues","createMethodUrl","baseUrl","normalize","normalizeIterable","transform","res","applyInterceptors","next","interceptors","getJsonOptions","createClientMethodSerializers","useBinaryFormat","jsonOptions","binaryOptions","createBinarySerialization","createJsonSerialization","contentTypeRegExp","contentTypeUnaryProto","contentTypeUnaryJson","contentTypeStreamProto","contentTypeStreamJson","parseContentType","contentType","binary","errorFromJson","error","detail","endStreamFlag","endStreamFromJson","parseErr","headerContentType","headerUnaryContentLength","headerUnaryEncoding","headerUnaryAcceptEncoding","headerTimeout","headerProtocolVersion","headerUserAgent","codeFromHttpStatus","httpStatus","trailerDemux","protocolVersion","requestHeader","methodKind","userProvidedHeaders","setUserAgent","validateResponse","status","mimeType","parsedType","errorFromStatus","contentTypePrefix","encodeMessageForUrl","useBase64","transformConnectPostToGetRequest","query","compression","runUnaryCall","abort","done","setupSignal","req","runStreamingCall","doneCalled","cleanup","assertFetchApi","createConnectTransport","contextValues","serialize","parse","useGet","body","isUnaryError","unaryError","demuxedHeader","demuxedTrailer","parseResponseBody","trailerTarget","endStreamReceived","endStream","createRequestBody","fRes","trailer"],"mappings":"AAsBU,IAACA,GACV,SAAUA,EAAM,CAIbA,EAAKA,EAAK,SAAc,CAAC,EAAI,WAI7BA,EAAKA,EAAK,QAAa,CAAC,EAAI,UAI5BA,EAAKA,EAAK,gBAAqB,CAAC,EAAI,kBAIpCA,EAAKA,EAAK,iBAAsB,CAAC,EAAI,mBAIrCA,EAAKA,EAAK,SAAc,CAAC,EAAI,WAI7BA,EAAKA,EAAK,cAAmB,CAAC,EAAI,gBAIlCA,EAAKA,EAAK,iBAAsB,CAAC,EAAI,mBAIrCA,EAAKA,EAAK,kBAAuB,CAAC,EAAI,oBAItCA,EAAKA,EAAK,mBAAwB,CAAC,EAAI,qBAIvCA,EAAKA,EAAK,QAAa,EAAE,EAAI,UAI7BA,EAAKA,EAAK,WAAgB,EAAE,EAAI,aAIhCA,EAAKA,EAAK,cAAmB,EAAE,EAAI,gBAInCA,EAAKA,EAAK,SAAc,EAAE,EAAI,WAI9BA,EAAKA,EAAK,YAAiB,EAAE,EAAI,cAIjCA,EAAKA,EAAK,SAAc,EAAE,EAAI,WAI9BA,EAAKA,EAAK,gBAAqB,EAAE,EAAI,iBACzC,GAAGA,IAASA,EAAO,CAAA,EAAG,ECrEf,SAASC,GAAaC,EAAO,CAChC,MAAMC,EAAOH,EAAKE,CAAK,EACvB,OAAI,OAAOC,GAAQ,SACRD,EAAM,WAETC,EAAK,CAAC,EAAE,YAAa,EACzBA,EAAK,UAAU,CAAC,EAAE,QAAQ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