OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-schemas / packages / schema / spec / contract / hyperschema / index.js

3854 lines · javascript ref:
const { c: e } = require("hyperschema/runtime"),
  d = 19
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 && Nr.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 && Nr.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 ? Nr.decode(d) : null,
        hash: 4 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  h = e.frame(g),
  K = h,
  w = h,
  P = {
    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,
      }
    },
  },
  A = {
    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)) }),
  },
  T = e.frame(A),
  R = h,
  S = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.id),
        c.preencode(d, n.oplog),
        T.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),
        T.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 = T.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,
      }
    },
  },
  C = {
    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) }
    },
  },
  M = {
    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),
      }
    },
  },
  D = {
    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) }
    },
  },
  q = {
    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) }),
  },
  L = {
    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),
    }),
  },
  B = {
    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,
      }
    },
  },
  E = {
    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(L),
  j = e.frame(F),
  N = e.frame(B),
  O = e.frame(E),
  J = {
    preencode(e, d) {
      ;(I.preencode(e, d.devices),
        j.preencode(e, d.members),
        N.preencode(e, d.chat),
        O.preencode(e, d.files))
    },
    encode(e, d) {
      ;(I.encode(e, d.devices), j.encode(e, d.members), N.encode(e, d.chat), O.encode(e, d.files))
    },
    decode: (e) => ({
      devices: I.decode(e),
      members: j.decode(e),
      chat: N.decode(e),
      files: O.decode(e),
    }),
  },
  U = { 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(e, d) {
      ;(e.end++, d.roomType && V.preencode(e, d.roomType))
    },
    encode(d, o) {
      const n =
        (o.roomType ? 1 : 0) |
        (o.isExperimental ? 2 : 0) |
        (o.isJoiningDisabled ? 4 : 0) |
        (o.isAppendingDisabled ? 8 : 0) |
        (o.isCallingDisabled ? 16 : 0) |
        (o.isMembershipEventsDisabled ? 32 : 0)
      ;(e.uint.encode(d, n), o.roomType && V.encode(d, o.roomType))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        roomType: 1 & o ? V.decode(d) : 0,
        isExperimental: !!(2 & o),
        isJoiningDisabled: !!(4 & o),
        isAppendingDisabled: !!(8 & o),
        isCallingDisabled: !!(16 & o),
        isMembershipEventsDisabled: !!(32 & o),
      }
    },
  },
  z = e.frame(q),
  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 && Or.preencode(d, n.avatar),
        n.description && e.string.preencode(d, n.description),
        o >= 11 && n.supportedLanguages && Jr.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 && Or.encode(d, n.avatar),
        n.description && e.string.encode(d, n.description),
        o >= 11 && n.supportedLanguages && Jr.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 ? Or.decode(d) : null,
        description: 4 & n ? e.string.decode(d) : null,
        supportedLanguages: o >= 11 && 8 & n ? Jr.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(C),
  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),
        Ur.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),
        Ur.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: Ur.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 && Vr.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 && Vr.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 ? Vr.decode(d) : null,
        username: 8 & n ? e.string.decode(d) : null,
      }
    },
  },
  pe = {
    preencode(d, o) {
      ;(d.end++,
        o.swarmKey && e.fixed32.preencode(d, o.swarmKey),
        o.name && e.string.preencode(d, o.name))
    },
    encode(d, o) {
      const n = (o.swarmKey ? 1 : 0) | (o.name ? 2 : 0) | (o.isMobile ? 4 : 0)
      ;(e.uint.encode(d, n),
        o.swarmKey && e.fixed32.encode(d, o.swarmKey),
        o.name && e.string.encode(d, o.name))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        swarmKey: 1 & o ? e.fixed32.decode(d) : null,
        name: 2 & o ? e.string.decode(d) : null,
        isMobile: !!(4 & o),
      }
    },
  },
  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) {
      ;(Hr.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(Hr.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: Hr.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,
  Pe = ke,
  Ae = {
    preencode(e, d) {
      ;(we.preencode(e, d.device), e.end++, d.member && Pe.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 && Pe.encode(d, o.member))
    },
    decode: (d) => ({ device: we.decode(d), member: 1 & e.uint.decode(d) ? Pe.decode(d) : null }),
  },
  Te = e.frame(Ke),
  Re = e.frame(Ae),
  Se = {
    preencode(e, d) {
      ;(e.end++,
        d.withInvitation && Te.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 && Te.encode(d, o.withInvitation),
        o.withMemberProof && Re.encode(d, o.withMemberProof))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        withInvitation: 1 & o ? Te.decode(d) : null,
        withMemberProof: 2 & o ? Re.decode(d) : null,
      }
    },
  },
  Ce = e.frame(me),
  Me = e.frame(xe),
  De = {
    preencode(e, d) {
      ;(Ce.preencode(e, d.signedKeys), e.end++, d.identity && Me.preencode(e, d.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(Ce.encode(d, o.signedKeys), e.uint.encode(d, n), o.identity && Me.encode(d, o.identity))
    },
    decode: (d) => ({
      signedKeys: Ce.decode(d),
      identity: 1 & e.uint.decode(d) ? Me.decode(d) : null,
    }),
  },
  qe = {
    preencode(d, o) {
      ;(d.end++, o.expiration && e.uint.preencode(d, o.expiration))
    },
    encode(d, o) {
      const n =
        (o.expiration ? 1 : 0) |
        (o.requiresConfirmation ? 2 : 0) |
        (o.canModerate ? 4 : 0) |
        (o.canAdmin ? 8 : 0)
      ;(e.uint.encode(d, n), o.expiration && e.uint.encode(d, o.expiration))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        expiration: 1 & o ? e.uint.decode(d) : 0,
        requiresConfirmation: !!(2 & o),
        canModerate: !!(4 & o),
        canAdmin: !!(8 & o),
      }
    },
  },
  Le = Ce,
  Fe = e.frame(qe),
  Be = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        Le.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),
        Le.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 = Le.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),
      }
    },
  },
  Ee = _,
  Ie = e.frame(Be),
  je = {
    preencode(e, d) {
      ;(Ee.preencode(e, d.header), Ie.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Ee.encode(e, d.header), Ie.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Ee.decode(e), invitation: Ie.decode(e) }),
  },
  Ne = _,
  Oe = {
    preencode(d, o) {
      ;(Ne.preencode(d, o.header), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(Ne.encode(d, o.header), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ header: Ne.decode(d), id: e.fixed32.decode(d) }),
  },
  Je = {
    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),
    }),
  },
  Ue = {
    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(Je),
  ze = e.frame(Ue),
  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 && zr.preencode(e, d.readonly),
        o >= 11 && d.additionalNodes && Qe.preencode(e, d.additionalNodes))
    },
    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)
      ;(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 && zr.encode(d, n.readonly),
        o >= 11 && n.additionalNodes && Qe.encode(d, n.additionalNodes))
    },
    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 ? zr.decode(d) : null,
        additionalNodes: o >= 11 && 16 & n ? Qe.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 && Gr.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 && Gr.encode(d, o.profile))
    },
    decode: (d) => ({ header: Ze.decode(d), profile: 1 & e.uint.decode(d) ? Gr.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 = Me,
  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(M),
  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 && Qr.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 && Qr.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) ? Qr.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(D),
  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 = _,
  Pd = {
    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) }),
  },
  Ad = {
    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) }),
  },
  Td = {
    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 = Td,
  Sd = {
    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 }
    },
  },
  Cd = e.frame(Td),
  Md = e.frame(Rd),
  Dd = e.frame(Sd),
  qd = {
    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 && Cd.preencode(d, n.memberJoined),
        n.memberLeft && Md.preencode(d, n.memberLeft),
        n.titleChanged && Dd.preencode(d, n.titleChanged),
        o >= 3 && n.memberRemoved && Wr.preencode(d, n.memberRemoved),
        o >= 18 && n.locationShared && Xr.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 && Cd.encode(d, n.memberJoined),
        n.memberLeft && Md.encode(d, n.memberLeft),
        n.titleChanged && Dd.encode(d, n.titleChanged),
        o >= 3 && n.memberRemoved && Wr.encode(d, n.memberRemoved),
        o >= 18 && n.locationShared && Xr.encode(d, n.locationShared))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        memberJoined: 1 & n ? Cd.decode(d) : null,
        memberLeft: 2 & n ? Md.decode(d) : null,
        titleChanged: 4 & n ? Dd.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 ? Wr.decode(d) : null,
        locationShared: o >= 18 && 512 & n ? Xr.decode(d) : null,
      }
    },
  },
  Ld = {
    preencode(e, d) {
      ;(e.end++, o >= 18 && d.locationShared && Yr.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 && Yr.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 ? Yr.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) }),
  },
  Bd = e.frame(Fd),
  Ed = {
    preencode(d, o) {
      ;(Bd.preencode(d, o.range), e.string.preencode(d, o.content))
    },
    encode(d, o) {
      ;(Bd.encode(d, o.range), e.string.encode(d, o.content))
    },
    decode: (d) => ({ range: Bd.decode(d), content: e.string.decode(d) }),
  },
  Id = Bd,
  jd = {
    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) }),
  },
  Nd = h,
  Od = e.array(e.uint),
  Jd = {
    preencode(d, n) {
      ;(d.end++,
        n.title && e.string.preencode(d, n.title),
        n.description && e.string.preencode(d, n.description),
        n.file && Nd.preencode(d, n.file),
        o >= 7 && n.files && Od.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 && Nd.encode(d, n.file),
        o >= 7 && n.files && Od.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 ? Nd.decode(d) : null,
        files: o >= 7 && 8 & n ? Od.decode(d) : null,
      }
    },
  },
  Ud = Bd,
  Vd = e.frame(Jd),
  Hd = {
    preencode(d, o) {
      ;(Ud.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
      ;(Ud.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: Ud.decode(d),
      url: e.string.decode(d),
      preview: 1 & e.uint.decode(d) ? Vd.decode(d) : null,
    }),
  },
  zd = e.array(e.frame(jd)),
  Gd = e.array(e.frame(Hd)),
  Qd = Gd,
  Wd = e.array(e.frame(Fd)),
  Xd = Wd,
  Yd = Wd,
  Zd = e.array(e.frame(Ed)),
  $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 && Zr.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 && Zr.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 ? Zr.decode(d) : null,
      }
    },
  },
  oo = e.array(e.frame(g)),
  no = e.frame(eo),
  co = e.frame(Ld),
  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 = Od,
  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(J),
  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(qd),
  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,
      }
    },
  },
  Po = _,
  Ao = e.frame(ro),
  To = {
    preencode(e, d) {
      ;(Po.preencode(e, d.header), Ao.preencode(e, d.message))
    },
    encode(e, d) {
      ;(Po.encode(e, d.header), Ao.encode(e, d.message))
    },
    decode: (e) => ({ header: Po.decode(e), message: Ao.decode(e) }),
  },
  Ro = _,
  So = {
    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) }),
  },
  Co = _,
  Mo = Ao,
  Do = {
    preencode(e, d) {
      ;(Co.preencode(e, d.header), c.preencode(e, d.oplog), Mo.preencode(e, d.message))
    },
    encode(e, d) {
      ;(Co.encode(e, d.header), c.encode(e, d.oplog), Mo.encode(e, d.message))
    },
    decode: (e) => ({ header: Co.decode(e), oplog: c.decode(e), message: Mo.decode(e) }),
  },
  qo = _,
  Lo = {
    preencode(e, d) {
      ;(qo.preencode(e, d.header), c.preencode(e, d.oplog), e.end++)
    },
    encode(d, o) {
      const n = o.isPinned ? 1 : 0
      ;(qo.encode(d, o.header), c.encode(d, o.oplog), e.uint.encode(d, n))
    },
    decode: (d) => ({
      header: qo.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),
    }),
  },
  Bo = {
    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) }),
  },
  Eo = e.array(e.frame(Bo)),
  Io = {
    preencode(d, n) {
      ;(fo.preencode(d, n.id),
        e.uint.preencode(d, n.total),
        Eo.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),
        Eo.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 = Eo.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 }
    },
  },
  jo = _,
  No = {
    preencode(d, o) {
      ;(jo.preencode(d, o.header), c.preencode(d, o.oplog), e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(jo.encode(d, o.header), c.encode(d, o.oplog), e.string.encode(d, o.reaction))
    },
    decode: (d) => ({ header: jo.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  Oo = _,
  Jo = {
    preencode(d, o) {
      ;(Oo.preencode(d, o.header), c.preencode(d, o.oplog), e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(Oo.encode(d, o.header), c.encode(d, o.oplog), e.string.encode(d, o.reaction))
    },
    decode: (d) => ({ header: Oo.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  Uo = _,
  Vo = e.frame(Z),
  Ho = {
    preencode(d, o) {
      ;(Uo.preencode(d, o.header), e.uint.preencode(d, o.key), Vo.preencode(d, o.config))
    },
    encode(d, o) {
      ;(Uo.encode(d, o.header), e.uint.encode(d, o.key), Vo.encode(d, o.config))
    },
    decode: (d) => ({ header: Uo.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 && $r.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 && $r.encode(d, o.avatar))
    },
    decode: (d) => ({
      memberKey: e.fixed32.decode(d),
      displayName: e.string.decode(d),
      avatar: 1 & e.uint.decode(d) ? $r.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),
        _r.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),
        _r.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 = _r.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, o) {
      ;(e.fixed32.preencode(d, o.id),
        e.fixed32.preencode(d, o.invitationSeed),
        e.fixed32.preencode(d, o.mailbox),
        t.preencode(d, o.responseKeyPair),
        n.preencode(d, o.initiator),
        n.preencode(d, o.inviter),
        d.end++,
        o.identity && gn.preencode(d, o.identity))
    },
    encode(d, o) {
      const c = o.identity ? 1 : 0
      ;(e.fixed32.encode(d, o.id),
        e.fixed32.encode(d, o.invitationSeed),
        e.fixed32.encode(d, o.mailbox),
        t.encode(d, o.responseKeyPair),
        n.encode(d, o.initiator),
        n.encode(d, o.inviter),
        e.uint.encode(d, c),
        o.identity && gn.encode(d, o.identity))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      mailbox: e.fixed32.decode(d),
      responseKeyPair: t.decode(d),
      initiator: n.decode(d),
      inviter: n.decode(d),
      identity: 1 & e.uint.decode(d) ? gn.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) }),
  },
  Pn = _,
  An = e.frame(hn),
  Tn = {
    preencode(e, d) {
      ;(Pn.preencode(e, d.header), An.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Pn.encode(e, d.header), An.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Pn.decode(e), invitation: An.decode(e) }),
  },
  Rn = _,
  Sn = {
    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) }),
  },
  Cn = {
    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),
      }
    },
  },
  Mn = {
    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)
      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),
      }
    },
  },
  Dn = e.frame(Mn),
  qn = e.frame(Cn),
  Ln = gn,
  Fn = {
    preencode(d, c) {
      ;(e.fixed32.preencode(d, c.roomKey),
        e.buffer.preencode(d, c.encryptionKey),
        e.fixed32.preencode(d, c.mailbox),
        Dn.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 && qn.preencode(d, c.identitySwap),
        o >= 6 && c.identitySwapV2 && Ln.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),
        Dn.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 && qn.encode(d, c.identitySwap),
        o >= 6 && c.identitySwapV2 && Ln.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 = Dn.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 ? qn.decode(d) : null,
        identitySwapV2: o >= 6 && 8 & s ? Ln.decode(d) : null,
        contact: o >= 10 && 16 & s ? e.fixed32.decode(d) : null,
      }
    },
  },
  Bn = _,
  En = {
    preencode(d, o) {
      ;(Bn.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)
      ;(Bn.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 = Bn.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 = _,
  jn = {
    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) }),
  },
  Nn = _,
  On = Dn,
  Jn = {
    preencode(d, o) {
      ;(Nn.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.key),
        On.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Nn.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.key),
        On.encode(d, o.status))
    },
    decode: (d) => ({
      header: Nn.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: On.decode(d),
    }),
  },
  Un = {
    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),
        et.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),
        et.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 = et.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),
        dt.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Qn.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        dt.encode(d, o.status))
    },
    decode: (d) => ({
      header: Qn.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: dt.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),
        ot.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),
        ot.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 = ot.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,
      }
    },
  },
  Pc = _,
  Ac = {
    preencode(d, o) {
      ;(Pc.preencode(d, o.header), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Pc.encode(d, o.header), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ header: Pc.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Tc = { 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),
  },
  Sc = _,
  Cc = {
    preencode(d, o) {
      ;(Sc.preencode(d, o.header), e.uint.preencode(d, o.value))
    },
    encode(d, o) {
      ;(Sc.encode(d, o.header), e.uint.encode(d, o.value))
    },
    decode: (d) => ({ header: Sc.decode(d), value: e.uint.decode(d) }),
  },
  Mc = {
    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) }),
  },
  Dc = _,
  qc = {
    preencode(d, o) {
      ;(Dc.preencode(d, o.header), e.uint.preencode(d, o.from), e.uint.preencode(d, o.to))
    },
    encode(d, o) {
      ;(Dc.encode(d, o.header), e.uint.encode(d, o.from), e.uint.encode(d, o.to))
    },
    decode: (d) => ({ header: Dc.decode(d), from: e.uint.decode(d), to: e.uint.decode(d) }),
  },
  Lc = {
    RoomType: 1,
    IsExperimental: 2,
    IsJoiningDisabled: 3,
    IsAppendingDisabled: 4,
    IsCallingDisabled: 5,
    IsMembershipEventsDisabled: 6,
  },
  Fc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 6) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Bc = { en: "en", it: "it", ru: "ru", es: "es", de: "de" },
  Ec = {
    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 = Bd,
  jc = {
    preencode(d, o) {
      ;(Ic.preencode(d, o.range), Ec.preencode(d, o.language), e.string.preencode(d, o.text))
    },
    encode(d, o) {
      ;(Ic.encode(d, o.range), Ec.encode(d, o.language), e.string.encode(d, o.text))
    },
    decode: (d) => ({ range: Ic.decode(d), language: Ec.decode(d), text: e.string.decode(d) }),
  },
  Nc = {
    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) }),
  },
  Oc = _,
  Jc = {
    preencode(d, o) {
      ;(Oc.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(Oc.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: Oc.decode(d), key: e.fixed32.decode(d) }),
  },
  Uc = _,
  Vc = {
    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) }),
  },
  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
      e.uint.encode(d, c)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { disableReadReceipts: o >= 13 && !!(1 & n) }
    },
  },
  rr = { disableReadReceipts: "disableReadReceipts" },
  tr = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if ("disableReadReceipts" !== o) throw new Error("Unknown enum")
      e.uint.encode(d, 1)
    },
    decode: (d) => (1 === e.uint.decode(d) ? "disableReadReceipts" : 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,
      }
    },
  },
  Pr = _,
  Ar = Y,
  Tr = {
    preencode(d, n) {
      ;(Pr.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        d.end++,
        o >= 19 && n.streams && Ar.preencode(d, n.streams))
    },
    encode(d, n) {
      const c = o >= 19 && n.streams ? 1 : 0
      ;(Pr.encode(d, n.header),
        e.fixed32.encode(d, n.callKey),
        e.uint.encode(d, c),
        o >= 19 && n.streams && Ar.encode(d, n.streams))
    },
    decode(d) {
      const n = Pr.decode(d),
        c = e.fixed32.decode(d),
        r = e.uint.decode(d)
      return { header: n, callKey: c, streams: o >= 19 && 1 & r ? Ar.decode(d) : null }
    },
  },
  Rr = _,
  Sr = {
    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) }),
  },
  Cr = _,
  Mr = {
    preencode(d, o) {
      ;(Cr.preencode(d, o.header), e.fixed32.preencode(d, o.callKey))
    },
    encode(d, o) {
      ;(Cr.encode(d, o.header), e.fixed32.encode(d, o.callKey))
    },
    decode: (d) => ({ header: Cr.decode(d), callKey: e.fixed32.decode(d) }),
  },
  Dr = _,
  qr = {
    preencode(d, o) {
      ;(Dr.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.streamKey))
    },
    encode(d, o) {
      ;(Dr.encode(d, o.header), e.fixed32.encode(d, o.callKey), e.fixed32.encode(d, o.streamKey))
    },
    decode: (d) => ({
      header: Dr.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  Lr = _,
  Fr = {
    preencode(d, o) {
      ;(Lr.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.streamKey))
    },
    encode(d, o) {
      ;(Lr.encode(d, o.header), e.fixed32.encode(d, o.callKey), e.fixed32.encode(d, o.streamKey))
    },
    decode: (d) => ({
      header: Lr.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  Br = {
    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,
      }
    },
  },
  Er = {
    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,
      }
    },
  },
  jr = {
    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),
    }),
  },
  Nr = e.frame(P),
  Or = Nr,
  Jr = e.array(Ec),
  Ur = e.frame(pe),
  Vr = Nr,
  Hr = Ur,
  zr = e.frame(Kc),
  Gr = Ur,
  Qr = e.frame(md),
  Wr = e.frame(xc),
  Xr = e.frame(kr),
  Yr = Xr,
  Zr = e.array(e.frame(jc)),
  $r = Nr,
  _r = e.frame(Un),
  et = _r,
  dt = _r,
  ot = Nr
function nt(e) {
  o = e
}
function ct(d, n, c = 19) {
  return ((o = c), e.encode(it(d), n))
}
function rt(d, n, c = 19) {
  return ((o = c), e.decode(it(d), n))
}
function tt(e) {
  switch (e) {
    case "@keet/room-type":
      return U
    case "@keet/display-type":
      return Tc
    case "@keet/system-settings-keys":
      return Lc
    case "@keet/room-supported-language":
      return Bc
    case "@keet/label-type":
      return Hc
    case "@keet-private-id/user-settings-key":
      return rr
    case "@keet/member-label-type":
      return pr
    default:
      throw new Error("Enum not found " + e)
  }
}
function it(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 P
    case "@keet/file-status":
      return A
    case "@keet/file-record":
      return S
    case "@keet/device-status":
      return C
    case "@keet/member-status":
      return M
    case "@keet/member-moderation-status":
      return D
    case "@keet/abi":
      return q
    case "@keet/device-stats":
      return L
    case "@keet/member-stats":
      return F
    case "@keet/chat-stats":
      return B
    case "@keet/file-stats":
      return E
    case "@keet/stats":
      return J
    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 Ae
    case "@keet/device-request":
      return Se
    case "@keet/device-response":
      return De
    case "@keet/invitation-metadata":
      return qe
    case "@keet/invitation":
      return Be
    case "@keet/add-invitation-operation":
      return je
    case "@keet/remove-invitation-operation":
      return Oe
    case "@keet/sendable-room-invitation":
      return Je
    case "@keet/sendable-identity-invitation":
      return Ue
    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 Pd
    case "@keet/member-activity":
      return Ad
    case "@keet/member-joined-event":
      return Td
    case "@keet/member-left-event":
      return Rd
    case "@keet/title-changed-chat-event":
      return Sd
    case "@keet/chat-event":
      return qd
    case "@keet/sendable-event":
      return Ld
    case "@keet/display-range":
      return Fd
    case "@keet/display-content-range":
      return Ed
    case "@keet/mention-display-item":
      return jd
    case "@keet/link-preview":
      return Jd
    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 To
    case "@keet/remove-chat-message-operation":
      return So
    case "@keet/update-chat-message-operation":
      return Do
    case "@keet/pin-chat-message-operation":
      return Lo
    case "@keet/reaction":
      return Fo
    case "@keet/reactions-summary":
      return Bo
    case "@keet/reactions-digest":
      return Io
    case "@keet/add-reaction-operation":
      return No
    case "@keet/remove-reaction-operation":
      return Jo
    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 Tn
    case "@keet-private-id/remove-pending-invitation-operation":
      return Sn
    case "@keet-private-id/identity-swap":
      return Cn
    case "@keet-private-id/room-status":
      return Mn
    case "@keet-private-id/room":
      return Fn
    case "@keet-private-id/add-room-operation":
      return En
    case "@keet-private-id/remove-room-operation":
      return jn
    case "@keet-private-id/update-room-status-operation":
      return Jn
    case "@keet-private-id/contact-status":
      return Un
    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 Ac
    case "@keet/display-type":
      return Rc
    case "@keet/test-increment-operation":
      return Cc
    case "@keet/test-collection-record-1":
      return Mc
    case "@keet/migrate-abi-operation":
      return qc
    case "@keet/system-settings-keys":
      return Fc
    case "@keet/room-supported-language":
      return Ec
    case "@keet/translation-display-item":
      return jc
    case "@keet-private-id/unreads":
      return Nc
    case "@keet-private-id/add-unreads-key-operation":
      return Jc
    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 Tr
    case "@keet/leave-call":
      return Sr
    case "@keet/end-call":
      return Mr
    case "@keet/add-call-stream":
      return qr
    case "@keet/remove-call-stream":
      return Fr
    case "@keet/call-record":
      return Br
    case "@keet/call-member-record":
      return Er
    case "@keet/call-device-record":
      return Ir
    case "@keet/call-stream-record":
      return jr
    default:
      throw new Error("Encoder not found " + e)
  }
}
function at(e, d = 19) {
  const n = it(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 st = at
module.exports = {
  resolveStruct: st,
  getStruct: at,
  getEnum: tt,
  getEncoding: it,
  encode: ct,
  decode: rt,
  setVersion: nt,
  version: o,
}