{"version":3,"file":"any.cjs","names":["BinaryWriter","BinaryReader"],"sources":["../../../../src/proto/google/protobuf/any.ts"],"sourcesContent":["// Code generated by protoc-gen-ts_proto. DO NOT EDIT.\n// versions:\n//   protoc-gen-ts_proto  v2.11.6\n//   protoc               v6.33.4\n// source: google/protobuf/any.proto\n\n/* eslint-disable */\nimport { BinaryReader, BinaryWriter } from \"@bufbuild/protobuf/wire\";\n\nexport const protobufPackage = \"google.protobuf\";\n\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\": <string>,\n *       \"lastName\": <string>\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 */\nexport interface Any {\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  type_url: string;\n  /** Must be a valid serialized protocol buffer of the above specified type. */\n  value: Uint8Array;\n}\n\nfunction createBaseAny(): Any {\n  return { type_url: \"\", value: new Uint8Array(0) };\n}\n\nexport const Any: MessageFns<Any> = {\n  encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {\n    if (message.type_url !== \"\") {\n      writer.uint32(10).string(message.type_url);\n    }\n    if (message.value.length !== 0) {\n      writer.uint32(18).bytes(message.value);\n    }\n    return writer;\n  },\n\n  decode(input: BinaryReader | Uint8Array, length?: number): Any {\n    const reader = input instanceof BinaryReader ? input : new BinaryReader(input);\n    const end = length === undefined ? reader.len : reader.pos + length;\n    const message = createBaseAny();\n    while (reader.pos < end) {\n      const tag = reader.uint32();\n      switch (tag >>> 3) {\n        case 1: {\n          if (tag !== 10) {\n            break;\n          }\n\n          message.type_url = reader.string();\n          continue;\n        }\n        case 2: {\n          if (tag !== 18) {\n            break;\n          }\n\n          message.value = reader.bytes();\n          continue;\n        }\n      }\n      if ((tag & 7) === 4 || tag === 0) {\n        break;\n      }\n      reader.skip(tag & 7);\n    }\n    return message;\n  },\n\n  fromJSON(object: any): Any {\n    return {\n      type_url: isSet(object.type_url) ? globalThis.String(object.type_url) : \"\",\n      value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),\n    };\n  },\n\n  toJSON(message: Any): unknown {\n    const obj: any = {};\n    if (message.type_url !== undefined) {\n      obj.type_url = message.type_url;\n    }\n    if (message.value !== undefined) {\n      obj.value = base64FromBytes(message.value);\n    }\n    return obj;\n  },\n\n  create<I extends Exact<DeepPartial<Any>, I>>(base?: I): Any {\n    return Any.fromPartial(base ?? ({} as any));\n  },\n  fromPartial<I extends Exact<DeepPartial<Any>, I>>(object: I): Any {\n    const message = createBaseAny();\n    message.type_url = object.type_url ?? \"\";\n    message.value = object.value ?? new Uint8Array(0);\n    return message;\n  },\n};\n\nfunction bytesFromBase64(b64: string): Uint8Array {\n  if ((globalThis as any).Buffer) {\n    return Uint8Array.from((globalThis as any).Buffer.from(b64, \"base64\"));\n  } else {\n    const bin = globalThis.atob(b64);\n    const arr = new Uint8Array(bin.length);\n    for (let i = 0; i < bin.length; ++i) {\n      arr[i] = bin.charCodeAt(i);\n    }\n    return arr;\n  }\n}\n\nfunction base64FromBytes(arr: Uint8Array): string {\n  if ((globalThis as any).Buffer) {\n    return (globalThis as any).Buffer.from(arr).toString(\"base64\");\n  } else {\n    const bin: string[] = [];\n    arr.forEach((byte) => {\n      bin.push(globalThis.String.fromCharCode(byte));\n    });\n    return globalThis.btoa(bin.join(\"\"));\n  }\n}\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;\n\nexport type DeepPartial<T> = T extends Builtin ? T\n  : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>\n  : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n  : Partial<T>;\n\ntype KeysOfUnion<T> = T extends T ? keyof T : never;\nexport type Exact<P, I extends P> = P extends Builtin ? P\n  : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };\n\nfunction isSet(value: any): boolean {\n  return value !== null && value !== undefined;\n}\n\nexport interface MessageFns<T> {\n  encode(message: T, writer?: BinaryWriter): BinaryWriter;\n  decode(input: BinaryReader | Uint8Array, length?: number): T;\n  fromJSON(object: any): T;\n  toJSON(message: T): unknown;\n  create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;\n  fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;\n}\n"],"mappings":";AAsIA,SAAS,gBAAqB;AAC5B,QAAO;EAAE,UAAU;EAAI,OAAO,IAAI,WAAW,EAAE;EAAE;;AAGnD,MAAa,MAAuB;CAClC,OAAO,SAAc,SAAuB,IAAIA,wBAAAA,cAAc,EAAgB;AAC5E,MAAI,QAAQ,aAAa,GACvB,QAAO,OAAO,GAAG,CAAC,OAAO,QAAQ,SAAS;AAE5C,MAAI,QAAQ,MAAM,WAAW,EAC3B,QAAO,OAAO,GAAG,CAAC,MAAM,QAAQ,MAAM;AAExC,SAAO;;CAGT,OAAO,OAAkC,QAAsB;EAC7D,MAAM,SA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