OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-core / schema / spec / contract / hyperdispatch / messages.js

4030 lines · javascript ref:
const { c: e } = require("hyperschema/runtime"),
  d = 21
let o = d
const n = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), length: e.uint.decode(d) }),
  },
  c = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.uint.preencode(d, o.seq))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, o.seq))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), seq: e.uint.decode(d) }),
  },
  r = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey), e.fixed32.preencode(d, o.secretKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.publicKey), e.fixed32.encode(d, o.secretKey))
    },
    decode: (d) => ({ publicKey: e.fixed32.decode(d), secretKey: e.fixed32.decode(d) }),
  },
  t = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey), e.fixed64.preencode(d, o.secretKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.publicKey), e.fixed64.encode(d, o.secretKey))
    },
    decode: (d) => ({ publicKey: e.fixed32.decode(d), secretKey: e.fixed64.decode(d) }),
  },
  i = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        d.end++,
        o.encryptionKey && e.buffer.preencode(d, o.encryptionKey),
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo))
    },
    encode(d, o) {
      const n = (o.encryptionKey ? 1 : 0) | (o.fastForwardTo ? 2 : 0)
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.encryptionKey && e.buffer.encode(d, o.encryptionKey),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d)
      return {
        key: o,
        encryptionKey: 1 & n ? e.buffer.decode(d) : null,
        fastForwardTo: 2 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  a = {
    preencode(d, o) {
      e.uint.preencode(d, o.timestamp)
    },
    encode(d, o) {
      e.uint.encode(d, o.timestamp)
    },
    decode: (d) => ({ timestamp: e.uint.decode(d) }),
  },
  s = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.blockOffset),
        e.uint.preencode(d, o.blockLength),
        e.uint.preencode(d, o.byteOffset),
        e.uint.preencode(d, o.byteLength))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.blockOffset),
        e.uint.encode(d, o.blockLength),
        e.uint.encode(d, o.byteOffset),
        e.uint.encode(d, o.byteLength))
    },
    decode: (d) => ({
      blockOffset: e.uint.decode(d),
      blockLength: e.uint.decode(d),
      byteOffset: e.uint.decode(d),
      byteLength: e.uint.decode(d),
    }),
  },
  p = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.width), e.uint.preencode(d, o.height))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.width), e.uint.encode(d, o.height))
    },
    decode: (d) => ({ width: e.uint.decode(d), height: e.uint.decode(d) }),
  },
  u = e.frame(p),
  l = {
    preencode(d, o) {
      ;(d.end++,
        o.name && e.string.preencode(d, o.name),
        o.mimetype && e.string.preencode(d, o.mimetype),
        o.dimensions && u.preencode(d, o.dimensions),
        o.userdata && e.buffer.preencode(d, o.userdata),
        o.duration && e.uint.preencode(d, o.duration))
    },
    encode(d, o) {
      const n =
        (o.name ? 1 : 0) |
        (o.mimetype ? 2 : 0) |
        (o.dimensions ? 4 : 0) |
        (o.userdata ? 8 : 0) |
        (o.duration ? 16 : 0) |
        (o.isPreview ? 32 : 0)
      ;(e.uint.encode(d, n),
        o.name && e.string.encode(d, o.name),
        o.mimetype && e.string.encode(d, o.mimetype),
        o.dimensions && u.encode(d, o.dimensions),
        o.userdata && e.buffer.encode(d, o.userdata),
        o.duration && e.uint.encode(d, o.duration))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        name: 1 & o ? e.string.decode(d) : null,
        mimetype: 2 & o ? e.string.decode(d) : null,
        dimensions: 4 & o ? u.decode(d) : null,
        userdata: 8 & o ? e.buffer.decode(d) : null,
        duration: 16 & o ? e.uint.decode(d) : 0,
        isPreview: !!(32 & o),
      }
    },
  },
  f = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.string.preencode(d, o.path),
        e.uint.preencode(d, o.version),
        e.uint.preencode(d, o.size))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key),
        e.string.encode(d, o.path),
        e.uint.encode(d, o.version),
        e.uint.encode(d, o.size))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      path: e.string.decode(d),
      version: e.uint.decode(d),
      size: e.uint.decode(d),
    }),
  },
  m = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), s.preencode(d, o.blob))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), s.encode(d, o.blob))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), blob: s.decode(d) }),
  },
  y = e.frame(m),
  x = e.frame(f),
  b = {
    preencode(d, o) {
      ;(d.end++,
        o.inlined && e.buffer.preencode(d, o.inlined),
        o.blob && s.preencode(d, o.blob),
        o.externalBlob && y.preencode(d, o.externalBlob),
        o.externalDrive && x.preencode(d, o.externalDrive))
    },
    encode(d, o) {
      const n =
        (o.inlined ? 1 : 0) |
        (o.blob ? 2 : 0) |
        (o.externalBlob ? 4 : 0) |
        (o.externalDrive ? 8 : 0)
      ;(e.uint.encode(d, n),
        o.inlined && e.buffer.encode(d, o.inlined),
        o.blob && s.encode(d, o.blob),
        o.externalBlob && y.encode(d, o.externalBlob),
        o.externalDrive && x.encode(d, o.externalDrive))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        inlined: 1 & o ? e.buffer.decode(d) : null,
        blob: 2 & o ? s.decode(d) : null,
        externalBlob: 4 & o ? y.decode(d) : null,
        externalDrive: 8 & o ? x.decode(d) : null,
      }
    },
  },
  k = e.frame(b),
  v = e.frame(l),
  g = {
    preencode(d, o) {
      ;(k.preencode(d, o.pointer),
        d.end++,
        o.metadata && v.preencode(d, o.metadata),
        o.preview && Qr.preencode(d, o.preview),
        o.hash && e.fixed32.preencode(d, o.hash))
    },
    encode(d, o) {
      const n = (o.metadata ? 1 : 0) | (o.preview ? 2 : 0) | (o.hash ? 4 : 0)
      ;(k.encode(d, o.pointer),
        e.uint.encode(d, n),
        o.metadata && v.encode(d, o.metadata),
        o.preview && Qr.encode(d, o.preview),
        o.hash && e.fixed32.encode(d, o.hash))
    },
    decode(d) {
      const o = k.decode(d),
        n = e.uint.decode(d)
      return {
        pointer: o,
        metadata: 1 & n ? v.decode(d) : null,
        preview: 2 & n ? Qr.decode(d) : null,
        hash: 4 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  h = e.frame(g),
  K = h,
  w = h,
  T = {
    preencode(e, d) {
      ;(e.end++,
        d.small && h.preencode(e, d.small),
        d.medium && K.preencode(e, d.medium),
        d.large && w.preencode(e, d.large))
    },
    encode(d, o) {
      const n = (o.small ? 1 : 0) | (o.medium ? 2 : 0) | (o.large ? 4 : 0)
      ;(e.uint.encode(d, n),
        o.small && h.encode(d, o.small),
        o.medium && K.encode(d, o.medium),
        o.large && w.encode(d, o.large))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        small: 1 & o ? h.decode(d) : null,
        medium: 2 & o ? K.decode(d) : null,
        large: 4 & o ? w.decode(d) : null,
      }
    },
  },
  P = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = o.isDeleted ? 1 : 0
      e.uint.encode(d, n)
    },
    decode: (d) => ({ isDeleted: !!(1 & e.uint.decode(d)) }),
  },
  A = e.frame(P),
  R = h,
  D = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.id),
        c.preencode(d, n.oplog),
        A.preencode(d, n.status),
        R.preencode(d, n.file),
        d.end++,
        o >= 14 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const r = o >= 14 && n.version ? 1 : 0
      ;(e.uint.encode(d, n.id),
        c.encode(d, n.oplog),
        A.encode(d, n.status),
        R.encode(d, n.file),
        e.uint.encode(d, r),
        o >= 14 && n.version && e.uint.encode(d, n.version))
    },
    decode(d) {
      const n = e.uint.decode(d),
        r = c.decode(d),
        t = A.decode(d),
        i = R.decode(d),
        a = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: n,
        oplog: r,
        status: t,
        file: i,
        version: o >= 14 && 1 & a ? e.uint.decode(d) : 0,
      }
    },
  },
  M = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isActive ? 1 : 0) | (o.isIndexing ? 2 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isActive: !!(1 & o), isIndexing: !!(2 & o) }
    },
  },
  S = {
    preencode(d, n) {
      const c =
        (n.isAdmin ? 1 : 0) |
        (n.isModerator ? 2 : 0) |
        (n.isPending ? 4 : 0) |
        (n.isActive ? 8 : 0) |
        (n.isMuted ? 16 : 0) |
        (n.isBanned ? 32 : 0) |
        (n.isShadowBanned ? 64 : 0) |
        (o >= 13 && n.isRemoved ? 128 : 0)
      e.uint.preencode(d, c)
    },
    encode(d, n) {
      const c =
        (n.isAdmin ? 1 : 0) |
        (n.isModerator ? 2 : 0) |
        (n.isPending ? 4 : 0) |
        (n.isActive ? 8 : 0) |
        (n.isMuted ? 16 : 0) |
        (n.isBanned ? 32 : 0) |
        (n.isShadowBanned ? 64 : 0) |
        (o >= 13 && n.isRemoved ? 128 : 0)
      e.uint.encode(d, c)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        isAdmin: !!(1 & n),
        isModerator: !!(2 & n),
        isPending: !!(4 & n),
        isActive: !!(8 & n),
        isMuted: !!(16 & n),
        isBanned: !!(32 & n),
        isShadowBanned: !!(64 & n),
        isRemoved: o >= 13 && !!(128 & n),
      }
    },
  },
  C = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isMuted ? 1 : 0) | (o.isBanned ? 2 : 0) | (o.isShadowBanned ? 4 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isMuted: !!(1 & o), isBanned: !!(2 & o), isShadowBanned: !!(4 & o) }
    },
  },
  L = {
    preencode(d, o) {
      e.uint.preencode(d, o.version)
    },
    encode(d, o) {
      e.uint.encode(d, o.version)
    },
    decode: (d) => ({ version: e.uint.decode(d) }),
  },
  q = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.total), e.uint.preencode(d, o.active))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.total), e.uint.encode(d, o.active))
    },
    decode: (d) => ({ total: e.uint.decode(d), active: e.uint.decode(d) }),
  },
  F = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.total), e.uint.preencode(d, o.active), e.uint.preencode(d, o.pending))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.total), e.uint.encode(d, o.active), e.uint.encode(d, o.pending))
    },
    decode: (d) => ({
      total: e.uint.decode(d),
      active: e.uint.decode(d),
      pending: e.uint.decode(d),
    }),
  },
  E = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.clock),
        e.uint.preencode(d, n.pinned),
        e.uint.preencode(d, n.threads),
        e.uint.preencode(d, n.timestamp),
        d.end++,
        o >= 15 && n.flagsClock && e.uint.preencode(d, n.flagsClock))
    },
    encode(d, n) {
      const c = o >= 15 && n.flagsClock ? 1 : 0
      ;(e.uint.encode(d, n.clock),
        e.uint.encode(d, n.pinned),
        e.uint.encode(d, n.threads),
        e.uint.encode(d, n.timestamp),
        e.uint.encode(d, c),
        o >= 15 && n.flagsClock && e.uint.encode(d, n.flagsClock))
    },
    decode(d) {
      const n = e.uint.decode(d),
        c = e.uint.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        clock: n,
        pinned: c,
        threads: r,
        timestamp: t,
        flagsClock: o >= 15 && 1 & i ? e.uint.decode(d) : 0,
      }
    },
  },
  B = {
    preencode(d, o) {
      e.uint.preencode(d, o.clock)
    },
    encode(d, o) {
      e.uint.encode(d, o.clock)
    },
    decode: (d) => ({ clock: e.uint.decode(d) }),
  },
  I = e.frame(q),
  N = e.frame(F),
  j = e.frame(E),
  U = e.frame(B),
  O = {
    preencode(e, d) {
      ;(I.preencode(e, d.devices),
        N.preencode(e, d.members),
        j.preencode(e, d.chat),
        U.preencode(e, d.files))
    },
    encode(e, d) {
      ;(I.encode(e, d.devices), N.encode(e, d.members), j.encode(e, d.chat), U.encode(e, d.files))
    },
    decode: (e) => ({
      devices: I.decode(e),
      members: N.decode(e),
      chat: j.decode(e),
      files: U.decode(e),
    }),
  },
  J = { Default: 1, Broadcast: 2, DirectMessage: 3 },
  V = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 3) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  H = {
    preencode(d, n) {
      const c =
        (n.roomType ? 1 : 0) |
        (n.isExperimental ? 2 : 0) |
        (n.isJoiningDisabled ? 4 : 0) |
        (n.isAppendingDisabled ? 8 : 0) |
        (n.isCallingDisabled ? 16 : 0) |
        (n.isMembershipEventsDisabled ? 32 : 0) |
        (o >= 19 && n.isAttachmentsDisabled ? 64 : 0) |
        (o >= 19 && n.isLinksDisabled ? 128 : 0) |
        (o >= 20 && n.buildType ? 256 : 0)
      ;(e.uint.preencode(d, c),
        n.roomType && V.preencode(d, n.roomType),
        o >= 20 && n.buildType && Ur.preencode(d, n.buildType))
    },
    encode(d, n) {
      const c =
        (n.roomType ? 1 : 0) |
        (n.isExperimental ? 2 : 0) |
        (n.isJoiningDisabled ? 4 : 0) |
        (n.isAppendingDisabled ? 8 : 0) |
        (n.isCallingDisabled ? 16 : 0) |
        (n.isMembershipEventsDisabled ? 32 : 0) |
        (o >= 19 && n.isAttachmentsDisabled ? 64 : 0) |
        (o >= 19 && n.isLinksDisabled ? 128 : 0) |
        (o >= 20 && n.buildType ? 256 : 0)
      ;(e.uint.encode(d, c),
        n.roomType && V.encode(d, n.roomType),
        o >= 20 && n.buildType && Ur.encode(d, n.buildType))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        roomType: 1 & n ? V.decode(d) : 0,
        isExperimental: !!(2 & n),
        isJoiningDisabled: !!(4 & n),
        isAppendingDisabled: !!(8 & n),
        isCallingDisabled: !!(16 & n),
        isMembershipEventsDisabled: !!(32 & n),
        isAttachmentsDisabled: o >= 19 && !!(64 & n),
        isLinksDisabled: o >= 19 && !!(128 & n),
        buildType: o >= 20 && 256 & n ? Ur.decode(d) : null,
      }
    },
  },
  z = e.frame(L),
  G = e.frame(H),
  Q = {
    preencode(d, o) {
      ;(z.preencode(d, o.abi), G.preencode(d, o.settings), e.uint.preencode(d, o.creationTime))
    },
    encode(d, o) {
      ;(z.encode(d, o.abi), G.encode(d, o.settings), e.uint.encode(d, o.creationTime))
    },
    decode: (d) => ({ abi: z.decode(d), settings: G.decode(d), creationTime: e.uint.decode(d) }),
  },
  W = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.seed)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.seed)
    },
    decode: (d) => ({ seed: e.fixed32.decode(d) }),
  },
  X = {
    preencode(d, o) {
      ;(r.preencode(d, o.mailboxKeyPair),
        t.preencode(d, o.discoveryKeyPair),
        e.fixed32.preencode(d, o.wakeupTopic),
        e.fixed32.preencode(d, o.swarmTopic))
    },
    encode(d, o) {
      ;(r.encode(d, o.mailboxKeyPair),
        t.encode(d, o.discoveryKeyPair),
        e.fixed32.encode(d, o.wakeupTopic),
        e.fixed32.encode(d, o.swarmTopic))
    },
    decode: (d) => ({
      mailboxKeyPair: r.decode(d),
      discoveryKeyPair: t.decode(d),
      wakeupTopic: e.fixed32.decode(d),
      swarmTopic: e.fixed32.decode(d),
    }),
  },
  Y = e.array(e.fixed32),
  Z = {
    preencode(d, n) {
      ;(d.end++,
        n.title && e.string.preencode(d, n.title),
        n.avatar && Wr.preencode(d, n.avatar),
        n.description && e.string.preencode(d, n.description),
        o >= 11 && n.supportedLanguages && Xr.preencode(d, n.supportedLanguages),
        o >= 13 && n.blindPeers && Y.preencode(d, n.blindPeers))
    },
    encode(d, n) {
      const c =
        (n.title ? 1 : 0) |
        (n.avatar ? 2 : 0) |
        (n.description ? 4 : 0) |
        (o >= 11 && n.supportedLanguages ? 8 : 0) |
        (o >= 13 && n.blindPeers ? 16 : 0)
      ;(e.uint.encode(d, c),
        n.title && e.string.encode(d, n.title),
        n.avatar && Wr.encode(d, n.avatar),
        n.description && e.string.encode(d, n.description),
        o >= 11 && n.supportedLanguages && Xr.encode(d, n.supportedLanguages),
        o >= 13 && n.blindPeers && Y.encode(d, n.blindPeers))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        title: 1 & n ? e.string.decode(d) : null,
        avatar: 2 & n ? Wr.decode(d) : null,
        description: 4 & n ? e.string.decode(d) : null,
        supportedLanguages: o >= 11 && 8 & n ? Xr.decode(d) : null,
        blindPeers: o >= 13 && 16 & n ? Y.decode(d) : null,
      }
    },
  },
  $ = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.key)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.key)
    },
    decode: (d) => ({ key: e.fixed32.decode(d) }),
  },
  _ = e.frame(a),
  ee = e.frame($),
  de = {
    preencode(e, d) {
      ;(_.preencode(e, d.header), ee.preencode(e, d.peer))
    },
    encode(e, d) {
      ;(_.encode(e, d.header), ee.encode(e, d.peer))
    },
    decode: (e) => ({ header: _.decode(e), peer: ee.decode(e) }),
  },
  oe = _,
  ne = {
    preencode(d, o) {
      ;(oe.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(oe.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: oe.decode(d), key: e.fixed32.decode(d) }),
  },
  ce = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey), e.buffer.preencode(d, o.proof))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.memberKey), e.buffer.encode(d, o.proof))
    },
    decode: (d) => ({ memberKey: e.fixed32.decode(d), proof: e.buffer.decode(d) }),
  },
  re = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id), e.buffer.preencode(d, o.response))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), e.buffer.encode(d, o.response))
    },
    decode: (d) => ({ id: e.fixed32.decode(d), response: e.buffer.decode(d) }),
  },
  te = e.frame(M),
  ie = e.frame(re),
  ae = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.fixed32.preencode(d, o.memberKey),
        te.preencode(d, o.status),
        Yr.preencode(d, o.profile),
        d.end++,
        o.invitation && ie.preencode(d, o.invitation))
    },
    encode(d, o) {
      const n = o.invitation ? 1 : 0
      ;(e.fixed32.encode(d, o.key),
        e.fixed32.encode(d, o.memberKey),
        te.encode(d, o.status),
        Yr.encode(d, o.profile),
        e.uint.encode(d, n),
        o.invitation && ie.encode(d, o.invitation))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      memberKey: e.fixed32.decode(d),
      status: te.decode(d),
      profile: Yr.decode(d),
      invitation: 1 & e.uint.decode(d) ? ie.decode(d) : null,
    }),
  },
  se = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.timestamp),
        d.end++,
        o.mailbox && e.fixed32.preencode(d, o.mailbox),
        o.displayName && e.string.preencode(d, o.displayName),
        o.avatar && Zr.preencode(d, o.avatar),
        o.username && e.string.preencode(d, o.username))
    },
    encode(d, o) {
      const n =
        (o.mailbox ? 1 : 0) | (o.displayName ? 2 : 0) | (o.avatar ? 4 : 0) | (o.username ? 8 : 0)
      ;(e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.mailbox && e.fixed32.encode(d, o.mailbox),
        o.displayName && e.string.encode(d, o.displayName),
        o.avatar && Zr.encode(d, o.avatar),
        o.username && e.string.encode(d, o.username))
    },
    decode(d) {
      const o = e.uint.decode(d),
        n = e.uint.decode(d)
      return {
        timestamp: o,
        mailbox: 1 & n ? e.fixed32.decode(d) : null,
        displayName: 2 & n ? e.string.decode(d) : null,
        avatar: 4 & n ? Zr.decode(d) : null,
        username: 8 & n ? e.string.decode(d) : null,
      }
    },
  },
  pe = {
    preencode(d, n) {
      ;(d.end++,
        n.swarmKey && e.fixed32.preencode(d, n.swarmKey),
        n.name && e.string.preencode(d, n.name),
        o >= 20 && n.buildType && Ur.preencode(d, n.buildType))
    },
    encode(d, n) {
      const c =
        (n.swarmKey ? 1 : 0) |
        (n.name ? 2 : 0) |
        (n.isMobile ? 4 : 0) |
        (o >= 20 && n.buildType ? 8 : 0)
      ;(e.uint.encode(d, c),
        n.swarmKey && e.fixed32.encode(d, n.swarmKey),
        n.name && e.string.encode(d, n.name),
        o >= 20 && n.buildType && Ur.encode(d, n.buildType))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        swarmKey: 1 & n ? e.fixed32.decode(d) : null,
        name: 2 & n ? e.string.decode(d) : null,
        isMobile: !!(4 & n),
        buildType: o >= 20 && 8 & n ? Ur.decode(d) : null,
      }
    },
  },
  ue = e.frame(se),
  le = {
    preencode(e, d) {
      ;(ue.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(ue.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: ue.decode(e), attestation: ce.decode(e) }),
  },
  fe = {
    preencode(e, d) {
      ;($r.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;($r.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: $r.decode(e), attestation: ce.decode(e) }),
  },
  me = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        e.buffer.preencode(d, o.data),
        e.buffer.preencode(d, o.signature))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), e.buffer.encode(d, o.data), e.buffer.encode(d, o.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      data: e.buffer.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  ye = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.devicePublicKey)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.devicePublicKey)
    },
    decode: (d) => ({ devicePublicKey: e.fixed32.decode(d) }),
  },
  xe = {
    preencode(d, o) {
      ;(ce.preencode(d, o.privateProfileIdentity), e.buffer.preencode(d, o.deviceProof))
    },
    encode(d, o) {
      ;(ce.encode(d, o.privateProfileIdentity), e.buffer.encode(d, o.deviceProof))
    },
    decode: (d) => ({ privateProfileIdentity: ce.decode(d), deviceProof: e.buffer.decode(d) }),
  },
  be = e.frame(fe),
  ke = e.frame(le),
  ve = e.frame(ye),
  ge = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey),
        t.preencode(d, o.keyPair),
        be.preencode(d, o.device),
        ke.preencode(d, o.member),
        d.end++,
        o.identity && ve.preencode(d, o.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(e.fixed32.encode(d, o.deviceKey),
        t.encode(d, o.keyPair),
        be.encode(d, o.device),
        ke.encode(d, o.member),
        e.uint.encode(d, n),
        o.identity && ve.encode(d, o.identity))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      keyPair: t.decode(d),
      device: be.decode(d),
      member: ke.decode(d),
      identity: 1 & e.uint.decode(d) ? ve.decode(d) : null,
    }),
  },
  he = e.frame(ge),
  Ke = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        he.preencode(d, o.request),
        e.buffer.preencode(d, o.signature))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), he.encode(d, o.request), e.buffer.encode(d, o.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      request: he.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  we = be,
  Te = ke,
  Pe = {
    preencode(e, d) {
      ;(we.preencode(e, d.device), e.end++, d.member && Te.preencode(e, d.member))
    },
    encode(d, o) {
      const n = o.member ? 1 : 0
      ;(we.encode(d, o.device), e.uint.encode(d, n), o.member && Te.encode(d, o.member))
    },
    decode: (d) => ({ device: we.decode(d), member: 1 & e.uint.decode(d) ? Te.decode(d) : null }),
  },
  Ae = e.frame(Ke),
  Re = e.frame(Pe),
  De = {
    preencode(e, d) {
      ;(e.end++,
        d.withInvitation && Ae.preencode(e, d.withInvitation),
        d.withMemberProof && Re.preencode(e, d.withMemberProof))
    },
    encode(d, o) {
      const n = (o.withInvitation ? 1 : 0) | (o.withMemberProof ? 2 : 0)
      ;(e.uint.encode(d, n),
        o.withInvitation && Ae.encode(d, o.withInvitation),
        o.withMemberProof && Re.encode(d, o.withMemberProof))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        withInvitation: 1 & o ? Ae.decode(d) : null,
        withMemberProof: 2 & o ? Re.decode(d) : null,
      }
    },
  },
  Me = e.frame(me),
  Se = e.frame(xe),
  Ce = {
    preencode(e, d) {
      ;(Me.preencode(e, d.signedKeys), e.end++, d.identity && Se.preencode(e, d.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(Me.encode(d, o.signedKeys), e.uint.encode(d, n), o.identity && Se.encode(d, o.identity))
    },
    decode: (d) => ({
      signedKeys: Me.decode(d),
      identity: 1 & e.uint.decode(d) ? Se.decode(d) : null,
    }),
  },
  Le = {
    preencode(d, n) {
      ;(d.end++,
        n.expiration && e.uint.preencode(d, n.expiration),
        o >= 20 && n.buildType && Ur.preencode(d, n.buildType))
    },
    encode(d, n) {
      const c =
        (n.expiration ? 1 : 0) |
        (n.requiresConfirmation ? 2 : 0) |
        (n.canModerate ? 4 : 0) |
        (n.canAdmin ? 8 : 0) |
        (o >= 20 && n.buildType ? 16 : 0)
      ;(e.uint.encode(d, c),
        n.expiration && e.uint.encode(d, n.expiration),
        o >= 20 && n.buildType && Ur.encode(d, n.buildType))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        expiration: 1 & n ? e.uint.decode(d) : 0,
        requiresConfirmation: !!(2 & n),
        canModerate: !!(4 & n),
        canAdmin: !!(8 & n),
        buildType: o >= 20 && 16 & n ? Ur.decode(d) : null,
      }
    },
  },
  qe = Me,
  Fe = e.frame(Le),
  Ee = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        qe.preencode(d, o.response),
        Fe.preencode(d, o.metadata),
        d.end++,
        o.anchor && n.preencode(d, o.anchor))
    },
    encode(d, o) {
      const c = (o.anchor ? 1 : 0) | (o.isActive ? 2 : 0)
      ;(e.fixed32.encode(d, o.id),
        qe.encode(d, o.response),
        Fe.encode(d, o.metadata),
        e.uint.encode(d, c),
        o.anchor && n.encode(d, o.anchor))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = qe.decode(d),
        r = Fe.decode(d),
        t = e.uint.decode(d)
      return {
        id: o,
        response: c,
        metadata: r,
        anchor: 1 & t ? n.decode(d) : null,
        isActive: !!(2 & t),
      }
    },
  },
  Be = _,
  Ie = e.frame(Ee),
  Ne = {
    preencode(e, d) {
      ;(Be.preencode(e, d.header), Ie.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Be.encode(e, d.header), Ie.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Be.decode(e), invitation: Ie.decode(e) }),
  },
  je = _,
  Ue = {
    preencode(d, o) {
      ;(je.preencode(d, o.header), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(je.encode(d, o.header), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ header: je.decode(d), id: e.fixed32.decode(d) }),
  },
  Oe = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        e.fixed32.preencode(d, o.invitationSeed),
        n.preencode(d, o.anchor))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.mailbox),
        e.fixed32.encode(d, o.invitationSeed),
        n.encode(d, o.anchor))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      anchor: n.decode(d),
    }),
  },
  Je = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        e.fixed32.preencode(d, o.invitationSeed),
        n.preencode(d, o.anchor),
        e.fixed32.preencode(d, o.identityPublicKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.mailbox),
        e.fixed32.encode(d, o.invitationSeed),
        n.encode(d, o.anchor),
        e.fixed32.encode(d, o.identityPublicKey))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      anchor: n.decode(d),
      identityPublicKey: e.fixed32.decode(d),
    }),
  },
  Ve = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.mailbox)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.mailbox)
    },
    decode: (d) => ({ mailbox: e.fixed32.decode(d) }),
  },
  He = e.frame(Oe),
  ze = e.frame(Je),
  Ge = e.frame(Ve),
  Qe = e.array(e.ipv4Address),
  We = {
    preencode(e, d) {
      ;(e.end++,
        d.room && He.preencode(e, d.room),
        d.identity && ze.preencode(e, d.identity),
        d.contact && Ge.preencode(e, d.contact),
        o >= 6 && d.readonly && _r.preencode(e, d.readonly),
        o >= 11 && d.additionalNodes && Qe.preencode(e, d.additionalNodes),
        o >= 20 && d.buildType && Ur.preencode(e, d.buildType))
    },
    encode(d, n) {
      const c =
        (n.room ? 1 : 0) |
        (n.identity ? 2 : 0) |
        (n.contact ? 4 : 0) |
        (o >= 6 && n.readonly ? 8 : 0) |
        (o >= 11 && n.additionalNodes ? 16 : 0) |
        (o >= 20 && n.buildType ? 32 : 0)
      ;(e.uint.encode(d, c),
        n.room && He.encode(d, n.room),
        n.identity && ze.encode(d, n.identity),
        n.contact && Ge.encode(d, n.contact),
        o >= 6 && n.readonly && _r.encode(d, n.readonly),
        o >= 11 && n.additionalNodes && Qe.encode(d, n.additionalNodes),
        o >= 20 && n.buildType && Ur.encode(d, n.buildType))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        room: 1 & n ? He.decode(d) : null,
        identity: 2 & n ? ze.decode(d) : null,
        contact: 4 & n ? Ge.decode(d) : null,
        readonly: o >= 6 && 8 & n ? _r.decode(d) : null,
        additionalNodes: o >= 11 && 16 & n ? Qe.decode(d) : null,
        buildType: o >= 20 && 32 & n ? Ur.decode(d) : null,
      }
    },
  },
  Xe = _,
  Ye = {
    preencode(d, o) {
      ;(Xe.preencode(d, o.header), e.buffer.preencode(d, o.blindRequest))
    },
    encode(d, o) {
      ;(Xe.encode(d, o.header), e.buffer.encode(d, o.blindRequest))
    },
    decode: (d) => ({ header: Xe.decode(d), blindRequest: e.buffer.decode(d) }),
  },
  Ze = _,
  $e = {
    preencode(e, d) {
      ;(Ze.preencode(e, d.header), e.end++, d.profile && et.preencode(e, d.profile))
    },
    encode(d, o) {
      const n = o.profile ? 1 : 0
      ;(Ze.encode(d, o.header), e.uint.encode(d, n), o.profile && et.encode(d, o.profile))
    },
    decode: (d) => ({ header: Ze.decode(d), profile: 1 & e.uint.decode(d) ? et.decode(d) : null }),
  },
  _e = { preencode(e, d) {}, encode(e, d) {}, decode: (e) => ({}) },
  ed = _e,
  dd = he,
  od = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey),
        e.fixed32.preencode(d, o.id),
        dd.preencode(d, o.request))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.deviceKey), e.fixed32.encode(d, o.id), dd.encode(d, o.request))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      id: e.fixed32.decode(d),
      request: dd.decode(d),
    }),
  },
  nd = _,
  cd = Se,
  rd = {
    preencode(d, o) {
      ;(nd.preencode(d, o.header),
        e.fixed32.preencode(d, o.deviceKey),
        d.end++,
        o.identity && cd.preencode(d, o.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(nd.encode(d, o.header),
        e.fixed32.encode(d, o.deviceKey),
        e.uint.encode(d, n),
        o.identity && cd.encode(d, o.identity))
    },
    decode: (d) => ({
      header: nd.decode(d),
      deviceKey: e.fixed32.decode(d),
      identity: 1 & e.uint.decode(d) ? cd.decode(d) : null,
    }),
  },
  td = _,
  id = {
    preencode(d, o) {
      ;(td.preencode(d, o.header), e.fixed32.preencode(d, o.deviceKey))
    },
    encode(d, o) {
      ;(td.encode(d, o.header), e.fixed32.encode(d, o.deviceKey))
    },
    decode: (d) => ({ header: td.decode(d), deviceKey: e.fixed32.decode(d) }),
  },
  ad = e.frame(S),
  sd = ue,
  pd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), ad.preencode(d, o.status), sd.preencode(d, o.profile))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), ad.encode(d, o.status), sd.encode(d, o.profile))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), status: ad.decode(d), profile: sd.decode(d) }),
  },
  ud = ad,
  ld = ue,
  fd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        ud.preencode(d, o.status),
        ld.preencode(d, o.profile),
        d.end++,
        o.proofs && dt.preencode(d, o.proofs))
    },
    encode(d, o) {
      const n = o.proofs ? 1 : 0
      ;(e.fixed32.encode(d, o.key),
        ud.encode(d, o.status),
        ld.encode(d, o.profile),
        e.uint.encode(d, n),
        o.proofs && dt.encode(d, o.proofs))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      status: ud.decode(d),
      profile: ld.decode(d),
      proofs: 1 & e.uint.decode(d) ? dt.decode(d) : null,
    }),
  },
  md = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        d.end++,
        o.profileAttestation && e.buffer.preencode(d, o.profileAttestation),
        o.latestReceipt && e.buffer.preencode(d, o.latestReceipt))
    },
    encode(d, o) {
      const n = (o.profileAttestation ? 1 : 0) | (o.latestReceipt ? 2 : 0)
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.profileAttestation && e.buffer.encode(d, o.profileAttestation),
        o.latestReceipt && e.buffer.encode(d, o.latestReceipt))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d)
      return {
        key: o,
        profileAttestation: 1 & n ? e.buffer.decode(d) : null,
        latestReceipt: 2 & n ? e.buffer.decode(d) : null,
      }
    },
  },
  yd = _,
  xd = ke,
  bd = {
    preencode(e, d) {
      ;(yd.preencode(e, d.header), xd.preencode(e, d.member))
    },
    encode(e, d) {
      ;(yd.encode(e, d.header), xd.encode(e, d.member))
    },
    decode: (e) => ({ header: yd.decode(e), member: xd.decode(e) }),
  },
  kd = _,
  vd = e.frame(C),
  gd = {
    preencode(d, o) {
      ;(kd.preencode(d, o.header),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.key),
        vd.preencode(d, o.status))
    },
    encode(d, o) {
      ;(kd.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        vd.encode(d, o.status))
    },
    decode: (d) => ({
      header: kd.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: vd.decode(d),
    }),
  },
  hd = _,
  Kd = {
    preencode(d, o) {
      ;(hd.preencode(d, o.header), e.fixed32.preencode(d, o.key), d.end++)
    },
    encode(d, o) {
      const n = (o.isModerator ? 1 : 0) | (o.isAdmin ? 2 : 0)
      ;(hd.encode(d, o.header), e.fixed32.encode(d, o.key), e.uint.encode(d, n))
    },
    decode(d) {
      const o = hd.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return { header: o, key: n, isModerator: !!(1 & c), isAdmin: !!(2 & c) }
    },
  },
  wd = _,
  Td = {
    preencode(d, o) {
      ;(wd.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(wd.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: wd.decode(d), key: e.fixed32.decode(d) }),
  },
  Pd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.uint.preencode(d, o.mentions))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, o.mentions))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), mentions: e.uint.decode(d) }),
  },
  Ad = {
    preencode(d, o) {
      ;(d.end++, o.memberKey && e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      const n = o.memberKey ? 1 : 0
      ;(e.uint.encode(d, n), o.memberKey && e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ memberKey: 1 & e.uint.decode(d) ? e.fixed32.decode(d) : null }),
  },
  Rd = Ad,
  Dd = {
    preencode(d, o) {
      ;(d.end++, o.from && e.string.preencode(d, o.from), o.to && e.string.preencode(d, o.to))
    },
    encode(d, o) {
      const n = (o.from ? 1 : 0) | (o.to ? 2 : 0)
      ;(e.uint.encode(d, n), o.from && e.string.encode(d, o.from), o.to && e.string.encode(d, o.to))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { from: 1 & o ? e.string.decode(d) : null, to: 2 & o ? e.string.decode(d) : null }
    },
  },
  Md = e.frame(Ad),
  Sd = e.frame(Rd),
  Cd = e.frame(Dd),
  Ld = {
    preencode(d, n) {
      const c =
        (n.memberJoined ? 1 : 0) |
        (n.memberLeft ? 2 : 0) |
        (n.titleChanged ? 4 : 0) |
        (n.callStarted ? 8 : 0) |
        (n.callHangup ? 16 : 0) |
        (n.callMissed ? 32 : 0) |
        (o >= 3 && n.roomAvatarChanged ? 64 : 0) |
        (o >= 3 && n.invitationCreated ? 128 : 0) |
        (o >= 3 && n.memberRemoved ? 256 : 0) |
        (o >= 18 && n.locationShared ? 512 : 0)
      ;(e.uint.preencode(d, c),
        n.memberJoined && Md.preencode(d, n.memberJoined),
        n.memberLeft && Sd.preencode(d, n.memberLeft),
        n.titleChanged && Cd.preencode(d, n.titleChanged),
        o >= 3 && n.memberRemoved && ot.preencode(d, n.memberRemoved),
        o >= 18 && n.locationShared && nt.preencode(d, n.locationShared))
    },
    encode(d, n) {
      const c =
        (n.memberJoined ? 1 : 0) |
        (n.memberLeft ? 2 : 0) |
        (n.titleChanged ? 4 : 0) |
        (n.callStarted ? 8 : 0) |
        (n.callHangup ? 16 : 0) |
        (n.callMissed ? 32 : 0) |
        (o >= 3 && n.roomAvatarChanged ? 64 : 0) |
        (o >= 3 && n.invitationCreated ? 128 : 0) |
        (o >= 3 && n.memberRemoved ? 256 : 0) |
        (o >= 18 && n.locationShared ? 512 : 0)
      ;(e.uint.encode(d, c),
        n.memberJoined && Md.encode(d, n.memberJoined),
        n.memberLeft && Sd.encode(d, n.memberLeft),
        n.titleChanged && Cd.encode(d, n.titleChanged),
        o >= 3 && n.memberRemoved && ot.encode(d, n.memberRemoved),
        o >= 18 && n.locationShared && nt.encode(d, n.locationShared))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        memberJoined: 1 & n ? Md.decode(d) : null,
        memberLeft: 2 & n ? Sd.decode(d) : null,
        titleChanged: 4 & n ? Cd.decode(d) : null,
        callStarted: !!(8 & n),
        callHangup: !!(16 & n),
        callMissed: !!(32 & n),
        roomAvatarChanged: o >= 3 && !!(64 & n),
        invitationCreated: o >= 3 && !!(128 & n),
        memberRemoved: o >= 3 && 256 & n ? ot.decode(d) : null,
        locationShared: o >= 18 && 512 & n ? nt.decode(d) : null,
      }
    },
  },
  qd = {
    preencode(e, d) {
      ;(e.end++, o >= 18 && d.locationShared && ct.preencode(e, d.locationShared))
    },
    encode(d, n) {
      const c =
        (n.callStarted ? 1 : 0) |
        (n.callHangup ? 2 : 0) |
        (n.callMissed ? 4 : 0) |
        (o >= 18 && n.locationShared ? 8 : 0)
      ;(e.uint.encode(d, c), o >= 18 && n.locationShared && ct.encode(d, n.locationShared))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        callStarted: !!(1 & n),
        callHangup: !!(2 & n),
        callMissed: !!(4 & n),
        locationShared: o >= 18 && 8 & n ? ct.decode(d) : null,
      }
    },
  },
  Fd = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.start), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.start), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ start: e.uint.decode(d), length: e.uint.decode(d) }),
  },
  Ed = e.frame(Fd),
  Bd = {
    preencode(d, o) {
      ;(Ed.preencode(d, o.range), e.string.preencode(d, o.content))
    },
    encode(d, o) {
      ;(Ed.encode(d, o.range), e.string.encode(d, o.content))
    },
    decode: (d) => ({ range: Ed.decode(d), content: e.string.decode(d) }),
  },
  Id = Ed,
  Nd = {
    preencode(d, o) {
      ;(Id.preencode(d, o.range), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Id.encode(d, o.range), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ range: Id.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  jd = h,
  Ud = e.array(e.uint),
  Od = {
    preencode(d, n) {
      ;(d.end++,
        n.title && e.string.preencode(d, n.title),
        n.description && e.string.preencode(d, n.description),
        n.file && jd.preencode(d, n.file),
        o >= 7 && n.files && Ud.preencode(d, n.files))
    },
    encode(d, n) {
      const c =
        (n.title ? 1 : 0) | (n.description ? 2 : 0) | (n.file ? 4 : 0) | (o >= 7 && n.files ? 8 : 0)
      ;(e.uint.encode(d, c),
        n.title && e.string.encode(d, n.title),
        n.description && e.string.encode(d, n.description),
        n.file && jd.encode(d, n.file),
        o >= 7 && n.files && Ud.encode(d, n.files))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        title: 1 & n ? e.string.decode(d) : null,
        description: 2 & n ? e.string.decode(d) : null,
        file: 4 & n ? jd.decode(d) : null,
        files: o >= 7 && 8 & n ? Ud.decode(d) : null,
      }
    },
  },
  Jd = Ed,
  Vd = e.frame(Od),
  Hd = {
    preencode(d, o) {
      ;(Jd.preencode(d, o.range),
        e.string.preencode(d, o.url),
        d.end++,
        o.preview && Vd.preencode(d, o.preview))
    },
    encode(d, o) {
      const n = o.preview ? 1 : 0
      ;(Jd.encode(d, o.range),
        e.string.encode(d, o.url),
        e.uint.encode(d, n),
        o.preview && Vd.encode(d, o.preview))
    },
    decode: (d) => ({
      range: Jd.decode(d),
      url: e.string.decode(d),
      preview: 1 & e.uint.decode(d) ? Vd.decode(d) : null,
    }),
  },
  zd = e.array(e.frame(Nd)),
  Gd = e.array(e.frame(Hd)),
  Qd = Gd,
  Wd = e.array(e.frame(Fd)),
  Xd = Wd,
  Yd = Wd,
  Zd = e.array(e.frame(Bd)),
  $d = Wd,
  _d = Wd,
  eo = {
    preencode(d, n) {
      const c =
        (n.mention ? 1 : 0) |
        (n.httpLink ? 2 : 0) |
        (n.pearLink ? 4 : 0) |
        (n.bold ? 8 : 0) |
        (n.italic ? 16 : 0) |
        (n.code ? 32 : 0) |
        (n.emoji ? 64 : 0) |
        (n.codeBlock ? 128 : 0) |
        (n.strike ? 256 : 0) |
        (o >= 11 && n.translation ? 512 : 0)
      ;(e.uint.preencode(d, c),
        n.mention && zd.preencode(d, n.mention),
        n.httpLink && Gd.preencode(d, n.httpLink),
        n.pearLink && Qd.preencode(d, n.pearLink),
        n.bold && Wd.preencode(d, n.bold),
        n.italic && Xd.preencode(d, n.italic),
        n.code && Yd.preencode(d, n.code),
        n.emoji && Zd.preencode(d, n.emoji),
        n.codeBlock && $d.preencode(d, n.codeBlock),
        n.strike && _d.preencode(d, n.strike),
        o >= 11 && n.translation && rt.preencode(d, n.translation))
    },
    encode(d, n) {
      const c =
        (n.mention ? 1 : 0) |
        (n.httpLink ? 2 : 0) |
        (n.pearLink ? 4 : 0) |
        (n.bold ? 8 : 0) |
        (n.italic ? 16 : 0) |
        (n.code ? 32 : 0) |
        (n.emoji ? 64 : 0) |
        (n.codeBlock ? 128 : 0) |
        (n.strike ? 256 : 0) |
        (o >= 11 && n.translation ? 512 : 0)
      ;(e.uint.encode(d, c),
        n.mention && zd.encode(d, n.mention),
        n.httpLink && Gd.encode(d, n.httpLink),
        n.pearLink && Qd.encode(d, n.pearLink),
        n.bold && Wd.encode(d, n.bold),
        n.italic && Xd.encode(d, n.italic),
        n.code && Yd.encode(d, n.code),
        n.emoji && Zd.encode(d, n.emoji),
        n.codeBlock && $d.encode(d, n.codeBlock),
        n.strike && _d.encode(d, n.strike),
        o >= 11 && n.translation && rt.encode(d, n.translation))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        mention: 1 & n ? zd.decode(d) : null,
        httpLink: 2 & n ? Gd.decode(d) : null,
        pearLink: 4 & n ? Qd.decode(d) : null,
        bold: 8 & n ? Wd.decode(d) : null,
        italic: 16 & n ? Xd.decode(d) : null,
        code: 32 & n ? Yd.decode(d) : null,
        emoji: 64 & n ? Zd.decode(d) : null,
        codeBlock: 128 & n ? $d.decode(d) : null,
        strike: 256 & n ? _d.decode(d) : null,
        translation: o >= 11 && 512 & n ? rt.decode(d) : null,
      }
    },
  },
  oo = e.array(e.frame(g)),
  no = e.frame(eo),
  co = e.frame(qd),
  ro = {
    preencode(d, o) {
      ;(d.end++,
        o.text && e.string.preencode(d, o.text),
        o.files && oo.preencode(d, o.files),
        o.display && no.preencode(d, o.display),
        o.replyTo && c.preencode(d, o.replyTo),
        o.parent && c.preencode(d, o.parent),
        o.event && co.preencode(d, o.event))
    },
    encode(d, n) {
      const r =
        (n.text ? 1 : 0) |
        (n.files ? 2 : 0) |
        (n.display ? 4 : 0) |
        (n.replyTo ? 8 : 0) |
        (n.parent ? 16 : 0) |
        (n.event ? 32 : 0) |
        (o >= 18 && n.forwarded ? 64 : 0)
      ;(e.uint.encode(d, r),
        n.text && e.string.encode(d, n.text),
        n.files && oo.encode(d, n.files),
        n.display && no.encode(d, n.display),
        n.replyTo && c.encode(d, n.replyTo),
        n.parent && c.encode(d, n.parent),
        n.event && co.encode(d, n.event))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        text: 1 & n ? e.string.decode(d) : null,
        files: 2 & n ? oo.decode(d) : null,
        display: 4 & n ? no.decode(d) : null,
        replyTo: 8 & n ? c.decode(d) : null,
        parent: 16 & n ? c.decode(d) : null,
        event: 32 & n ? co.decode(d) : null,
        forwarded: o >= 18 && !!(64 & n),
      }
    },
  },
  to = Ud,
  io = no,
  ao = {
    preencode(d, o) {
      ;(d.end++,
        o.text && e.string.preencode(d, o.text),
        o.files && to.preencode(d, o.files),
        o.display && io.preencode(d, o.display),
        o.replyTo && c.preencode(d, o.replyTo),
        o.parent && c.preencode(d, o.parent))
    },
    encode(d, n) {
      const r =
        (n.text ? 1 : 0) |
        (n.files ? 2 : 0) |
        (n.display ? 4 : 0) |
        (n.replyTo ? 8 : 0) |
        (n.parent ? 16 : 0) |
        (o >= 18 && n.forwarded ? 32 : 0)
      ;(e.uint.encode(d, r),
        n.text && e.string.encode(d, n.text),
        n.files && to.encode(d, n.files),
        n.display && io.encode(d, n.display),
        n.replyTo && c.encode(d, n.replyTo),
        n.parent && c.encode(d, n.parent))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        text: 1 & n ? e.string.decode(d) : null,
        files: 2 & n ? to.decode(d) : null,
        display: 4 & n ? io.decode(d) : null,
        replyTo: 8 & n ? c.decode(d) : null,
        parent: 16 & n ? c.decode(d) : null,
        forwarded: o >= 18 && !!(32 & n),
      }
    },
  },
  so = oo,
  po = no,
  uo = {
    preencode(d, o) {
      ;(d.end++,
        o.text && e.string.preencode(d, o.text),
        o.files && so.preencode(d, o.files),
        o.display && po.preencode(d, o.display),
        o.replyTo && c.preencode(d, o.replyTo),
        o.parent && c.preencode(d, o.parent))
    },
    encode(d, n) {
      const r =
        (n.text ? 1 : 0) |
        (n.files ? 2 : 0) |
        (n.display ? 4 : 0) |
        (n.replyTo ? 8 : 0) |
        (n.parent ? 16 : 0) |
        (o >= 18 && n.forwarded ? 32 : 0)
      ;(e.uint.encode(d, r),
        n.text && e.string.encode(d, n.text),
        n.files && so.encode(d, n.files),
        n.display && po.encode(d, n.display),
        n.replyTo && c.encode(d, n.replyTo),
        n.parent && c.encode(d, n.parent))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        text: 1 & n ? e.string.decode(d) : null,
        files: 2 & n ? so.decode(d) : null,
        display: 4 & n ? po.decode(d) : null,
        replyTo: 8 & n ? c.decode(d) : null,
        parent: 16 & n ? c.decode(d) : null,
        forwarded: o >= 18 && !!(32 & n),
      }
    },
  },
  lo = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isEdited ? 1 : 0) | (o.isDeleted ? 2 : 0) | (o.isPinned ? 4 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isEdited: !!(1 & o), isDeleted: !!(2 & o), isPinned: !!(4 & o) }
    },
  },
  fo = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.thread), e.uint.preencode(d, o.index))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.thread), e.uint.encode(d, o.index))
    },
    decode: (d) => ({ thread: e.uint.decode(d), index: e.uint.decode(d) }),
  },
  mo = e.frame(O),
  yo = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.id),
        e.uint.preencode(d, o.count),
        d.end++,
        o.parent && c.preencode(d, o.parent),
        o.stats && mo.preencode(d, o.stats))
    },
    encode(d, o) {
      const n = (o.parent ? 1 : 0) | (o.stats ? 2 : 0)
      ;(e.uint.encode(d, o.id),
        e.uint.encode(d, o.count),
        e.uint.encode(d, n),
        o.parent && c.encode(d, o.parent),
        o.stats && mo.encode(d, o.stats))
    },
    decode(d) {
      const o = e.uint.decode(d),
        n = e.uint.decode(d),
        r = e.uint.decode(d)
      return {
        id: o,
        count: n,
        parent: 1 & r ? c.decode(d) : null,
        stats: 2 & r ? mo.decode(d) : null,
      }
    },
  },
  xo = e.frame(lo),
  bo = e.frame(ao),
  ko = e.frame(Ld),
  vo = {
    preencode(d, o) {
      ;(fo.preencode(d, o.id),
        c.preencode(d, o.oplog),
        e.uint.preencode(d, o.clock),
        e.uint.preencode(d, o.timestamp),
        d.end++,
        o.editedAt && e.uint.preencode(d, o.editedAt),
        xo.preencode(d, o.status),
        o.message && bo.preencode(d, o.message),
        o.event && ko.preencode(d, o.event))
    },
    encode(d, o) {
      const n = (o.editedAt ? 1 : 0) | (o.message ? 2 : 0) | (o.event ? 4 : 0)
      ;(fo.encode(d, o.id),
        c.encode(d, o.oplog),
        e.uint.encode(d, o.clock),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.editedAt && e.uint.encode(d, o.editedAt),
        xo.encode(d, o.status),
        o.message && bo.encode(d, o.message),
        o.event && ko.encode(d, o.event))
    },
    decode(d) {
      const o = fo.decode(d),
        n = c.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: o,
        oplog: n,
        clock: r,
        timestamp: t,
        editedAt: 1 & i ? e.uint.decode(d) : 0,
        status: xo.decode(d),
        message: 2 & i ? bo.decode(d) : null,
        event: 4 & i ? ko.decode(d) : null,
      }
    },
  },
  go = xo,
  ho = e.frame(uo),
  Ko = ko,
  wo = {
    preencode(d, o) {
      ;(fo.preencode(d, o.id),
        c.preencode(d, o.oplog),
        e.uint.preencode(d, o.clock),
        e.uint.preencode(d, o.timestamp),
        d.end++,
        o.editedAt && e.uint.preencode(d, o.editedAt),
        go.preencode(d, o.status),
        o.message && ho.preencode(d, o.message),
        o.event && Ko.preencode(d, o.event))
    },
    encode(d, o) {
      const n = (o.editedAt ? 1 : 0) | (o.message ? 2 : 0) | (o.event ? 4 : 0)
      ;(fo.encode(d, o.id),
        c.encode(d, o.oplog),
        e.uint.encode(d, o.clock),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.editedAt && e.uint.encode(d, o.editedAt),
        go.encode(d, o.status),
        o.message && ho.encode(d, o.message),
        o.event && Ko.encode(d, o.event))
    },
    decode(d) {
      const o = fo.decode(d),
        n = c.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        id: o,
        oplog: n,
        clock: r,
        timestamp: t,
        editedAt: 1 & i ? e.uint.decode(d) : 0,
        status: go.decode(d),
        message: 2 & i ? ho.decode(d) : null,
        event: 4 & i ? Ko.decode(d) : null,
      }
    },
  },
  To = _,
  Po = e.frame(ro),
  Ao = {
    preencode(e, d) {
      ;(To.preencode(e, d.header), Po.preencode(e, d.message))
    },
    encode(e, d) {
      ;(To.encode(e, d.header), Po.encode(e, d.message))
    },
    decode: (e) => ({ header: To.decode(e), message: Po.decode(e) }),
  },
  Ro = _,
  Do = {
    preencode(e, d) {
      ;(Ro.preencode(e, d.header), c.preencode(e, d.oplog))
    },
    encode(e, d) {
      ;(Ro.encode(e, d.header), c.encode(e, d.oplog))
    },
    decode: (e) => ({ header: Ro.decode(e), oplog: c.decode(e) }),
  },
  Mo = _,
  So = Po,
  Co = {
    preencode(e, d) {
      ;(Mo.preencode(e, d.header), c.preencode(e, d.oplog), So.preencode(e, d.message))
    },
    encode(e, d) {
      ;(Mo.encode(e, d.header), c.encode(e, d.oplog), So.encode(e, d.message))
    },
    decode: (e) => ({ header: Mo.decode(e), oplog: c.decode(e), message: So.decode(e) }),
  },
  Lo = _,
  qo = {
    preencode(e, d) {
      ;(Lo.preencode(e, d.header), c.preencode(e, d.oplog), e.end++)
    },
    encode(d, o) {
      const n = o.isPinned ? 1 : 0
      ;(Lo.encode(d, o.header), c.encode(d, o.oplog), e.uint.encode(d, n))
    },
    decode: (d) => ({
      header: Lo.decode(d),
      oplog: c.decode(d),
      isPinned: !!(1 & e.uint.decode(d)),
    }),
  },
  Fo = {
    preencode(d, o) {
      ;(fo.preencode(d, o.id),
        e.fixed32.preencode(d, o.sender),
        e.uint.preencode(d, o.clock),
        e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(fo.encode(d, o.id),
        e.fixed32.encode(d, o.sender),
        e.uint.encode(d, o.clock),
        e.string.encode(d, o.reaction))
    },
    decode: (d) => ({
      id: fo.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      reaction: e.string.decode(d),
    }),
  },
  Eo = {
    preencode(d, o) {
      ;(e.string.preencode(d, o.text), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(e.string.encode(d, o.text), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ text: e.string.decode(d), count: e.uint.decode(d) }),
  },
  Bo = e.array(e.frame(Eo)),
  Io = {
    preencode(d, n) {
      ;(fo.preencode(d, n.id),
        e.uint.preencode(d, n.total),
        Bo.preencode(d, n.reactions),
        d.end++,
        o >= 11 && n.editedAt && e.uint.preencode(d, n.editedAt))
    },
    encode(d, n) {
      const c = o >= 11 && n.editedAt ? 1 : 0
      ;(fo.encode(d, n.id),
        e.uint.encode(d, n.total),
        Bo.encode(d, n.reactions),
        e.uint.encode(d, c),
        o >= 11 && n.editedAt && e.uint.encode(d, n.editedAt))
    },
    decode(d) {
      const n = fo.decode(d),
        c = e.uint.decode(d),
        r = Bo.decode(d),
        t = d.start < d.end ? e.uint.decode(d) : 0
      return { id: n, total: c, reactions: r, editedAt: o >= 11 && 1 & t ? e.uint.decode(d) : 0 }
    },
  },
  No = _,
  jo = {
    preencode(d, o) {
      ;(No.preencode(d, o.header), c.preencode(d, o.oplog), e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(No.encode(d, o.header), c.encode(d, o.oplog), e.string.encode(d, o.reaction))
    },
    decode: (d) => ({ header: No.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  Uo = _,
  Oo = {
    preencode(d, o) {
      ;(Uo.preencode(d, o.header), c.preencode(d, o.oplog), e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(Uo.encode(d, o.header), c.encode(d, o.oplog), e.string.encode(d, o.reaction))
    },
    decode: (d) => ({ header: Uo.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  Jo = _,
  Vo = e.frame(Z),
  Ho = {
    preencode(d, o) {
      ;(Jo.preencode(d, o.header), e.uint.preencode(d, o.key), Vo.preencode(d, o.config))
    },
    encode(d, o) {
      ;(Jo.encode(d, o.header), e.uint.encode(d, o.key), Vo.encode(d, o.config))
    },
    decode: (d) => ({ header: Jo.decode(d), key: e.uint.decode(d), config: Vo.decode(d) }),
  },
  zo = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.string.preencode(d, o.displayName),
        d.end++,
        o.avatar && tt.preencode(d, o.avatar))
    },
    encode(d, o) {
      const n = o.avatar ? 1 : 0
      ;(e.fixed32.encode(d, o.memberKey),
        e.string.encode(d, o.displayName),
        e.uint.encode(d, n),
        o.avatar && tt.encode(d, o.avatar))
    },
    decode: (d) => ({
      memberKey: e.fixed32.decode(d),
      displayName: e.string.decode(d),
      avatar: 1 & e.uint.decode(d) ? tt.decode(d) : null,
    }),
  },
  Go = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), d.end++, o.username && e.string.preencode(d, o.username))
    },
    encode(d, o) {
      const n = o.username ? 1 : 0
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.username && e.string.encode(d, o.username))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      username: 1 & e.uint.decode(d) ? e.string.decode(d) : null,
    }),
  },
  Qo = e.frame(Go),
  Wo = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        d.end++,
        o.discoveryCoreKey && e.fixed32.preencode(d, o.discoveryCoreKey),
        o.userRegistry && Qo.preencode(d, o.userRegistry))
    },
    encode(d, o) {
      const n = (o.discoveryCoreKey ? 1 : 0) | (o.userRegistry ? 2 : 0)
      ;(e.fixed32.encode(d, o.publicKey),
        e.uint.encode(d, n),
        o.discoveryCoreKey && e.fixed32.encode(d, o.discoveryCoreKey),
        o.userRegistry && Qo.encode(d, o.userRegistry))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d)
      return {
        publicKey: o,
        discoveryCoreKey: 1 & n ? e.fixed32.decode(d) : null,
        userRegistry: 2 & n ? Qo.decode(d) : null,
      }
    },
  },
  Xo = _,
  Yo = e.frame(Q),
  Zo = e.frame(W),
  $o = Vo,
  _o = e.frame(Wo),
  en = be,
  dn = e.array(e.frame(le)),
  on = {
    preencode(e, d) {
      ;(Xo.preencode(e, d.header),
        Yo.preencode(e, d.digest),
        Zo.preencode(e, d.capabilities),
        e.end++,
        d.config && $o.preencode(e, d.config),
        d.identity && _o.preencode(e, d.identity),
        d.bootstrapDevice && en.preencode(e, d.bootstrapDevice),
        d.initialMembers && dn.preencode(e, d.initialMembers))
    },
    encode(d, o) {
      const n =
        (o.config ? 1 : 0) |
        (o.identity ? 2 : 0) |
        (o.bootstrapDevice ? 4 : 0) |
        (o.initialMembers ? 8 : 0)
      ;(Xo.encode(d, o.header),
        Yo.encode(d, o.digest),
        Zo.encode(d, o.capabilities),
        e.uint.encode(d, n),
        o.config && $o.encode(d, o.config),
        o.identity && _o.encode(d, o.identity),
        o.bootstrapDevice && en.encode(d, o.bootstrapDevice),
        o.initialMembers && dn.encode(d, o.initialMembers))
    },
    decode(d) {
      const o = Xo.decode(d),
        n = Yo.decode(d),
        c = Zo.decode(d),
        r = e.uint.decode(d)
      return {
        header: o,
        digest: n,
        capabilities: c,
        config: 1 & r ? $o.decode(d) : null,
        identity: 2 & r ? _o.decode(d) : null,
        bootstrapDevice: 4 & r ? en.decode(d) : null,
        initialMembers: 8 & r ? dn.decode(d) : null,
      }
    },
  },
  nn = _,
  cn = {
    preencode(d, o) {
      ;(nn.preencode(d, o.header), e.uint.preencode(d, o.version))
    },
    encode(d, o) {
      ;(nn.encode(d, o.header), e.uint.encode(d, o.version))
    },
    decode: (d) => ({ header: nn.decode(d), version: e.uint.decode(d) }),
  },
  rn = _,
  tn = G,
  an = {
    preencode(d, o) {
      ;(rn.preencode(d, o.header), e.uint.preencode(d, o.key), tn.preencode(d, o.settings))
    },
    encode(d, o) {
      ;(rn.encode(d, o.header), e.uint.encode(d, o.key), tn.encode(d, o.settings))
    },
    decode: (d) => ({ header: rn.decode(d), key: e.uint.decode(d), settings: tn.decode(d) }),
  },
  sn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        it.preencode(d, o.status),
        d.end++,
        o.mailbox && e.fixed32.preencode(d, o.mailbox),
        o.roomKey && e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      const n = (o.mailbox ? 1 : 0) | (o.roomKey ? 2 : 0)
      ;(e.fixed32.encode(d, o.memberKey),
        it.encode(d, o.status),
        e.uint.encode(d, n),
        o.mailbox && e.fixed32.encode(d, o.mailbox),
        o.roomKey && e.fixed32.encode(d, o.roomKey))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = it.decode(d),
        c = e.uint.decode(d)
      return {
        memberKey: o,
        status: n,
        mailbox: 1 & c ? e.fixed32.decode(d) : null,
        roomKey: 2 & c ? e.fixed32.decode(d) : null,
      }
    },
  },
  pn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.seed),
        n.preencode(d, o.initiator),
        e.fixed32.preencode(d, o.fastForwardTo))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.fixed32.encode(d, o.seed),
        n.encode(d, o.initiator),
        e.fixed32.encode(d, o.fastForwardTo))
    },
    decode: (d) => ({
      roomKey: e.fixed32.decode(d),
      encryptionKey: e.buffer.decode(d),
      seed: e.fixed32.decode(d),
      initiator: n.decode(d),
      fastForwardTo: e.fixed32.decode(d),
    }),
  },
  un = e.array(e.frame(pn)),
  ln = Y,
  fn = {
    preencode(e, d) {
      ;(un.preencode(e, d.sharedRooms), ln.preencode(e, d.blockedContacts))
    },
    encode(e, d) {
      ;(un.encode(e, d.sharedRooms), ln.encode(e, d.blockedContacts))
    },
    decode: (e) => ({ sharedRooms: un.decode(e), blockedContacts: ln.decode(e) }),
  },
  mn = _o,
  yn = {
    preencode(e, d) {
      mn.preencode(e, d.identity)
    },
    encode(e, d) {
      mn.encode(e, d.identity)
    },
    decode: (e) => ({ identity: mn.decode(e) }),
  },
  xn = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.rooms), e.uint.preencode(d, o.contacts))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.rooms), e.uint.encode(d, o.contacts))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), contacts: e.uint.decode(d) }),
  },
  bn = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.rooms), e.uint.preencode(d, o.contactRequests))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.rooms), e.uint.encode(d, o.contactRequests))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), contactRequests: e.uint.decode(d) }),
  },
  kn = {
    preencode(d, o) {
      e.buffer.preencode(d, o.entropy)
    },
    encode(d, o) {
      e.buffer.encode(d, o.entropy)
    },
    decode: (d) => ({ entropy: e.buffer.decode(d) }),
  },
  vn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        e.fixed32.preencode(d, o.devicePublicKey),
        e.fixed32.preencode(d, o.writerKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.publicKey),
        e.fixed32.encode(d, o.devicePublicKey),
        e.fixed32.encode(d, o.writerKey))
    },
    decode: (d) => ({
      publicKey: e.fixed32.decode(d),
      devicePublicKey: e.fixed32.decode(d),
      writerKey: e.fixed32.decode(d),
    }),
  },
  gn = e.frame(vn),
  hn = {
    preencode(d, c) {
      ;(e.fixed32.preencode(d, c.id),
        e.fixed32.preencode(d, c.invitationSeed),
        e.fixed32.preencode(d, c.mailbox),
        t.preencode(d, c.responseKeyPair),
        n.preencode(d, c.initiator),
        n.preencode(d, c.inviter),
        d.end++,
        c.identity && gn.preencode(d, c.identity),
        o >= 20 && c.buildType && Ur.preencode(d, c.buildType))
    },
    encode(d, c) {
      const r = (c.identity ? 1 : 0) | (o >= 20 && c.buildType ? 2 : 0)
      ;(e.fixed32.encode(d, c.id),
        e.fixed32.encode(d, c.invitationSeed),
        e.fixed32.encode(d, c.mailbox),
        t.encode(d, c.responseKeyPair),
        n.encode(d, c.initiator),
        n.encode(d, c.inviter),
        e.uint.encode(d, r),
        c.identity && gn.encode(d, c.identity),
        o >= 20 && c.buildType && Ur.encode(d, c.buildType))
    },
    decode(d) {
      const c = e.fixed32.decode(d),
        r = e.fixed32.decode(d),
        i = e.fixed32.decode(d),
        a = t.decode(d),
        s = n.decode(d),
        p = n.decode(d),
        u = e.uint.decode(d)
      return {
        id: c,
        invitationSeed: r,
        mailbox: i,
        responseKeyPair: a,
        initiator: s,
        inviter: p,
        identity: 1 & u ? gn.decode(d) : null,
        buildType: o >= 20 && 2 & u ? Ur.decode(d) : null,
      }
    },
  },
  Kn = _,
  wn = {
    preencode(d, o) {
      ;(Kn.preencode(d, o.header), e.buffer.preencode(d, o.blindResponse))
    },
    encode(d, o) {
      ;(Kn.encode(d, o.header), e.buffer.encode(d, o.blindResponse))
    },
    decode: (d) => ({ header: Kn.decode(d), blindResponse: e.buffer.decode(d) }),
  },
  Tn = _,
  Pn = e.frame(hn),
  An = {
    preencode(e, d) {
      ;(Tn.preencode(e, d.header), Pn.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Tn.encode(e, d.header), Pn.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Tn.decode(e), invitation: Pn.decode(e) }),
  },
  Rn = _,
  Dn = {
    preencode(d, o) {
      ;(Rn.preencode(d, o.header), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(Rn.encode(d, o.header), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ header: Rn.decode(d), id: e.fixed32.decode(d) }),
  },
  Mn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        e.fixed32.preencode(d, o.devicePublicKey),
        d.end++,
        o.privateProfileKey && e.fixed32.preencode(d, o.privateProfileKey),
        o.deviceKeyPair && t.preencode(d, o.deviceKeyPair),
        e.buffer.preencode(d, o.deviceProof))
    },
    encode(d, o) {
      const n = (o.privateProfileKey ? 1 : 0) | (o.deviceKeyPair ? 2 : 0)
      ;(e.fixed32.encode(d, o.publicKey),
        e.fixed32.encode(d, o.devicePublicKey),
        e.uint.encode(d, n),
        o.privateProfileKey && e.fixed32.encode(d, o.privateProfileKey),
        o.deviceKeyPair && t.encode(d, o.deviceKeyPair),
        e.buffer.encode(d, o.deviceProof))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        publicKey: o,
        devicePublicKey: n,
        privateProfileKey: 1 & c ? e.fixed32.decode(d) : null,
        deviceKeyPair: 2 & c ? t.decode(d) : null,
        deviceProof: e.buffer.decode(d),
      }
    },
  },
  Sn = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const c =
        (n.isActive ? 1 : 0) |
        (n.isFullyMuted ? 2 : 0) |
        (n.isMentionsOnlyMuted ? 4 : 0) |
        (o >= 9 && n.isReadOnly ? 8 : 0) |
        (o >= 18 && n.isFavorite ? 16 : 0) |
        (o >= 21 && n.isUnread ? 32 : 0)
      e.uint.encode(d, c)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        isActive: !!(1 & n),
        isFullyMuted: !!(2 & n),
        isMentionsOnlyMuted: !!(4 & n),
        isReadOnly: o >= 9 && !!(8 & n),
        isFavorite: o >= 18 && !!(16 & n),
        isUnread: o >= 21 && !!(32 & n),
      }
    },
  },
  Cn = e.frame(Sn),
  Ln = e.frame(Mn),
  qn = gn,
  Fn = {
    preencode(d, c) {
      ;(e.fixed32.preencode(d, c.roomKey),
        e.buffer.preencode(d, c.encryptionKey),
        e.fixed32.preencode(d, c.mailbox),
        Cn.preencode(d, c.status),
        e.uint.preencode(d, c.clock),
        d.end++,
        c.initiator && n.preencode(d, c.initiator),
        c.fastForwardTo && e.fixed32.preencode(d, c.fastForwardTo),
        c.identitySwap && Ln.preencode(d, c.identitySwap),
        o >= 6 && c.identitySwapV2 && qn.preencode(d, c.identitySwapV2),
        o >= 10 && c.contact && e.fixed32.preencode(d, c.contact))
    },
    encode(d, c) {
      const r =
        (c.initiator ? 1 : 0) |
        (c.fastForwardTo ? 2 : 0) |
        (c.identitySwap ? 4 : 0) |
        (o >= 6 && c.identitySwapV2 ? 8 : 0) |
        (o >= 10 && c.contact ? 16 : 0)
      ;(e.fixed32.encode(d, c.roomKey),
        e.buffer.encode(d, c.encryptionKey),
        e.fixed32.encode(d, c.mailbox),
        Cn.encode(d, c.status),
        e.uint.encode(d, c.clock),
        e.uint.encode(d, r),
        c.initiator && n.encode(d, c.initiator),
        c.fastForwardTo && e.fixed32.encode(d, c.fastForwardTo),
        c.identitySwap && Ln.encode(d, c.identitySwap),
        o >= 6 && c.identitySwapV2 && qn.encode(d, c.identitySwapV2),
        o >= 10 && c.contact && e.fixed32.encode(d, c.contact))
    },
    decode(d) {
      const c = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        t = e.fixed32.decode(d),
        i = Cn.decode(d),
        a = e.uint.decode(d),
        s = e.uint.decode(d)
      return {
        roomKey: c,
        encryptionKey: r,
        mailbox: t,
        status: i,
        clock: a,
        initiator: 1 & s ? n.decode(d) : null,
        fastForwardTo: 2 & s ? e.fixed32.decode(d) : null,
        identitySwap: 4 & s ? Ln.decode(d) : null,
        identitySwapV2: o >= 6 && 8 & s ? qn.decode(d) : null,
        contact: o >= 10 && 16 & s ? e.fixed32.decode(d) : null,
      }
    },
  },
  En = _,
  Bn = {
    preencode(d, o) {
      ;(En.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.mailbox),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.initiator && n.preencode(d, o.initiator),
        o.dm && e.fixed32.preencode(d, o.dm))
    },
    encode(d, c) {
      const r =
        (c.fastForwardTo ? 1 : 0) |
        (c.initiator ? 2 : 0) |
        (c.dm ? 4 : 0) |
        (o >= 9 && c.isReadOnly ? 8 : 0)
      ;(En.encode(d, c.header),
        e.fixed32.encode(d, c.roomKey),
        e.buffer.encode(d, c.encryptionKey),
        e.fixed32.encode(d, c.mailbox),
        e.uint.encode(d, r),
        c.fastForwardTo && e.fixed32.encode(d, c.fastForwardTo),
        c.initiator && n.encode(d, c.initiator),
        c.dm && e.fixed32.encode(d, c.dm))
    },
    decode(d) {
      const c = En.decode(d),
        r = e.fixed32.decode(d),
        t = e.buffer.decode(d),
        i = e.fixed32.decode(d),
        a = e.uint.decode(d)
      return {
        header: c,
        roomKey: r,
        encryptionKey: t,
        mailbox: i,
        fastForwardTo: 1 & a ? e.fixed32.decode(d) : null,
        initiator: 2 & a ? n.decode(d) : null,
        dm: 4 & a ? e.fixed32.decode(d) : null,
        isReadOnly: o >= 9 && !!(8 & a),
      }
    },
  },
  In = _,
  Nn = {
    preencode(d, o) {
      ;(In.preencode(d, o.header), e.fixed32.preencode(d, o.discoveryKey))
    },
    encode(d, o) {
      ;(In.encode(d, o.header), e.fixed32.encode(d, o.discoveryKey))
    },
    decode: (d) => ({ header: In.decode(d), discoveryKey: e.fixed32.decode(d) }),
  },
  jn = _,
  Un = Cn,
  On = {
    preencode(d, o) {
      ;(jn.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.key),
        Un.preencode(d, o.status))
    },
    encode(d, o) {
      ;(jn.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.key),
        Un.encode(d, o.status))
    },
    decode: (d) => ({
      header: jn.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: Un.decode(d),
    }),
  },
  Jn = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = o.isBlocked ? 1 : 0
      e.uint.encode(d, n)
    },
    decode: (d) => ({ isBlocked: !!(1 & e.uint.decode(d)) }),
  },
  Vn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.clock),
        at.preencode(d, o.status),
        d.end++,
        o.mailbox && e.fixed32.preencode(d, o.mailbox),
        o.roomKey && e.fixed32.preencode(d, o.roomKey))
    },
    encode(d, o) {
      const n = (o.mailbox ? 1 : 0) | (o.roomKey ? 2 : 0)
      ;(e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.clock),
        at.encode(d, o.status),
        e.uint.encode(d, n),
        o.mailbox && e.fixed32.encode(d, o.mailbox),
        o.roomKey && e.fixed32.encode(d, o.roomKey))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d),
        c = at.decode(d),
        r = e.uint.decode(d)
      return {
        memberKey: o,
        clock: n,
        status: c,
        mailbox: 1 & r ? e.fixed32.decode(d) : null,
        roomKey: 2 & r ? e.fixed32.decode(d) : null,
      }
    },
  },
  Hn = _,
  zn = e.frame(sn),
  Gn = {
    preencode(e, d) {
      ;(Hn.preencode(e, d.header), zn.preencode(e, d.contact))
    },
    encode(e, d) {
      ;(Hn.encode(e, d.header), zn.encode(e, d.contact))
    },
    decode: (e) => ({ header: Hn.decode(e), contact: zn.decode(e) }),
  },
  Qn = _,
  Wn = {
    preencode(d, o) {
      ;(Qn.preencode(d, o.header),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.key),
        st.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Qn.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        st.encode(d, o.status))
    },
    decode: (d) => ({
      header: Qn.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: st.decode(d),
    }),
  },
  Xn = _,
  Yn = {
    preencode(d, o) {
      ;(Xn.preencode(d, o.header), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Xn.encode(d, o.header), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ header: Xn.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Zn = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n =
        (o.isPending ? 1 : 0) |
        (o.isAccepted ? 2 : 0) |
        (o.isRejected ? 4 : 0) |
        (o.isDiscarded ? 8 : 0) |
        (o.isSeen ? 16 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        isPending: !!(1 & o),
        isAccepted: !!(2 & o),
        isRejected: !!(4 & o),
        isDiscarded: !!(8 & o),
        isSeen: !!(16 & o),
      }
    },
  },
  $n = ke,
  _n = e.frame(i),
  ec = {
    preencode(d, o) {
      ;($n.preencode(d, o.sender),
        _n.preencode(d, o.keys),
        e.fixed32.preencode(d, o.mailbox),
        d.end++,
        o.message && e.string.preencode(d, o.message))
    },
    encode(d, o) {
      const n = o.message ? 1 : 0
      ;($n.encode(d, o.sender),
        _n.encode(d, o.keys),
        e.fixed32.encode(d, o.mailbox),
        e.uint.encode(d, n),
        o.message && e.string.encode(d, o.message))
    },
    decode: (d) => ({
      sender: $n.decode(d),
      keys: _n.decode(d),
      mailbox: e.fixed32.decode(d),
      message: 1 & e.uint.decode(d) ? e.string.decode(d) : null,
    }),
  },
  dc = e.frame(ec),
  oc = {
    preencode(e, d) {
      ;(dc.preencode(e, d.body), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(dc.encode(e, d.body), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ body: dc.decode(e), attestation: ce.decode(e) }),
  },
  nc = ue,
  cc = e.frame(Zn),
  rc = _n,
  tc = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.clock),
        nc.preencode(d, n.sender),
        cc.preencode(d, n.status),
        rc.preencode(d, n.keys),
        e.fixed32.preencode(d, n.mailbox),
        d.end++,
        n.message && e.string.preencode(d, n.message),
        o >= 11 && n.sentAt && e.uint.preencode(d, n.sentAt))
    },
    encode(d, n) {
      const c = (n.message ? 1 : 0) | (o >= 11 && n.sentAt ? 2 : 0)
      ;(e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.clock),
        nc.encode(d, n.sender),
        cc.encode(d, n.status),
        rc.encode(d, n.keys),
        e.fixed32.encode(d, n.mailbox),
        e.uint.encode(d, c),
        n.message && e.string.encode(d, n.message),
        o >= 11 && n.sentAt && e.uint.encode(d, n.sentAt))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.uint.decode(d),
        r = nc.decode(d),
        t = cc.decode(d),
        i = rc.decode(d),
        a = e.fixed32.decode(d),
        s = e.uint.decode(d)
      return {
        memberKey: n,
        clock: c,
        sender: r,
        status: t,
        keys: i,
        mailbox: a,
        message: 1 & s ? e.string.decode(d) : null,
        sentAt: o >= 11 && 2 & s ? e.uint.decode(d) : 0,
      }
    },
  },
  ic = _,
  ac = {
    preencode(d, o) {
      ;(ic.preencode(d, o.header), e.buffer.preencode(d, o.blindRequest))
    },
    encode(d, o) {
      ;(ic.encode(d, o.header), e.buffer.encode(d, o.blindRequest))
    },
    decode: (d) => ({ header: ic.decode(d), blindRequest: e.buffer.decode(d) }),
  },
  sc = _,
  pc = cc,
  uc = {
    preencode(d, n) {
      ;(sc.preencode(d, n.header),
        e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.key),
        pc.preencode(d, n.status),
        d.end++,
        o >= 10 && n.roomKey && e.fixed32.preencode(d, n.roomKey))
    },
    encode(d, n) {
      const c = o >= 10 && n.roomKey ? 1 : 0
      ;(sc.encode(d, n.header),
        e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.key),
        pc.encode(d, n.status),
        e.uint.encode(d, c),
        o >= 10 && n.roomKey && e.fixed32.encode(d, n.roomKey))
    },
    decode(d) {
      const n = sc.decode(d),
        c = e.fixed32.decode(d),
        r = e.uint.decode(d),
        t = pc.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        header: n,
        memberKey: c,
        key: r,
        status: t,
        roomKey: o >= 10 && 1 & i ? e.fixed32.decode(d) : null,
      }
    },
  },
  lc = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.timestamp),
        e.fixed32.preencode(d, o.key),
        e.fixed32.preencode(d, o.mailbox))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.timestamp), e.fixed32.encode(d, o.key), e.fixed32.encode(d, o.mailbox))
    },
    decode: (d) => ({
      version: e.uint.decode(d),
      timestamp: e.uint.decode(d),
      key: e.fixed32.decode(d),
      mailbox: e.fixed32.decode(d),
    }),
  },
  fc = {
    preencode(d, o) {
      switch ((e.uint.preencode(d, o.version), o.version)) {
        case 0:
        case 1:
          lc.preencode(d, o)
          break
        default:
          throw new Error("Unsupported version")
      }
    },
    encode(d, o) {
      switch ((e.uint.encode(d, o.version), o.version)) {
        case 0:
        case 1:
          lc.encode(d, o)
          break
        default:
          throw new Error("Unsupported version")
      }
    },
    decode(d) {
      const o = d.start,
        n = e.uint.decode(d)
      switch (((d.start = o), n)) {
        case 0:
        case 1:
          return lc.decode(d)
        default:
          throw new Error("Unsupported version")
      }
    },
  },
  mc = _,
  yc = {
    preencode(d, n) {
      ;(mc.preencode(d, n.header),
        c.preencode(d, n.oplog),
        e.uint.preencode(d, n.index),
        pt.preencode(d, n.preview),
        d.end++,
        o >= 7 && n.displayType && Rc.preencode(d, n.displayType))
    },
    encode(d, n) {
      const r = o >= 7 && n.displayType ? 1 : 0
      ;(mc.encode(d, n.header),
        c.encode(d, n.oplog),
        e.uint.encode(d, n.index),
        pt.encode(d, n.preview),
        e.uint.encode(d, r),
        o >= 7 && n.displayType && Rc.encode(d, n.displayType))
    },
    decode(d) {
      const n = mc.decode(d),
        r = c.decode(d),
        t = e.uint.decode(d),
        i = pt.decode(d),
        a = d.start < d.end ? e.uint.decode(d) : 0
      return {
        header: n,
        oplog: r,
        index: t,
        preview: i,
        displayType: o >= 7 && 1 & a ? Rc.decode(d) : 0,
      }
    },
  },
  xc = {
    preencode(d, n) {
      ;(d.end++, o >= 3 && n.memberKey && e.fixed32.preencode(d, n.memberKey))
    },
    encode(d, n) {
      const c = o >= 3 && n.memberKey ? 1 : 0
      ;(e.uint.encode(d, c), o >= 3 && n.memberKey && e.fixed32.encode(d, n.memberKey))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { memberKey: o >= 3 && 1 & n ? e.fixed32.decode(d) : null }
    },
  },
  bc = ue,
  kc = {
    preencode(e, d) {
      ;(bc.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(bc.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: bc.decode(e), attestation: ce.decode(e) }),
  },
  vc = _,
  gc = {
    preencode(d, o) {
      ;(vc.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(vc.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: vc.decode(d), key: e.fixed32.decode(d) }),
  },
  hc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey),
        ce.preencode(d, o.privateProfileIdentity),
        e.buffer.preencode(d, o.deviceProof))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.deviceKey),
        ce.encode(d, o.privateProfileIdentity),
        e.buffer.encode(d, o.deviceProof))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      privateProfileIdentity: ce.decode(d),
      deviceProof: e.buffer.decode(d),
    }),
  },
  Kc = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.roomKey),
        e.fixed32.preencode(d, n.encryptionKey),
        e.fixed32.preencode(d, n.seed),
        d.end++,
        o >= 6 && n.fastForwardTo && e.fixed32.preencode(d, n.fastForwardTo))
    },
    encode(d, n) {
      const c = o >= 6 && n.fastForwardTo ? 1 : 0
      ;(e.fixed32.encode(d, n.roomKey),
        e.fixed32.encode(d, n.encryptionKey),
        e.fixed32.encode(d, n.seed),
        e.uint.encode(d, c),
        o >= 6 && n.fastForwardTo && e.fixed32.encode(d, n.fastForwardTo))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = e.fixed32.decode(d),
        t = e.uint.decode(d)
      return {
        roomKey: n,
        encryptionKey: c,
        seed: r,
        fastForwardTo: o >= 6 && 1 & t ? e.fixed32.decode(d) : null,
      }
    },
  },
  wc = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey),
        e.fixed32.preencode(d, n.writerKey),
        e.fixed32.preencode(d, n.devicePublicKey),
        d.end++,
        o >= 6 && n.privateProfileKey && e.fixed32.preencode(d, n.privateProfileKey))
    },
    encode(d, n) {
      const c = o >= 6 && n.privateProfileKey ? 1 : 0
      ;(e.fixed32.encode(d, n.publicKey),
        e.fixed32.encode(d, n.writerKey),
        e.fixed32.encode(d, n.devicePublicKey),
        e.uint.encode(d, c),
        o >= 6 && n.privateProfileKey && e.fixed32.encode(d, n.privateProfileKey))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = e.fixed32.decode(d),
        t = e.uint.decode(d)
      return {
        publicKey: n,
        writerKey: c,
        devicePublicKey: r,
        privateProfileKey: o >= 6 && 1 & t ? e.fixed32.decode(d) : null,
      }
    },
  },
  Tc = _,
  Pc = {
    preencode(d, o) {
      ;(Tc.preencode(d, o.header), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Tc.encode(d, o.header), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ header: Tc.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Ac = { HttpLink: 1, PearLink: 2 },
  Rc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 2) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Dc = _,
  Mc = {
    preencode(d, o) {
      ;(Dc.preencode(d, o.header), e.uint.preencode(d, o.value))
    },
    encode(d, o) {
      ;(Dc.encode(d, o.header), e.uint.encode(d, o.value))
    },
    decode: (d) => ({ header: Dc.decode(d), value: e.uint.decode(d) }),
  },
  Sc = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.key), e.uint.preencode(d, o.value))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.key), e.uint.encode(d, o.value))
    },
    decode: (d) => ({ key: e.uint.decode(d), value: e.uint.decode(d) }),
  },
  Cc = _,
  Lc = {
    preencode(d, n) {
      ;(Cc.preencode(d, n.header),
        e.uint.preencode(d, n.from),
        e.uint.preencode(d, n.to),
        d.end++,
        o >= 20 && n.buildType && Ur.preencode(d, n.buildType))
    },
    encode(d, n) {
      const c = o >= 20 && n.buildType ? 1 : 0
      ;(Cc.encode(d, n.header),
        e.uint.encode(d, n.from),
        e.uint.encode(d, n.to),
        e.uint.encode(d, c),
        o >= 20 && n.buildType && Ur.encode(d, n.buildType))
    },
    decode(d) {
      const n = Cc.decode(d),
        c = e.uint.decode(d),
        r = e.uint.decode(d),
        t = d.start < d.end ? e.uint.decode(d) : 0
      return { header: n, from: c, to: r, buildType: o >= 20 && 1 & t ? Ur.decode(d) : null }
    },
  },
  qc = {
    RoomType: 1,
    IsExperimental: 2,
    IsJoiningDisabled: 3,
    IsAppendingDisabled: 4,
    IsCallingDisabled: 5,
    IsMembershipEventsDisabled: 6,
    IsAttachmentsDisabled: 7,
    IsLinksDisabled: 8,
  },
  Fc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 8) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Ec = { en: "en", it: "it", ru: "ru", es: "es", de: "de" },
  Bc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      switch (o) {
        case "en":
          e.uint.encode(d, 1)
          break
        case "it":
          e.uint.encode(d, 2)
          break
        case "ru":
          e.uint.encode(d, 3)
          break
        case "es":
          e.uint.encode(d, 4)
          break
        case "de":
          e.uint.encode(d, 5)
          break
        default:
          throw new Error("Unknown enum")
      }
    },
    decode(d) {
      switch (e.uint.decode(d)) {
        case 1:
          return "en"
        case 2:
          return "it"
        case 3:
          return "ru"
        case 4:
          return "es"
        case 5:
          return "de"
        default:
          return null
      }
    },
  },
  Ic = Ed,
  Nc = {
    preencode(d, o) {
      ;(Ic.preencode(d, o.range), Bc.preencode(d, o.language), e.string.preencode(d, o.text))
    },
    encode(d, o) {
      ;(Ic.encode(d, o.range), Bc.encode(d, o.language), e.string.encode(d, o.text))
    },
    decode: (d) => ({ range: Ic.decode(d), language: Bc.decode(d), text: e.string.decode(d) }),
  },
  jc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.deviceKey), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ deviceKey: e.fixed32.decode(d), key: e.fixed32.decode(d) }),
  },
  Uc = _,
  Oc = {
    preencode(d, o) {
      ;(Uc.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(Uc.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: Uc.decode(d), key: e.fixed32.decode(d) }),
  },
  Jc = _,
  Vc = {
    preencode(d, o) {
      ;(Jc.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(Jc.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: Jc.decode(d), key: e.fixed32.decode(d) }),
  },
  Hc = { Flag: 1 },
  zc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 1) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Gc = {
    preencode(d, o) {
      ;(fo.preencode(d, o.id),
        e.fixed32.preencode(d, o.sender),
        e.uint.preencode(d, o.clock),
        zc.preencode(d, o.label))
    },
    encode(d, o) {
      ;(fo.encode(d, o.id),
        e.fixed32.encode(d, o.sender),
        e.uint.encode(d, o.clock),
        zc.encode(d, o.label))
    },
    decode: (d) => ({
      id: fo.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: zc.decode(d),
    }),
  },
  Qc = _,
  Wc = {
    preencode(e, d) {
      ;(Qc.preencode(e, d.header), c.preencode(e, d.oplog), zc.preencode(e, d.label))
    },
    encode(e, d) {
      ;(Qc.encode(e, d.header), c.encode(e, d.oplog), zc.encode(e, d.label))
    },
    decode: (e) => ({ header: Qc.decode(e), oplog: c.decode(e), label: zc.decode(e) }),
  },
  Xc = _,
  Yc = {
    preencode(e, d) {
      ;(Xc.preencode(e, d.header), c.preencode(e, d.oplog), zc.preencode(e, d.label))
    },
    encode(e, d) {
      ;(Xc.encode(e, d.header), c.encode(e, d.oplog), zc.encode(e, d.label))
    },
    decode: (e) => ({ header: Xc.decode(e), oplog: c.decode(e), label: zc.decode(e) }),
  },
  Zc = {
    preencode(d, o) {
      ;(zc.preencode(d, o.label), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(zc.encode(d, o.label), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ label: zc.decode(d), count: e.uint.decode(d) }),
  },
  $c = e.array(e.frame(Zc)),
  _c = {
    preencode(d, n) {
      ;(fo.preencode(d, n.id),
        e.uint.preencode(d, n.total),
        $c.preencode(d, n.labels),
        e.uint.preencode(d, n.editedAt),
        d.end++,
        o >= 15 && n.flagsClock && e.uint.preencode(d, n.flagsClock),
        o >= 15 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const c =
        (o >= 15 && n.flagsClock ? 1 : 0) |
        (o >= 15 && n.version ? 2 : 0) |
        (o >= 16 && n.isDeleted ? 4 : 0)
      ;(fo.encode(d, n.id),
        e.uint.encode(d, n.total),
        $c.encode(d, n.labels),
        e.uint.encode(d, n.editedAt),
        e.uint.encode(d, c),
        o >= 15 && n.flagsClock && e.uint.encode(d, n.flagsClock),
        o >= 15 && n.version && e.uint.encode(d, n.version))
    },
    decode(d) {
      const n = fo.decode(d),
        c = e.uint.decode(d),
        r = $c.decode(d),
        t = e.uint.decode(d),
        i = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: n,
        total: c,
        labels: r,
        editedAt: t,
        flagsClock: o >= 15 && 1 & i ? e.uint.decode(d) : 0,
        version: o >= 15 && 2 & i ? e.uint.decode(d) : 0,
        isDeleted: o >= 16 && !!(4 & i),
      }
    },
  },
  er = _,
  dr = {
    preencode(d, o) {
      ;(er.preencode(d, o.header), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(er.encode(d, o.header), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ header: er.decode(d), length: e.uint.decode(d) }),
  },
  or = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.memberKey), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ memberKey: e.fixed32.decode(d), length: e.uint.decode(d) }),
  },
  nr = $,
  cr = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const c =
        (o >= 13 && n.disableReadReceipts ? 1 : 0) | (o >= 21 && n.stripAttachmentMetadata ? 2 : 0)
      e.uint.encode(d, c)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        disableReadReceipts: o >= 13 && !!(1 & n),
        stripAttachmentMetadata: o >= 21 && !!(2 & n),
      }
    },
  },
  rr = {
    disableReadReceipts: "disableReadReceipts",
    stripAttachmentMetadata: "stripAttachmentMetadata",
  },
  tr = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      switch (o) {
        case "disableReadReceipts":
          e.uint.encode(d, 1)
          break
        case "stripAttachmentMetadata":
          e.uint.encode(d, 2)
          break
        default:
          throw new Error("Unknown enum")
      }
    },
    decode(d) {
      switch (e.uint.decode(d)) {
        case 1:
          return "disableReadReceipts"
        case 2:
          return "stripAttachmentMetadata"
        default:
          return null
      }
    },
  },
  ir = _,
  ar = e.frame(cr),
  sr = {
    preencode(e, d) {
      ;(ir.preencode(e, d.header), tr.preencode(e, d.key), ar.preencode(e, d.settings))
    },
    encode(e, d) {
      ;(ir.encode(e, d.header), tr.encode(e, d.key), ar.encode(e, d.settings))
    },
    decode: (e) => ({ header: ir.decode(e), key: tr.decode(e), settings: ar.decode(e) }),
  },
  pr = { Flag: 1 },
  ur = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 1) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  lr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.fixed32.preencode(d, o.sender),
        e.uint.preencode(d, o.clock),
        ur.preencode(d, o.label))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key),
        e.fixed32.encode(d, o.sender),
        e.uint.encode(d, o.clock),
        ur.encode(d, o.label))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: ur.decode(d),
    }),
  },
  fr = _,
  mr = {
    preencode(d, o) {
      ;(fr.preencode(d, o.header), e.fixed32.preencode(d, o.key), ur.preencode(d, o.label))
    },
    encode(d, o) {
      ;(fr.encode(d, o.header), e.fixed32.encode(d, o.key), ur.encode(d, o.label))
    },
    decode: (d) => ({ header: fr.decode(d), key: e.fixed32.decode(d), label: ur.decode(d) }),
  },
  yr = {
    preencode(d, o) {
      ;(ur.preencode(d, o.label), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(ur.encode(d, o.label), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ label: ur.decode(d), count: e.uint.decode(d) }),
  },
  xr = e.array(e.frame(yr)),
  br = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.uint.preencode(d, o.total),
        xr.preencode(d, o.labels),
        e.uint.preencode(d, o.editedAt),
        e.uint.preencode(d, o.flagsClock))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, o.total),
        xr.encode(d, o.labels),
        e.uint.encode(d, o.editedAt),
        e.uint.encode(d, o.flagsClock))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      total: e.uint.decode(d),
      labels: xr.decode(d),
      editedAt: e.uint.decode(d),
      flagsClock: e.uint.decode(d),
    }),
  },
  kr = {
    preencode(d, o) {
      ;(e.float64.preencode(d, o.latitude), e.float64.preencode(d, o.longitude))
    },
    encode(d, o) {
      ;(e.float64.encode(d, o.latitude), e.float64.encode(d, o.longitude))
    },
    decode: (d) => ({ latitude: e.float64.decode(d), longitude: e.float64.decode(d) }),
  },
  vr = _,
  gr = {
    preencode(d, o) {
      ;(vr.preencode(d, o.header),
        e.fixed32.preencode(d, o.deviceKey),
        e.fixed32.preencode(d, o.fromDeviceKey))
    },
    encode(d, o) {
      ;(vr.encode(d, o.header),
        e.fixed32.encode(d, o.deviceKey),
        e.fixed32.encode(d, o.fromDeviceKey))
    },
    decode: (d) => ({
      header: vr.decode(d),
      deviceKey: e.fixed32.decode(d),
      fromDeviceKey: e.fixed32.decode(d),
    }),
  },
  hr = _,
  Kr = Y,
  wr = {
    preencode(d, n) {
      ;(hr.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        e.buffer.preencode(d, n.encryptionKey),
        d.end++,
        o >= 19 && n.streams && Kr.preencode(d, n.streams),
        o >= 19 && n.discoveryKey && e.fixed32.preencode(d, n.discoveryKey),
        o >= 19 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const c =
        (o >= 19 && n.streams ? 1 : 0) |
        (o >= 19 && n.discoveryKey ? 2 : 0) |
        (o >= 19 && n.version ? 4 : 0)
      ;(hr.encode(d, n.header),
        e.fixed32.encode(d, n.callKey),
        e.buffer.encode(d, n.encryptionKey),
        e.uint.encode(d, c),
        o >= 19 && n.streams && Kr.encode(d, n.streams),
        o >= 19 && n.discoveryKey && e.fixed32.encode(d, n.discoveryKey),
        o >= 19 && n.version && e.uint.encode(d, n.version))
    },
    decode(d) {
      const n = hr.decode(d),
        c = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        t = e.uint.decode(d)
      return {
        header: n,
        callKey: c,
        encryptionKey: r,
        streams: o >= 19 && 1 & t ? Kr.decode(d) : null,
        discoveryKey: o >= 19 && 2 & t ? e.fixed32.decode(d) : null,
        version: o >= 19 && 4 & t ? e.uint.decode(d) : 0,
      }
    },
  },
  Tr = _,
  Pr = Y,
  Ar = {
    preencode(d, n) {
      ;(Tr.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        d.end++,
        o >= 19 && n.streams && Pr.preencode(d, n.streams))
    },
    encode(d, n) {
      const c = o >= 19 && n.streams ? 1 : 0
      ;(Tr.encode(d, n.header),
        e.fixed32.encode(d, n.callKey),
        e.uint.encode(d, c),
        o >= 19 && n.streams && Pr.encode(d, n.streams))
    },
    decode(d) {
      const n = Tr.decode(d),
        c = e.fixed32.decode(d),
        r = e.uint.decode(d)
      return { header: n, callKey: c, streams: o >= 19 && 1 & r ? Pr.decode(d) : null }
    },
  },
  Rr = _,
  Dr = {
    preencode(d, o) {
      ;(Rr.preencode(d, o.header), e.fixed32.preencode(d, o.callKey))
    },
    encode(d, o) {
      ;(Rr.encode(d, o.header), e.fixed32.encode(d, o.callKey))
    },
    decode: (d) => ({ header: Rr.decode(d), callKey: e.fixed32.decode(d) }),
  },
  Mr = _,
  Sr = {
    preencode(d, o) {
      ;(Mr.preencode(d, o.header), e.fixed32.preencode(d, o.callKey))
    },
    encode(d, o) {
      ;(Mr.encode(d, o.header), e.fixed32.encode(d, o.callKey))
    },
    decode: (d) => ({ header: Mr.decode(d), callKey: e.fixed32.decode(d) }),
  },
  Cr = _,
  Lr = {
    preencode(d, o) {
      ;(Cr.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.streamKey))
    },
    encode(d, o) {
      ;(Cr.encode(d, o.header), e.fixed32.encode(d, o.callKey), e.fixed32.encode(d, o.streamKey))
    },
    decode: (d) => ({
      header: Cr.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  qr = _,
  Fr = {
    preencode(d, o) {
      ;(qr.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.streamKey))
    },
    encode(d, o) {
      ;(qr.encode(d, o.header), e.fixed32.encode(d, o.callKey), e.fixed32.encode(d, o.streamKey))
    },
    decode: (d) => ({
      header: qr.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  Er = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.callKey),
        e.buffer.preencode(d, n.encryptionKey),
        e.uint.preencode(d, n.createdAt),
        d.end++,
        o >= 19 && n.endedAt && e.uint.preencode(d, n.endedAt),
        o >= 19 && n.discoveryKey && e.fixed32.preencode(d, n.discoveryKey),
        o >= 19 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const c =
        (o >= 19 && n.endedAt ? 1 : 0) |
        (o >= 19 && n.discoveryKey ? 2 : 0) |
        (o >= 19 && n.version ? 4 : 0)
      ;(e.fixed32.encode(d, n.callKey),
        e.buffer.encode(d, n.encryptionKey),
        e.uint.encode(d, n.createdAt),
        e.uint.encode(d, c),
        o >= 19 && n.endedAt && e.uint.encode(d, n.endedAt),
        o >= 19 && n.discoveryKey && e.fixed32.encode(d, n.discoveryKey),
        o >= 19 && n.version && e.uint.encode(d, n.version))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        callKey: n,
        encryptionKey: c,
        createdAt: r,
        endedAt: o >= 19 && 1 & t ? e.uint.decode(d) : 0,
        discoveryKey: o >= 19 && 2 & t ? e.fixed32.decode(d) : null,
        version: o >= 19 && 4 & t ? e.uint.decode(d) : 0,
      }
    },
  },
  Br = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.createdAt))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.callKey),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.createdAt))
    },
    decode: (d) => ({
      callKey: e.fixed32.decode(d),
      memberKey: e.fixed32.decode(d),
      createdAt: e.uint.decode(d),
    }),
  },
  Ir = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.callKey),
        e.fixed32.preencode(d, n.deviceKey),
        e.fixed32.preencode(d, n.memberKey),
        e.uint.preencode(d, n.createdAt),
        d.end++,
        o >= 19 && n.swarmKey && e.fixed32.preencode(d, n.swarmKey))
    },
    encode(d, n) {
      const c = o >= 19 && n.swarmKey ? 1 : 0
      ;(e.fixed32.encode(d, n.callKey),
        e.fixed32.encode(d, n.deviceKey),
        e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, n.createdAt),
        e.uint.encode(d, c),
        o >= 19 && n.swarmKey && e.fixed32.encode(d, n.swarmKey))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = e.fixed32.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        callKey: n,
        deviceKey: c,
        memberKey: r,
        createdAt: t,
        swarmKey: o >= 19 && 1 & i ? e.fixed32.decode(d) : null,
      }
    },
  },
  Nr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.deviceKey),
        e.buffer.preencode(d, o.streamKey),
        e.uint.preencode(d, o.createdAt))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.callKey),
        e.fixed32.encode(d, o.deviceKey),
        e.buffer.encode(d, o.streamKey),
        e.uint.encode(d, o.createdAt))
    },
    decode: (d) => ({
      callKey: e.fixed32.decode(d),
      deviceKey: e.fixed32.decode(d),
      streamKey: e.buffer.decode(d),
      createdAt: e.uint.decode(d),
    }),
  },
  jr = { Nightly: "Nightly", Internal: "Internal", Production: "Production" },
  Ur = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      switch (o) {
        case "Nightly":
          e.uint.encode(d, 1)
          break
        case "Internal":
          e.uint.encode(d, 2)
          break
        case "Production":
          e.uint.encode(d, 3)
          break
        default:
          throw new Error("Unknown enum")
      }
    },
    decode(d) {
      switch (e.uint.decode(d)) {
        case 1:
          return "Nightly"
        case 2:
          return "Internal"
        case 3:
          return "Production"
        default:
          return null
      }
    },
  },
  Or = _,
  Jr = {
    preencode(e, d) {
      Or.preencode(e, d.header)
    },
    encode(e, d) {
      Or.encode(e, d.header)
    },
    decode: (e) => ({ header: Or.decode(e) }),
  },
  Vr = _,
  Hr = {
    preencode(e, d) {
      Vr.preencode(e, d.header)
    },
    encode(e, d) {
      Vr.encode(e, d.header)
    },
    decode: (e) => ({ header: Vr.decode(e) }),
  },
  zr = _,
  Gr = {
    preencode(d, o) {
      ;(zr.preencode(d, o.header),
        e.fixed32.preencode(d, o.deviceKey),
        e.buffer.preencode(d, o.deviceProof),
        e.buffer.preencode(d, o.writerProof))
    },
    encode(d, o) {
      ;(zr.encode(d, o.header),
        e.fixed32.encode(d, o.deviceKey),
        e.buffer.encode(d, o.deviceProof),
        e.buffer.encode(d, o.writerProof))
    },
    decode: (d) => ({
      header: zr.decode(d),
      deviceKey: e.fixed32.decode(d),
      deviceProof: e.buffer.decode(d),
      writerProof: e.buffer.decode(d),
    }),
  },
  Qr = e.frame(T),
  Wr = Qr,
  Xr = e.array(Bc),
  Yr = e.frame(pe),
  Zr = Qr,
  $r = Yr,
  _r = e.frame(Kc),
  et = Yr,
  dt = e.frame(md),
  ot = e.frame(xc),
  nt = e.frame(kr),
  ct = nt,
  rt = e.array(e.frame(Nc)),
  tt = Qr,
  it = e.frame(Jn),
  at = it,
  st = it,
  pt = Qr
function ut(e) {
  o = e
}
function lt(d, n, c = 21) {
  return ((o = c), e.encode(yt(d), n))
}
function ft(d, n, c = 21) {
  return ((o = c), e.decode(yt(d), n))
}
function mt(e) {
  switch (e) {
    case "@keet/room-type":
      return J
    case "@keet/display-type":
      return Ac
    case "@keet/system-settings-keys":
      return qc
    case "@keet/room-supported-language":
      return Ec
    case "@keet/label-type":
      return Hc
    case "@keet-private-id/user-settings-key":
      return rr
    case "@keet/member-label-type":
      return pr
    case "@keet/build-type":
      return jr
    default:
      throw new Error("Enum not found " + e)
  }
}
function yt(e) {
  switch (e) {
    case "@keet/head":
      return n
    case "@keet/oplog-id":
      return c
    case "@keet/encryption-keypair":
      return r
    case "@keet/signing-keypair":
      return t
    case "@keet/room-keys":
      return i
    case "@keet/operation-header":
      return a
    case "@keet/blob-pointer":
      return s
    case "@keet/file-dimensions":
      return p
    case "@keet/file-metadata":
      return l
    case "@keet/external-drive-pointer":
      return f
    case "@keet/external-blob-pointer":
      return m
    case "@keet/file-pointer":
      return b
    case "@keet/file":
      return g
    case "@keet/image-file":
      return T
    case "@keet/file-status":
      return P
    case "@keet/file-record":
      return D
    case "@keet/device-status":
      return M
    case "@keet/member-status":
      return S
    case "@keet/member-moderation-status":
      return C
    case "@keet/abi":
      return L
    case "@keet/device-stats":
      return q
    case "@keet/member-stats":
      return F
    case "@keet/chat-stats":
      return E
    case "@keet/file-stats":
      return B
    case "@keet/stats":
      return O
    case "@keet/room-type":
      return V
    case "@keet/system-settings":
      return H
    case "@keet/system-digest":
      return Q
    case "@keet/room-seed":
      return W
    case "@keet/room-capabilities":
      return X
    case "@keet/room-config":
      return Z
    case "@keet/blind-peer":
      return $
    case "@keet/add-blind-peer-operation":
      return de
    case "@keet/remove-blind-peer-operation":
      return ne
    case "@keet/identity-attestation":
      return ce
    case "@keet/device-invitation":
      return re
    case "@keet/device":
      return ae
    case "@keet/member-profile":
      return se
    case "@keet/device-profile":
      return pe
    case "@keet/member-update":
      return le
    case "@keet/device-update":
      return fe
    case "@keet/signed-pairing-data":
      return me
    case "@keet/device-request-identity":
      return ye
    case "@keet/device-response-identity":
      return xe
    case "@keet/device-request-with-invitation":
      return ge
    case "@keet/device-request-with-invitation-and-proof":
      return Ke
    case "@keet/device-request-with-member-proof":
      return Pe
    case "@keet/device-request":
      return De
    case "@keet/device-response":
      return Ce
    case "@keet/invitation-metadata":
      return Le
    case "@keet/invitation":
      return Ee
    case "@keet/add-invitation-operation":
      return Ne
    case "@keet/remove-invitation-operation":
      return Ue
    case "@keet/sendable-room-invitation":
      return Oe
    case "@keet/sendable-identity-invitation":
      return Je
    case "@keet/sendable-contact-invitation":
      return Ve
    case "@keet/sendable-invitation":
      return We
    case "@keet/add-device-operation":
      return Ye
    case "@keet/update-device-operation":
      return $e
    case "@keet/start-indexing-operation":
      return _e
    case "@keet/stop-indexing-operation":
      return ed
    case "@keet/join-request":
      return od
    case "@keet/accept-join-request-operation":
      return rd
    case "@keet/reject-join-request-operation":
      return id
    case "@keet/member":
      return pd
    case "@keet/full-member":
      return fd
    case "@keet/member-proofs":
      return md
    case "@keet/update-member-operation":
      return bd
    case "@keet/change-member-status-operation":
      return gd
    case "@keet/change-member-role-operation":
      return Kd
    case "@keet/remove-member-operation":
      return Td
    case "@keet/member-activity":
      return Pd
    case "@keet/member-joined-event":
      return Ad
    case "@keet/member-left-event":
      return Rd
    case "@keet/title-changed-chat-event":
      return Dd
    case "@keet/chat-event":
      return Ld
    case "@keet/sendable-event":
      return qd
    case "@keet/display-range":
      return Fd
    case "@keet/display-content-range":
      return Bd
    case "@keet/mention-display-item":
      return Nd
    case "@keet/link-preview":
      return Od
    case "@keet/display-link-item":
      return Hd
    case "@keet/display":
      return eo
    case "@keet/oplog-message":
      return ro
    case "@keet/index-message":
      return ao
    case "@keet/full-index-message":
      return uo
    case "@keet/message-status":
      return lo
    case "@keet/message-index-id":
      return fo
    case "@keet/thread":
      return yo
    case "@keet/chat-message-record":
      return vo
    case "@keet/full-chat-message-record":
      return wo
    case "@keet/add-chat-message-operation":
      return Ao
    case "@keet/remove-chat-message-operation":
      return Do
    case "@keet/update-chat-message-operation":
      return Co
    case "@keet/pin-chat-message-operation":
      return qo
    case "@keet/reaction":
      return Fo
    case "@keet/reactions-summary":
      return Eo
    case "@keet/reactions-digest":
      return Io
    case "@keet/add-reaction-operation":
      return jo
    case "@keet/remove-reaction-operation":
      return Oo
    case "@keet/update-room-config-operation":
      return Ho
    case "@keet/group-member":
      return zo
    case "@keet/user-registry-info":
      return Go
    case "@keet/room-identity":
      return Wo
    case "@keet/genesis-operation":
      return on
    case "@keet/upgrade-operation":
      return cn
    case "@keet/update-system-settings-operation":
      return an
    case "@keet-private-id/contact":
      return sn
    case "@keet-private-id/v3-room-migration-info":
      return pn
    case "@keet-private-id/run-v3-migration-operation":
      return fn
    case "@keet-private-id/update-identity-operation":
      return yn
    case "@keet-private-id/counters":
      return xn
    case "@keet-private-id/stats":
      return bn
    case "@keet-private-id/add-entropy-operation":
      return kn
    case "@keet-private-id/pending-invitation-identity":
      return vn
    case "@keet-private-id/pending-invitation":
      return hn
    case "@keet-private-id/resolve-pending-invitation-operation":
      return wn
    case "@keet-private-id/add-pending-invitation-operation":
      return An
    case "@keet-private-id/remove-pending-invitation-operation":
      return Dn
    case "@keet-private-id/identity-swap":
      return Mn
    case "@keet-private-id/room-status":
      return Sn
    case "@keet-private-id/room":
      return Fn
    case "@keet-private-id/add-room-operation":
      return Bn
    case "@keet-private-id/remove-room-operation":
      return Nn
    case "@keet-private-id/update-room-status-operation":
      return On
    case "@keet-private-id/contact-status":
      return Jn
    case "@keet-private-id/contact-record":
      return Vn
    case "@keet-private-id/add-contact-operation":
      return Gn
    case "@keet-private-id/update-contact-status-operation":
      return Wn
    case "@keet-private-id/remove-contact-operation":
      return Yn
    case "@keet-private-id/contact-request-status":
      return Zn
    case "@keet-private-id/contact-request-body":
      return ec
    case "@keet-private-id/contact-request":
      return oc
    case "@keet-private-id/contact-request-record":
      return tc
    case "@keet-private-id/add-contact-request-operation":
      return ac
    case "@keet-private-id/update-contact-request-status-operation":
      return uc
    case "@keet-private-id/profile-discovery-record-v1":
      return lc
    case "@keet-private-id/profile-discovery-record":
      return fc
    case "@keet/add-file-preview-operation":
      return yc
    case "@keet/member-removed-event":
      return xc
    case "@keet/member-contact-info":
      return kc
    case "@keet/remove-device-operation":
      return gc
    case "@keet/device-identity":
      return hc
    case "@keet/readonly-room-invitation":
      return Kc
    case "@keet-private-id/identity-swap-v2":
      return wc
    case "@keet-private-id/activate-contact-room-operation":
      return Pc
    case "@keet/display-type":
      return Rc
    case "@keet/test-increment-operation":
      return Mc
    case "@keet/test-collection-record-1":
      return Sc
    case "@keet/migrate-abi-operation":
      return Lc
    case "@keet/system-settings-keys":
      return Fc
    case "@keet/room-supported-language":
      return Bc
    case "@keet/translation-display-item":
      return Nc
    case "@keet-private-id/unreads":
      return jc
    case "@keet-private-id/add-unreads-key-operation":
      return Oc
    case "@keet-private-id/remove-unreads-key-operation":
      return Vc
    case "@keet/label-type":
      return zc
    case "@keet/chat-label":
      return Gc
    case "@keet/add-chat-label-operation":
      return Wc
    case "@keet/remove-chat-label-operation":
      return Yc
    case "@keet/chat-label-summary":
      return Zc
    case "@keet/chat-label-digest":
      return _c
    case "@keet/update-read-length-operation":
      return dr
    case "@keet/read-length":
      return or
    case "@keet/tmp-removed-member":
      return nr
    case "@keet-private-id/settings":
      return cr
    case "@keet-private-id/user-settings-key":
      return tr
    case "@keet-private-id/update-settings-operation":
      return sr
    case "@keet/member-label-type":
      return ur
    case "@keet/member-label":
      return lr
    case "@keet/add-member-label-operation":
      return mr
    case "@keet/member-label-summary":
      return yr
    case "@keet/member-label-digest":
      return br
    case "@keet/location-shared-event":
      return kr
    case "@keet/move-indexer-operation":
      return gr
    case "@keet/start-call":
      return wr
    case "@keet/join-call":
      return Ar
    case "@keet/leave-call":
      return Dr
    case "@keet/end-call":
      return Sr
    case "@keet/add-call-stream":
      return Lr
    case "@keet/remove-call-stream":
      return Fr
    case "@keet/call-record":
      return Er
    case "@keet/call-member-record":
      return Br
    case "@keet/call-device-record":
      return Ir
    case "@keet/call-stream-record":
      return Nr
    case "@keet/build-type":
      return Ur
    case "@keet/test-crash-operation":
      return Jr
    case "@keet/test-dispatch-error-operation":
      return Hr
    case "@keet-private-id/shorten-device-attestation-operation":
      return Gr
    default:
      throw new Error("Encoder not found " + e)
  }
}
function xt(e, d = 21) {
  const n = yt(e)
  return {
    preencode(e, c) {
      ;((o = d), n.preencode(e, c))
    },
    encode(e, c) {
      ;((o = d), n.encode(e, c))
    },
    decode: (e) => ((o = d), n.decode(e)),
  }
}
const bt = xt
module.exports = {
  resolveStruct: bt,
  getStruct: xt,
  getEnum: mt,
  getEncoding: yt,
  encode: lt,
  decode: ft,
  setVersion: ut,
  version: o,
}