OverviewFilesCommitsIssuesDocsReleasesPeers

keet-deobfuscated / @holepunchto / keet-schemas / packages / schema / spec / local / hyperdb / messages.js

5587 lines · javascript ref:
const { c: e } = require("hyperschema/runtime"),
  d = 28
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) }),
  },
  l = e.frame(p),
  u = {
    preencode(d, o) {
      ;(d.end++,
        o.name && e.string.preencode(d, o.name),
        o.mimetype && e.string.preencode(d, o.mimetype),
        o.dimensions && l.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 && l.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 ? l.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,
      }
    },
  },
  v = e.frame(b),
  k = e.frame(u),
  g = {
    preencode(d, o) {
      ;(v.preencode(d, o.pointer),
        d.end++,
        o.metadata && k.preencode(d, o.metadata),
        o.preview && Ra.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)
      ;(v.encode(d, o.pointer),
        e.uint.encode(d, n),
        o.metadata && k.encode(d, o.metadata),
        o.preview && Ra.encode(d, o.preview),
        o.hash && e.fixed32.encode(d, o.hash))
    },
    decode(d) {
      const o = v.decode(d),
        n = e.uint.decode(d)
      return {
        pointer: o,
        metadata: 1 & n ? k.decode(d) : null,
        preview: 2 & n ? Ra.decode(d) : null,
        hash: 4 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  K = e.frame(g),
  h = K,
  w = K,
  R = {
    preencode(e, d) {
      ;(e.end++,
        d.small && K.preencode(e, d.small),
        d.medium && h.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 && K.encode(d, o.small),
        o.medium && h.encode(d, o.medium),
        o.large && w.encode(d, o.large))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        small: 1 & o ? K.decode(d) : null,
        medium: 2 & o ? h.decode(d) : null,
        large: 4 & o ? w.decode(d) : null,
      }
    },
  },
  P = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = o.isDeleted ? 1 : 0
      e.uint.encode(d, n)
    },
    decode: (d) => ({ isDeleted: !!(1 & e.uint.decode(d)) }),
  },
  T = e.frame(P),
  M = K,
  A = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.id),
        c.preencode(d, n.oplog),
        T.preencode(d, n.status),
        M.preencode(d, n.file),
        d.end++,
        o >= 22 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const r = o >= 22 && n.version ? 1 : 0
      ;(e.uint.encode(d, n.id),
        c.encode(d, n.oplog),
        T.encode(d, n.status),
        M.encode(d, n.file),
        e.uint.encode(d, r),
        o >= 22 && 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 = M.decode(d),
        a = d.start < d.end ? e.uint.decode(d) : 0
      return {
        id: n,
        oplog: r,
        status: t,
        file: i,
        version: o >= 22 && 1 & a ? e.uint.decode(d) : 0,
      }
    },
  },
  D = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isActive ? 1 : 0) | (o.isIndexing ? 2 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isActive: !!(1 & o), isIndexing: !!(2 & o) }
    },
  },
  S = {
    preencode(d, n) {
      const c =
        (n.isAdmin ? 1 : 0) |
        (n.isModerator ? 2 : 0) |
        (n.isPending ? 4 : 0) |
        (n.isActive ? 8 : 0) |
        (n.isMuted ? 16 : 0) |
        (n.isBanned ? 32 : 0) |
        (n.isShadowBanned ? 64 : 0) |
        (o >= 19 && 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 >= 19 && 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 >= 19 && !!(128 & n),
      }
    },
  },
  C = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isMuted ? 1 : 0) | (o.isBanned ? 2 : 0) | (o.isShadowBanned ? 4 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isMuted: !!(1 & o), isBanned: !!(2 & o), isShadowBanned: !!(4 & o) }
    },
  },
  I = {
    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) }),
  },
  j = {
    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) }),
  },
  L = {
    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),
    }),
  },
  F = {
    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 >= 24 && n.flagsClock && e.uint.preencode(d, n.flagsClock))
    },
    encode(d, n) {
      const c = o >= 24 && 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 >= 24 && 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 >= 24 && 1 & i ? e.uint.decode(d) : 0,
      }
    },
  },
  q = {
    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) }),
  },
  B = e.frame(j),
  E = e.frame(L),
  V = e.frame(F),
  N = e.frame(q),
  O = {
    preencode(e, d) {
      ;(B.preencode(e, d.devices),
        E.preencode(e, d.members),
        V.preencode(e, d.chat),
        N.preencode(e, d.files))
    },
    encode(e, d) {
      ;(B.encode(e, d.devices), E.encode(e, d.members), V.encode(e, d.chat), N.encode(e, d.files))
    },
    decode: (e) => ({
      devices: B.decode(e),
      members: E.decode(e),
      chat: V.decode(e),
      files: N.decode(e),
    }),
  },
  U = { Default: 1, Broadcast: 2, DirectMessage: 3 },
  J = {
    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),
  },
  W = {
    preencode(e, d) {
      ;(e.end++, d.roomType && J.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 && J.encode(d, o.roomType))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        roomType: 1 & o ? J.decode(d) : 0,
        isExperimental: !!(2 & o),
        isJoiningDisabled: !!(4 & o),
        isAppendingDisabled: !!(8 & o),
        isCallingDisabled: !!(16 & o),
        isMembershipEventsDisabled: !!(32 & o),
      }
    },
  },
  z = e.frame(I),
  H = e.frame(W),
  G = {
    preencode(d, o) {
      ;(z.preencode(d, o.abi), H.preencode(d, o.settings), e.uint.preencode(d, o.creationTime))
    },
    encode(d, o) {
      ;(z.encode(d, o.abi), H.encode(d, o.settings), e.uint.encode(d, o.creationTime))
    },
    decode: (d) => ({ abi: z.decode(d), settings: H.decode(d), creationTime: e.uint.decode(d) }),
  },
  Q = {
    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 && Pa.preencode(d, n.avatar),
        n.description && e.string.preencode(d, n.description),
        o >= 17 && n.supportedLanguages && Ta.preencode(d, n.supportedLanguages),
        o >= 19 && 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 >= 17 && n.supportedLanguages ? 8 : 0) |
        (o >= 19 && n.blindPeers ? 16 : 0)
      ;(e.uint.encode(d, c),
        n.title && e.string.encode(d, n.title),
        n.avatar && Pa.encode(d, n.avatar),
        n.description && e.string.encode(d, n.description),
        o >= 17 && n.supportedLanguages && Ta.encode(d, n.supportedLanguages),
        o >= 19 && 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 ? Pa.decode(d) : null,
        description: 4 & n ? e.string.decode(d) : null,
        supportedLanguages: o >= 17 && 8 & n ? Ta.decode(d) : null,
        blindPeers: o >= 19 && 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(D),
  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),
        Ma.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),
        Ma.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: Ma.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 && Aa.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 && Aa.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 ? Aa.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),
      }
    },
  },
  le = e.frame(se),
  ue = {
    preencode(e, d) {
      ;(le.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(le.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: le.decode(e), attestation: ce.decode(e) }),
  },
  fe = {
    preencode(e, d) {
      ;(Da.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(Da.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: Da.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),
  ve = e.frame(ue),
  ke = e.frame(ye),
  ge = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey),
        t.preencode(d, o.keyPair),
        be.preencode(d, o.device),
        ve.preencode(d, o.member),
        d.end++,
        o.identity && ke.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),
        ve.encode(d, o.member),
        e.uint.encode(d, n),
        o.identity && ke.encode(d, o.identity))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      keyPair: t.decode(d),
      device: be.decode(d),
      member: ve.decode(d),
      identity: 1 & e.uint.decode(d) ? ke.decode(d) : null,
    }),
  },
  Ke = e.frame(ge),
  he = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        Ke.preencode(d, o.request),
        e.buffer.preencode(d, o.signature))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.id), Ke.encode(d, o.request), e.buffer.encode(d, o.signature))
    },
    decode: (d) => ({
      id: e.fixed32.decode(d),
      request: Ke.decode(d),
      signature: e.buffer.decode(d),
    }),
  },
  we = be,
  Re = ve,
  Pe = {
    preencode(e, d) {
      ;(we.preencode(e, d.device), e.end++, d.member && Re.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 && Re.encode(d, o.member))
    },
    decode: (d) => ({ device: we.decode(d), member: 1 & e.uint.decode(d) ? Re.decode(d) : null }),
  },
  Te = e.frame(he),
  Me = e.frame(Pe),
  Ae = {
    preencode(e, d) {
      ;(e.end++,
        d.withInvitation && Te.preencode(e, d.withInvitation),
        d.withMemberProof && Me.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 && Me.encode(d, o.withMemberProof))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        withInvitation: 1 & o ? Te.decode(d) : null,
        withMemberProof: 2 & o ? Me.decode(d) : null,
      }
    },
  },
  De = e.frame(me),
  Se = e.frame(xe),
  Ce = {
    preencode(e, d) {
      ;(De.preencode(e, d.signedKeys), e.end++, d.identity && Se.preencode(e, d.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(De.encode(d, o.signedKeys), e.uint.encode(d, n), o.identity && Se.encode(d, o.identity))
    },
    decode: (d) => ({
      signedKeys: De.decode(d),
      identity: 1 & e.uint.decode(d) ? Se.decode(d) : null,
    }),
  },
  Ie = {
    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),
      }
    },
  },
  je = De,
  Le = e.frame(Ie),
  Fe = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.id),
        je.preencode(d, o.response),
        Le.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),
        je.encode(d, o.response),
        Le.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 = je.decode(d),
        r = Le.decode(d),
        t = e.uint.decode(d)
      return {
        id: o,
        response: c,
        metadata: r,
        anchor: 1 & t ? n.decode(d) : null,
        isActive: !!(2 & t),
      }
    },
  },
  qe = _,
  Be = e.frame(Fe),
  Ee = {
    preencode(e, d) {
      ;(qe.preencode(e, d.header), Be.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(qe.encode(e, d.header), Be.encode(e, d.invitation))
    },
    decode: (e) => ({ header: qe.decode(e), invitation: Be.decode(e) }),
  },
  Ve = _,
  Ne = {
    preencode(d, o) {
      ;(Ve.preencode(d, o.header), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(Ve.encode(d, o.header), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ header: Ve.decode(d), id: e.fixed32.decode(d) }),
  },
  Oe = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        e.fixed32.preencode(d, o.invitationSeed),
        n.preencode(d, o.anchor))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.mailbox),
        e.fixed32.encode(d, o.invitationSeed),
        n.encode(d, o.anchor))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      invitationSeed: e.fixed32.decode(d),
      anchor: n.decode(d),
    }),
  },
  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),
    }),
  },
  Je = {
    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) }),
  },
  We = e.frame(Oe),
  ze = e.frame(Ue),
  He = e.frame(Je),
  Ge = e.array(e.ipv4Address),
  Qe = {
    preencode(e, d) {
      ;(e.end++,
        d.room && We.preencode(e, d.room),
        d.identity && ze.preencode(e, d.identity),
        d.contact && He.preencode(e, d.contact),
        o >= 9 && d.readonly && Sa.preencode(e, d.readonly),
        o >= 17 && d.additionalNodes && Ge.preencode(e, d.additionalNodes))
    },
    encode(d, n) {
      const c =
        (n.room ? 1 : 0) |
        (n.identity ? 2 : 0) |
        (n.contact ? 4 : 0) |
        (o >= 9 && n.readonly ? 8 : 0) |
        (o >= 17 && n.additionalNodes ? 16 : 0)
      ;(e.uint.encode(d, c),
        n.room && We.encode(d, n.room),
        n.identity && ze.encode(d, n.identity),
        n.contact && He.encode(d, n.contact),
        o >= 9 && n.readonly && Sa.encode(d, n.readonly),
        o >= 17 && n.additionalNodes && Ge.encode(d, n.additionalNodes))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        room: 1 & n ? We.decode(d) : null,
        identity: 2 & n ? ze.decode(d) : null,
        contact: 4 & n ? He.decode(d) : null,
        readonly: o >= 9 && 8 & n ? Sa.decode(d) : null,
        additionalNodes: o >= 17 && 16 & n ? Ge.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 && Ca.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 && Ca.encode(d, o.profile))
    },
    decode: (d) => ({ header: Ze.decode(d), profile: 1 & e.uint.decode(d) ? Ca.decode(d) : null }),
  },
  _e = { preencode(e, d) {}, encode(e, d) {}, decode: (e) => ({}) },
  ed = _e,
  dd = Ke,
  od = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.deviceKey),
        e.fixed32.preencode(d, o.id),
        dd.preencode(d, o.request))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.deviceKey), e.fixed32.encode(d, o.id), dd.encode(d, o.request))
    },
    decode: (d) => ({
      deviceKey: e.fixed32.decode(d),
      id: e.fixed32.decode(d),
      request: dd.decode(d),
    }),
  },
  nd = _,
  cd = Se,
  rd = {
    preencode(d, o) {
      ;(nd.preencode(d, o.header),
        e.fixed32.preencode(d, o.deviceKey),
        d.end++,
        o.identity && cd.preencode(d, o.identity))
    },
    encode(d, o) {
      const n = o.identity ? 1 : 0
      ;(nd.encode(d, o.header),
        e.fixed32.encode(d, o.deviceKey),
        e.uint.encode(d, n),
        o.identity && cd.encode(d, o.identity))
    },
    decode: (d) => ({
      header: nd.decode(d),
      deviceKey: e.fixed32.decode(d),
      identity: 1 & e.uint.decode(d) ? cd.decode(d) : null,
    }),
  },
  td = _,
  id = {
    preencode(d, o) {
      ;(td.preencode(d, o.header), e.fixed32.preencode(d, o.deviceKey))
    },
    encode(d, o) {
      ;(td.encode(d, o.header), e.fixed32.encode(d, o.deviceKey))
    },
    decode: (d) => ({ header: td.decode(d), deviceKey: e.fixed32.decode(d) }),
  },
  ad = e.frame(S),
  sd = le,
  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) }),
  },
  ld = ad,
  ud = le,
  fd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        ld.preencode(d, o.status),
        ud.preencode(d, o.profile),
        d.end++,
        o.proofs && Ia.preencode(d, o.proofs))
    },
    encode(d, o) {
      const n = o.proofs ? 1 : 0
      ;(e.fixed32.encode(d, o.key),
        ld.encode(d, o.status),
        ud.encode(d, o.profile),
        e.uint.encode(d, n),
        o.proofs && Ia.encode(d, o.proofs))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      status: ld.decode(d),
      profile: ud.decode(d),
      proofs: 1 & e.uint.decode(d) ? Ia.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 = ve,
  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) }),
  },
  vd = _,
  kd = e.frame(C),
  gd = {
    preencode(d, o) {
      ;(vd.preencode(d, o.header),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.key),
        kd.preencode(d, o.status))
    },
    encode(d, o) {
      ;(vd.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        kd.encode(d, o.status))
    },
    decode: (d) => ({
      header: vd.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: kd.decode(d),
    }),
  },
  Kd = _,
  hd = {
    preencode(d, o) {
      ;(Kd.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)
      ;(Kd.encode(d, o.header), e.fixed32.encode(d, o.key), e.uint.encode(d, n))
    },
    decode(d) {
      const o = Kd.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return { header: o, key: n, isModerator: !!(1 & c), isAdmin: !!(2 & c) }
    },
  },
  wd = _,
  Rd = {
    preencode(d, o) {
      ;(wd.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(wd.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: wd.decode(d), key: e.fixed32.decode(d) }),
  },
  Pd = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.uint.preencode(d, o.mentions))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, o.mentions))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), mentions: e.uint.decode(d) }),
  },
  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 }),
  },
  Md = Td,
  Ad = {
    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 }
    },
  },
  Dd = e.frame(Td),
  Sd = e.frame(Md),
  Cd = e.frame(Ad),
  Id = {
    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 >= 4 && n.roomAvatarChanged ? 64 : 0) |
        (o >= 4 && n.invitationCreated ? 128 : 0) |
        (o >= 4 && n.memberRemoved ? 256 : 0) |
        (o >= 27 && n.locationShared ? 512 : 0)
      ;(e.uint.preencode(d, c),
        n.memberJoined && Dd.preencode(d, n.memberJoined),
        n.memberLeft && Sd.preencode(d, n.memberLeft),
        n.titleChanged && Cd.preencode(d, n.titleChanged),
        o >= 4 && n.memberRemoved && ja.preencode(d, n.memberRemoved),
        o >= 27 && n.locationShared && La.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 >= 4 && n.roomAvatarChanged ? 64 : 0) |
        (o >= 4 && n.invitationCreated ? 128 : 0) |
        (o >= 4 && n.memberRemoved ? 256 : 0) |
        (o >= 27 && n.locationShared ? 512 : 0)
      ;(e.uint.encode(d, c),
        n.memberJoined && Dd.encode(d, n.memberJoined),
        n.memberLeft && Sd.encode(d, n.memberLeft),
        n.titleChanged && Cd.encode(d, n.titleChanged),
        o >= 4 && n.memberRemoved && ja.encode(d, n.memberRemoved),
        o >= 27 && n.locationShared && La.encode(d, n.locationShared))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        memberJoined: 1 & n ? Dd.decode(d) : null,
        memberLeft: 2 & n ? Sd.decode(d) : null,
        titleChanged: 4 & n ? Cd.decode(d) : null,
        callStarted: !!(8 & n),
        callHangup: !!(16 & n),
        callMissed: !!(32 & n),
        roomAvatarChanged: o >= 4 && !!(64 & n),
        invitationCreated: o >= 4 && !!(128 & n),
        memberRemoved: o >= 4 && 256 & n ? ja.decode(d) : null,
        locationShared: o >= 27 && 512 & n ? La.decode(d) : null,
      }
    },
  },
  jd = {
    preencode(e, d) {
      ;(e.end++, o >= 27 && d.locationShared && Fa.preencode(e, d.locationShared))
    },
    encode(d, n) {
      const c =
        (n.callStarted ? 1 : 0) |
        (n.callHangup ? 2 : 0) |
        (n.callMissed ? 4 : 0) |
        (o >= 27 && n.locationShared ? 8 : 0)
      ;(e.uint.encode(d, c), o >= 27 && n.locationShared && Fa.encode(d, n.locationShared))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        callStarted: !!(1 & n),
        callHangup: !!(2 & n),
        callMissed: !!(4 & n),
        locationShared: o >= 27 && 8 & n ? Fa.decode(d) : null,
      }
    },
  },
  Ld = {
    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) }),
  },
  Fd = e.frame(Ld),
  qd = {
    preencode(d, o) {
      ;(Fd.preencode(d, o.range), e.string.preencode(d, o.content))
    },
    encode(d, o) {
      ;(Fd.encode(d, o.range), e.string.encode(d, o.content))
    },
    decode: (d) => ({ range: Fd.decode(d), content: e.string.decode(d) }),
  },
  Bd = Fd,
  Ed = {
    preencode(d, o) {
      ;(Bd.preencode(d, o.range), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Bd.encode(d, o.range), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ range: Bd.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Vd = K,
  Nd = e.array(e.uint),
  Od = {
    preencode(d, n) {
      ;(d.end++,
        n.title && e.string.preencode(d, n.title),
        n.description && e.string.preencode(d, n.description),
        n.file && Vd.preencode(d, n.file),
        o >= 12 && n.files && Nd.preencode(d, n.files))
    },
    encode(d, n) {
      const c =
        (n.title ? 1 : 0) |
        (n.description ? 2 : 0) |
        (n.file ? 4 : 0) |
        (o >= 12 && 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 && Vd.encode(d, n.file),
        o >= 12 && n.files && Nd.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 ? Vd.decode(d) : null,
        files: o >= 12 && 8 & n ? Nd.decode(d) : null,
      }
    },
  },
  Ud = Fd,
  Jd = e.frame(Od),
  Wd = {
    preencode(d, o) {
      ;(Ud.preencode(d, o.range),
        e.string.preencode(d, o.url),
        d.end++,
        o.preview && Jd.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 && Jd.encode(d, o.preview))
    },
    decode: (d) => ({
      range: Ud.decode(d),
      url: e.string.decode(d),
      preview: 1 & e.uint.decode(d) ? Jd.decode(d) : null,
    }),
  },
  zd = e.array(e.frame(Ed)),
  Hd = e.array(e.frame(Wd)),
  Gd = Hd,
  Qd = e.array(e.frame(Ld)),
  Xd = Qd,
  Yd = Qd,
  Zd = e.array(e.frame(qd)),
  $d = Qd,
  _d = Qd,
  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 >= 17 && n.translation ? 512 : 0)
      ;(e.uint.preencode(d, c),
        n.mention && zd.preencode(d, n.mention),
        n.httpLink && Hd.preencode(d, n.httpLink),
        n.pearLink && Gd.preencode(d, n.pearLink),
        n.bold && Qd.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 >= 17 && n.translation && qa.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 >= 17 && n.translation ? 512 : 0)
      ;(e.uint.encode(d, c),
        n.mention && zd.encode(d, n.mention),
        n.httpLink && Hd.encode(d, n.httpLink),
        n.pearLink && Gd.encode(d, n.pearLink),
        n.bold && Qd.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 >= 17 && n.translation && qa.encode(d, n.translation))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        mention: 1 & n ? zd.decode(d) : null,
        httpLink: 2 & n ? Hd.decode(d) : null,
        pearLink: 4 & n ? Gd.decode(d) : null,
        bold: 8 & n ? Qd.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 >= 17 && 512 & n ? qa.decode(d) : null,
      }
    },
  },
  oo = e.array(e.frame(g)),
  no = e.frame(eo),
  co = e.frame(jd),
  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 >= 27 && 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 >= 27 && !!(64 & n),
      }
    },
  },
  to = Nd,
  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 >= 27 && 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 >= 27 && !!(32 & n),
      }
    },
  },
  so = oo,
  po = no,
  lo = {
    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 >= 27 && 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 >= 27 && !!(32 & n),
      }
    },
  },
  uo = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = (o.isEdited ? 1 : 0) | (o.isDeleted ? 2 : 0) | (o.isPinned ? 4 : 0)
      e.uint.encode(d, n)
    },
    decode(d) {
      const o = e.uint.decode(d)
      return { isEdited: !!(1 & o), isDeleted: !!(2 & o), isPinned: !!(4 & o) }
    },
  },
  fo = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.thread), e.uint.preencode(d, o.index))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.thread), e.uint.encode(d, o.index))
    },
    decode: (d) => ({ thread: e.uint.decode(d), index: e.uint.decode(d) }),
  },
  mo = e.frame(O),
  yo = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.id),
        e.uint.preencode(d, o.count),
        d.end++,
        o.parent && c.preencode(d, o.parent),
        o.stats && mo.preencode(d, o.stats))
    },
    encode(d, o) {
      const n = (o.parent ? 1 : 0) | (o.stats ? 2 : 0)
      ;(e.uint.encode(d, o.id),
        e.uint.encode(d, o.count),
        e.uint.encode(d, n),
        o.parent && c.encode(d, o.parent),
        o.stats && mo.encode(d, o.stats))
    },
    decode(d) {
      const o = e.uint.decode(d),
        n = e.uint.decode(d),
        r = e.uint.decode(d)
      return {
        id: o,
        count: n,
        parent: 1 & r ? c.decode(d) : null,
        stats: 2 & r ? mo.decode(d) : null,
      }
    },
  },
  xo = e.frame(uo),
  bo = e.frame(ao),
  vo = e.frame(Id),
  ko = {
    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 && vo.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 && vo.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 ? vo.decode(d) : null,
      }
    },
  },
  go = xo,
  Ko = e.frame(lo),
  ho = vo,
  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 && Ko.preencode(d, o.message),
        o.event && ho.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 && Ko.encode(d, o.message),
        o.event && ho.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 ? Ko.decode(d) : null,
        event: 4 & i ? ho.decode(d) : null,
      }
    },
  },
  Ro = _,
  Po = e.frame(ro),
  To = {
    preencode(e, d) {
      ;(Ro.preencode(e, d.header), Po.preencode(e, d.message))
    },
    encode(e, d) {
      ;(Ro.encode(e, d.header), Po.encode(e, d.message))
    },
    decode: (e) => ({ header: Ro.decode(e), message: Po.decode(e) }),
  },
  Mo = _,
  Ao = {
    preencode(e, d) {
      ;(Mo.preencode(e, d.header), c.preencode(e, d.oplog))
    },
    encode(e, d) {
      ;(Mo.encode(e, d.header), c.encode(e, d.oplog))
    },
    decode: (e) => ({ header: Mo.decode(e), oplog: c.decode(e) }),
  },
  Do = _,
  So = Po,
  Co = {
    preencode(e, d) {
      ;(Do.preencode(e, d.header), c.preencode(e, d.oplog), So.preencode(e, d.message))
    },
    encode(e, d) {
      ;(Do.encode(e, d.header), c.encode(e, d.oplog), So.encode(e, d.message))
    },
    decode: (e) => ({ header: Do.decode(e), oplog: c.decode(e), message: So.decode(e) }),
  },
  Io = _,
  jo = {
    preencode(e, d) {
      ;(Io.preencode(e, d.header), c.preencode(e, d.oplog), e.end++)
    },
    encode(d, o) {
      const n = o.isPinned ? 1 : 0
      ;(Io.encode(d, o.header), c.encode(d, o.oplog), e.uint.encode(d, n))
    },
    decode: (d) => ({
      header: Io.decode(d),
      oplog: c.decode(d),
      isPinned: !!(1 & e.uint.decode(d)),
    }),
  },
  Lo = {
    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),
    }),
  },
  Fo = {
    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) }),
  },
  qo = e.array(e.frame(Fo)),
  Bo = {
    preencode(d, n) {
      ;(fo.preencode(d, n.id),
        e.uint.preencode(d, n.total),
        qo.preencode(d, n.reactions),
        d.end++,
        o >= 17 && n.editedAt && e.uint.preencode(d, n.editedAt))
    },
    encode(d, n) {
      const c = o >= 17 && n.editedAt ? 1 : 0
      ;(fo.encode(d, n.id),
        e.uint.encode(d, n.total),
        qo.encode(d, n.reactions),
        e.uint.encode(d, c),
        o >= 17 && n.editedAt && e.uint.encode(d, n.editedAt))
    },
    decode(d) {
      const n = fo.decode(d),
        c = e.uint.decode(d),
        r = qo.decode(d),
        t = d.start < d.end ? e.uint.decode(d) : 0
      return { id: n, total: c, reactions: r, editedAt: o >= 17 && 1 & t ? e.uint.decode(d) : 0 }
    },
  },
  Eo = _,
  Vo = {
    preencode(d, o) {
      ;(Eo.preencode(d, o.header), c.preencode(d, o.oplog), e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(Eo.encode(d, o.header), c.encode(d, o.oplog), e.string.encode(d, o.reaction))
    },
    decode: (d) => ({ header: Eo.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  No = _,
  Oo = {
    preencode(d, o) {
      ;(No.preencode(d, o.header), c.preencode(d, o.oplog), e.string.preencode(d, o.reaction))
    },
    encode(d, o) {
      ;(No.encode(d, o.header), c.encode(d, o.oplog), e.string.encode(d, o.reaction))
    },
    decode: (d) => ({ header: No.decode(d), oplog: c.decode(d), reaction: e.string.decode(d) }),
  },
  Uo = _,
  Jo = e.frame(Z),
  Wo = {
    preencode(d, o) {
      ;(Uo.preencode(d, o.header), e.uint.preencode(d, o.key), Jo.preencode(d, o.config))
    },
    encode(d, o) {
      ;(Uo.encode(d, o.header), e.uint.encode(d, o.key), Jo.encode(d, o.config))
    },
    decode: (d) => ({ header: Uo.decode(d), key: e.uint.decode(d), config: Jo.decode(d) }),
  },
  zo = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.string.preencode(d, o.displayName),
        d.end++,
        o.avatar && Ba.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 && Ba.encode(d, o.avatar))
    },
    decode: (d) => ({
      memberKey: e.fixed32.decode(d),
      displayName: e.string.decode(d),
      avatar: 1 & e.uint.decode(d) ? Ba.decode(d) : null,
    }),
  },
  Ho = {
    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,
    }),
  },
  Go = e.frame(Ho),
  Qo = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        d.end++,
        o.discoveryCoreKey && e.fixed32.preencode(d, o.discoveryCoreKey),
        o.userRegistry && Go.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 && Go.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 ? Go.decode(d) : null,
      }
    },
  },
  Xo = _,
  Yo = e.frame(G),
  Zo = e.frame(Q),
  $o = Jo,
  _o = e.frame(Qo),
  en = be,
  dn = e.array(e.frame(ue)),
  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 = H,
  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),
        Ea.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),
        Ea.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 = Ea.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),
    }),
  },
  ln = e.array(e.frame(pn)),
  un = Y,
  fn = {
    preencode(e, d) {
      ;(ln.preencode(e, d.sharedRooms), un.preencode(e, d.blockedContacts))
    },
    encode(e, d) {
      ;(ln.encode(e, d.sharedRooms), un.encode(e, d.blockedContacts))
    },
    decode: (e) => ({ sharedRooms: ln.decode(e), blockedContacts: un.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) }),
  },
  vn = {
    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) }),
  },
  kn = {
    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(kn),
  Kn = {
    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,
    }),
  },
  hn = _,
  wn = {
    preencode(d, o) {
      ;(hn.preencode(d, o.header), e.buffer.preencode(d, o.blindResponse))
    },
    encode(d, o) {
      ;(hn.encode(d, o.header), e.buffer.encode(d, o.blindResponse))
    },
    decode: (d) => ({ header: hn.decode(d), blindResponse: e.buffer.decode(d) }),
  },
  Rn = _,
  Pn = e.frame(Kn),
  Tn = {
    preencode(e, d) {
      ;(Rn.preencode(e, d.header), Pn.preencode(e, d.invitation))
    },
    encode(e, d) {
      ;(Rn.encode(e, d.header), Pn.encode(e, d.invitation))
    },
    decode: (e) => ({ header: Rn.decode(e), invitation: Pn.decode(e) }),
  },
  Mn = _,
  An = {
    preencode(d, o) {
      ;(Mn.preencode(d, o.header), e.fixed32.preencode(d, o.id))
    },
    encode(d, o) {
      ;(Mn.encode(d, o.header), e.fixed32.encode(d, o.id))
    },
    decode: (d) => ({ header: Mn.decode(d), id: e.fixed32.decode(d) }),
  },
  Dn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.publicKey),
        e.fixed32.preencode(d, o.devicePublicKey),
        d.end++,
        o.privateProfileKey && e.fixed32.preencode(d, o.privateProfileKey),
        o.deviceKeyPair && t.preencode(d, o.deviceKeyPair),
        e.buffer.preencode(d, o.deviceProof))
    },
    encode(d, o) {
      const n = (o.privateProfileKey ? 1 : 0) | (o.deviceKeyPair ? 2 : 0)
      ;(e.fixed32.encode(d, o.publicKey),
        e.fixed32.encode(d, o.devicePublicKey),
        e.uint.encode(d, n),
        o.privateProfileKey && e.fixed32.encode(d, o.privateProfileKey),
        o.deviceKeyPair && t.encode(d, o.deviceKeyPair),
        e.buffer.encode(d, o.deviceProof))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        publicKey: o,
        devicePublicKey: n,
        privateProfileKey: 1 & c ? e.fixed32.decode(d) : null,
        deviceKeyPair: 2 & c ? t.decode(d) : null,
        deviceProof: e.buffer.decode(d),
      }
    },
  },
  Sn = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const c =
        (n.isActive ? 1 : 0) |
        (n.isFullyMuted ? 2 : 0) |
        (n.isMentionsOnlyMuted ? 4 : 0) |
        (o >= 14 && n.isReadOnly ? 8 : 0) |
        (o >= 27 && 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 >= 14 && !!(8 & n),
        isFavorite: o >= 27 && !!(16 & n),
      }
    },
  },
  Cn = e.frame(Sn),
  In = e.frame(Dn),
  jn = gn,
  Ln = {
    preencode(d, c) {
      ;(e.fixed32.preencode(d, c.roomKey),
        e.buffer.preencode(d, c.encryptionKey),
        e.fixed32.preencode(d, c.mailbox),
        Cn.preencode(d, c.status),
        e.uint.preencode(d, c.clock),
        d.end++,
        c.initiator && n.preencode(d, c.initiator),
        c.fastForwardTo && e.fixed32.preencode(d, c.fastForwardTo),
        c.identitySwap && In.preencode(d, c.identitySwap),
        o >= 9 && c.identitySwapV2 && jn.preencode(d, c.identitySwapV2),
        o >= 15 && 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 >= 9 && c.identitySwapV2 ? 8 : 0) |
        (o >= 15 && c.contact ? 16 : 0)
      ;(e.fixed32.encode(d, c.roomKey),
        e.buffer.encode(d, c.encryptionKey),
        e.fixed32.encode(d, c.mailbox),
        Cn.encode(d, c.status),
        e.uint.encode(d, c.clock),
        e.uint.encode(d, r),
        c.initiator && n.encode(d, c.initiator),
        c.fastForwardTo && e.fixed32.encode(d, c.fastForwardTo),
        c.identitySwap && In.encode(d, c.identitySwap),
        o >= 9 && c.identitySwapV2 && jn.encode(d, c.identitySwapV2),
        o >= 15 && c.contact && e.fixed32.encode(d, c.contact))
    },
    decode(d) {
      const c = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        t = e.fixed32.decode(d),
        i = Cn.decode(d),
        a = e.uint.decode(d),
        s = e.uint.decode(d)
      return {
        roomKey: c,
        encryptionKey: r,
        mailbox: t,
        status: i,
        clock: a,
        initiator: 1 & s ? n.decode(d) : null,
        fastForwardTo: 2 & s ? e.fixed32.decode(d) : null,
        identitySwap: 4 & s ? In.decode(d) : null,
        identitySwapV2: o >= 9 && 8 & s ? jn.decode(d) : null,
        contact: o >= 15 && 16 & s ? e.fixed32.decode(d) : null,
      }
    },
  },
  Fn = _,
  qn = {
    preencode(d, o) {
      ;(Fn.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 >= 14 && c.isReadOnly ? 8 : 0)
      ;(Fn.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 = Fn.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 >= 14 && !!(8 & a),
      }
    },
  },
  Bn = _,
  En = {
    preencode(d, o) {
      ;(Bn.preencode(d, o.header), e.fixed32.preencode(d, o.discoveryKey))
    },
    encode(d, o) {
      ;(Bn.encode(d, o.header), e.fixed32.encode(d, o.discoveryKey))
    },
    decode: (d) => ({ header: Bn.decode(d), discoveryKey: e.fixed32.decode(d) }),
  },
  Vn = _,
  Nn = Cn,
  On = {
    preencode(d, o) {
      ;(Vn.preencode(d, o.header),
        e.fixed32.preencode(d, o.roomKey),
        e.uint.preencode(d, o.key),
        Nn.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Vn.encode(d, o.header),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, o.key),
        Nn.encode(d, o.status))
    },
    decode: (d) => ({
      header: Vn.decode(d),
      roomKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: Nn.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)) }),
  },
  Jn = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.clock),
        Va.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),
        Va.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 = Va.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,
      }
    },
  },
  Wn = _,
  zn = e.frame(sn),
  Hn = {
    preencode(e, d) {
      ;(Wn.preencode(e, d.header), zn.preencode(e, d.contact))
    },
    encode(e, d) {
      ;(Wn.encode(e, d.header), zn.encode(e, d.contact))
    },
    decode: (e) => ({ header: Wn.decode(e), contact: zn.decode(e) }),
  },
  Gn = _,
  Qn = {
    preencode(d, o) {
      ;(Gn.preencode(d, o.header),
        e.fixed32.preencode(d, o.memberKey),
        e.uint.preencode(d, o.key),
        Na.preencode(d, o.status))
    },
    encode(d, o) {
      ;(Gn.encode(d, o.header),
        e.fixed32.encode(d, o.memberKey),
        e.uint.encode(d, o.key),
        Na.encode(d, o.status))
    },
    decode: (d) => ({
      header: Gn.decode(d),
      memberKey: e.fixed32.decode(d),
      key: e.uint.decode(d),
      status: Na.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 = ve,
  _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 = le,
  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 >= 17 && n.sentAt && e.uint.preencode(d, n.sentAt))
    },
    encode(d, n) {
      const c = (n.message ? 1 : 0) | (o >= 17 && 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 >= 17 && 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 >= 17 && 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,
  lc = {
    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 >= 15 && n.roomKey && e.fixed32.preencode(d, n.roomKey))
    },
    encode(d, n) {
      const c = o >= 15 && 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 >= 15 && 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 >= 15 && 1 & i ? e.fixed32.decode(d) : null,
      }
    },
  },
  uc = {
    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:
          uc.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:
          uc.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 uc.decode(d)
        default:
          throw new Error("Unsupported version")
      }
    },
  },
  mc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.discoveryPublicKey),
        e.uint.preencode(d, o.timestamp),
        d.end++,
        o.lastSynced && e.uint.preencode(d, o.lastSynced))
    },
    encode(d, o) {
      const n = (o.lastSynced ? 1 : 0) | (o.dirty ? 2 : 0)
      ;(e.fixed32.encode(d, o.discoveryPublicKey),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.lastSynced && e.uint.encode(d, o.lastSynced))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d),
        c = e.uint.decode(d)
      return {
        discoveryPublicKey: o,
        timestamp: n,
        lastSynced: 1 & c ? e.uint.decode(d) : 0,
        dirty: !!(2 & c),
      }
    },
  },
  yc = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.rooms), e.uint.preencode(d, o.activeRooms))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.rooms), e.uint.encode(d, o.activeRooms))
    },
    decode: (d) => ({ rooms: e.uint.decode(d), activeRooms: e.uint.decode(d) }),
  },
  xc = I,
  bc = Y,
  vc = {
    preencode(e, d) {
      ;(e.end++, d.blockedMembers && bc.preencode(e, d.blockedMembers))
    },
    encode(d, o) {
      const n = o.blockedMembers ? 1 : 0
      ;(e.uint.encode(d, n), o.blockedMembers && bc.encode(d, o.blockedMembers))
    },
    decode: (d) => ({ blockedMembers: 1 & e.uint.decode(d) ? bc.decode(d) : null }),
  },
  kc = e.frame(X),
  gc = e.frame(vc),
  Kc = {
    preencode(d, o) {
      ;(e.buffer.preencode(d, o.encryptionKey),
        e.fixed32.preencode(d, o.seed),
        kc.preencode(d, o.capabilities),
        n.preencode(d, o.initiator),
        e.fixed32.preencode(d, o.fastForwardTo),
        d.end++,
        o.privateProfile && gc.preencode(d, o.privateProfile))
    },
    encode(d, o) {
      const c = o.privateProfile ? 1 : 0
      ;(e.buffer.encode(d, o.encryptionKey),
        e.fixed32.encode(d, o.seed),
        kc.encode(d, o.capabilities),
        n.encode(d, o.initiator),
        e.fixed32.encode(d, o.fastForwardTo),
        e.uint.encode(d, c),
        o.privateProfile && gc.encode(d, o.privateProfile))
    },
    decode: (d) => ({
      encryptionKey: e.buffer.decode(d),
      seed: e.fixed32.decode(d),
      capabilities: kc.decode(d),
      initiator: n.decode(d),
      fastForwardTo: e.fixed32.decode(d),
      privateProfile: 1 & e.uint.decode(d) ? gc.decode(d) : null,
    }),
  },
  hc = {
    preencode(d, o) {
      ;(d.end++, o.count && e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      const n = o.count ? 1 : 0
      ;(e.uint.encode(d, n), o.count && e.uint.encode(d, o.count))
    },
    decode: (d) => ({ count: 1 & e.uint.decode(d) ? e.uint.decode(d) : 0 }),
  },
  wc = e.frame(Kc),
  Rc = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.roomKey),
        e.uint.preencode(d, n.priority),
        d.end++,
        n.v3 && wc.preencode(d, n.v3),
        o >= 5 && n.timestamp && e.uint.preencode(d, n.timestamp))
    },
    encode(d, n) {
      const c = (n.v3 ? 1 : 0) | (o >= 3 && n.errored ? 2 : 0) | (o >= 5 && n.timestamp ? 4 : 0)
      ;(e.fixed32.encode(d, n.roomKey),
        e.uint.encode(d, n.priority),
        e.uint.encode(d, c),
        n.v3 && wc.encode(d, n.v3),
        o >= 5 && n.timestamp && e.uint.encode(d, n.timestamp))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.uint.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: n,
        priority: c,
        v3: 1 & r ? wc.decode(d) : null,
        errored: o >= 3 && !!(2 & r),
        timestamp: o >= 5 && 4 & r ? e.uint.decode(d) : 0,
      }
    },
  },
  Pc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      const n = o.isConfirmed ? 1 : 0
      e.uint.encode(d, n)
    },
    decode: (d) => ({ isConfirmed: !!(1 & e.uint.decode(d)) }),
  },
  Tc = e.frame(Pc),
  Mc = In,
  Ac = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey),
        e.fixed32.preencode(d, n.privateProfileKey),
        t.preencode(d, n.deviceKeyPair),
        e.buffer.preencode(d, n.deviceProof),
        Tc.preencode(d, n.status),
        d.end++,
        n.entropy && e.buffer.preencode(d, n.entropy),
        n.swap && Mc.preencode(d, n.swap),
        o >= 9 && n.swapV2 && Oa.preencode(d, n.swapV2))
    },
    encode(d, n) {
      const c = (n.entropy ? 1 : 0) | (n.swap ? 2 : 0) | (o >= 9 && n.swapV2 ? 4 : 0)
      ;(e.fixed32.encode(d, n.publicKey),
        e.fixed32.encode(d, n.privateProfileKey),
        t.encode(d, n.deviceKeyPair),
        e.buffer.encode(d, n.deviceProof),
        Tc.encode(d, n.status),
        e.uint.encode(d, c),
        n.entropy && e.buffer.encode(d, n.entropy),
        n.swap && Mc.encode(d, n.swap),
        o >= 9 && n.swapV2 && Oa.encode(d, n.swapV2))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = t.decode(d),
        i = e.buffer.decode(d),
        a = Tc.decode(d),
        s = e.uint.decode(d)
      return {
        publicKey: n,
        privateProfileKey: c,
        deviceKeyPair: r,
        deviceProof: i,
        status: a,
        entropy: 1 & s ? e.buffer.decode(d) : null,
        swap: 2 & s ? Mc.decode(d) : null,
        swapV2: o >= 9 && 4 & s ? Oa.decode(d) : null,
      }
    },
  },
  Dc = {
    RestoreIdentity: 1,
    CreateRoom: 2,
    LeaveRoom: 3,
    ClearRoom: 4,
    JoinRoomInvitation: 5,
    JoinRoomKeys: 6,
    JoinRoomResponse: 7,
    SendContactRequest: 8,
    TestFastTask: 9,
    TestSlowTask: 10,
    TestErrorTask: 11,
  },
  Sc = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 11) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Cc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.initiator && n.preencode(d, o.initiator))
    },
    encode(d, o) {
      const c = (o.fastForwardTo ? 1 : 0) | (o.initiator ? 2 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, c),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo),
        o.initiator && n.encode(d, o.initiator))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        fastForwardTo: 1 & r ? e.fixed32.decode(d) : null,
        initiator: 2 & r ? n.decode(d) : null,
      }
    },
  },
  Ic = Pn,
  jc = {
    preencode(e, d) {
      Ic.preencode(e, d.invitation)
    },
    encode(e, d) {
      Ic.encode(e, d.invitation)
    },
    decode: (e) => ({ invitation: Ic.decode(e) }),
  },
  Lc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        t.preencode(d, o.keyPair),
        e.buffer.preencode(d, o.response))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.mailbox), t.encode(d, o.keyPair), e.buffer.encode(d, o.response))
    },
    decode: (d) => ({
      mailbox: e.fixed32.decode(d),
      keyPair: t.decode(d),
      response: e.buffer.decode(d),
    }),
  },
  Fc = $,
  qc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.initiator && n.preencode(d, o.initiator),
        o.mailbox && e.fixed32.preencode(d, o.mailbox))
    },
    encode(d, o) {
      const c = (o.fastForwardTo ? 1 : 0) | (o.initiator ? 2 : 0) | (o.mailbox ? 4 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, c),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo),
        o.initiator && n.encode(d, o.initiator),
        o.mailbox && e.fixed32.encode(d, o.mailbox))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        fastForwardTo: 1 & r ? e.fixed32.decode(d) : null,
        initiator: 2 & r ? n.decode(d) : null,
        mailbox: 4 & r ? e.fixed32.decode(d) : null,
      }
    },
  },
  Bc = e.frame(qc),
  Ec = {
    preencode(e, d) {
      Bc.preencode(e, d.keys)
    },
    encode(e, d) {
      Bc.encode(e, d.keys)
    },
    decode: (e) => ({ keys: Bc.decode(e) }),
  },
  Vc = e.frame(on),
  Nc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey),
        e.buffer.preencode(d, o.encryptionKey),
        d.end++,
        o.fastForwardTo && e.fixed32.preencode(d, o.fastForwardTo),
        o.initiator && n.preencode(d, o.initiator),
        o.mailbox && e.fixed32.preencode(d, o.mailbox),
        o.keyPair && t.preencode(d, o.keyPair),
        o.genesis && Vc.preencode(d, o.genesis))
    },
    encode(d, o) {
      const c =
        (o.fastForwardTo ? 1 : 0) |
        (o.initiator ? 2 : 0) |
        (o.mailbox ? 4 : 0) |
        (o.keyPair ? 8 : 0) |
        (o.genesis ? 16 : 0) |
        (o.isPrivateProfile ? 32 : 0)
      ;(e.fixed32.encode(d, o.roomKey),
        e.buffer.encode(d, o.encryptionKey),
        e.uint.encode(d, c),
        o.fastForwardTo && e.fixed32.encode(d, o.fastForwardTo),
        o.initiator && n.encode(d, o.initiator),
        o.mailbox && e.fixed32.encode(d, o.mailbox),
        o.keyPair && t.encode(d, o.keyPair),
        o.genesis && Vc.encode(d, o.genesis))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: o,
        encryptionKey: c,
        fastForwardTo: 1 & r ? e.fixed32.decode(d) : null,
        initiator: 2 & r ? n.decode(d) : null,
        mailbox: 4 & r ? e.fixed32.decode(d) : null,
        keyPair: 8 & r ? t.decode(d) : null,
        genesis: 16 & r ? Vc.decode(d) : null,
        isPrivateProfile: !!(32 & r),
      }
    },
  },
  Oc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), d.end++)
    },
    encode(d, o) {
      const n = o.isGossiped ? 1 : 0
      ;(e.fixed32.encode(d, o.roomKey), e.uint.encode(d, n))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), isGossiped: !!(1 & e.uint.decode(d)) }),
  },
  Uc = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.roomKey)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.roomKey)
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d) }),
  },
  Jc = {
    preencode(d, o) {
      ;(e.string.preencode(d, o.mnemonic),
        d.end++,
        o.profileDiscoveryTimeout && e.uint.preencode(d, o.profileDiscoveryTimeout))
    },
    encode(d, o) {
      const n = (o.profileDiscoveryTimeout ? 1 : 0) | (o.recover ? 2 : 0)
      ;(e.string.encode(d, o.mnemonic),
        e.uint.encode(d, n),
        o.profileDiscoveryTimeout && e.uint.encode(d, o.profileDiscoveryTimeout))
    },
    decode(d) {
      const o = e.string.decode(d),
        n = e.uint.decode(d)
      return {
        mnemonic: o,
        profileDiscoveryTimeout: 1 & n ? e.uint.decode(d) : 0,
        recover: !!(2 & n),
      }
    },
  },
  Wc = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.roomKey),
        e.fixed32.preencode(d, n.memberKey),
        d.end++,
        n.message && e.string.preencode(d, n.message),
        o >= 6 && n.contactInfo && Ua.preencode(d, n.contactInfo))
    },
    encode(d, n) {
      const c = (n.message ? 1 : 0) | (o >= 6 && n.contactInfo ? 2 : 0)
      ;(e.fixed32.encode(d, n.roomKey),
        e.fixed32.encode(d, n.memberKey),
        e.uint.encode(d, c),
        n.message && e.string.encode(d, n.message),
        o >= 6 && n.contactInfo && Ua.encode(d, n.contactInfo))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = e.uint.decode(d)
      return {
        roomKey: n,
        memberKey: c,
        message: 1 & r ? e.string.decode(d) : null,
        contactInfo: o >= 6 && 2 & r ? Ua.decode(d) : null,
      }
    },
  },
  zc = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), d.end++)
    },
    encode(d, o) {
      const n = o.isPrivateProfile ? 1 : 0
      ;(e.fixed32.encode(d, o.key), e.uint.encode(d, n))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), isPrivateProfile: !!(1 & e.uint.decode(d)) }),
  },
  Hc = e.frame(Jc),
  Gc = e.frame(Nc),
  Qc = e.frame(Oc),
  Xc = e.frame(Uc),
  Yc = e.frame(jc),
  Zc = e.frame(Ec),
  $c = e.frame(Lc),
  _c = e.frame(Wc),
  er = e.frame(zc),
  dr = {
    preencode(d, o) {
      const n =
        (o.restoreIdentity ? 1 : 0) |
        (o.createRoom ? 2 : 0) |
        (o.leaveRoom ? 4 : 0) |
        (o.clearRoom ? 8 : 0) |
        (o.joinRoomInvitation ? 16 : 0) |
        (o.joinRoomKeys ? 32 : 0) |
        (o.joinRoomResponse ? 64 : 0) |
        (o.sendContactRequest ? 128 : 0) |
        (o.migrateV2Room ? 256 : 0)
      ;(e.fixed32.preencode(d, o.discoveryKey),
        e.uint.preencode(d, o.priority),
        e.uint.preencode(d, o.timestamp),
        e.uint.preencode(d, o.type),
        e.uint.preencode(d, n),
        o.restoreIdentity && Hc.preencode(d, o.restoreIdentity),
        o.createRoom && Gc.preencode(d, o.createRoom),
        o.leaveRoom && Qc.preencode(d, o.leaveRoom),
        o.clearRoom && Xc.preencode(d, o.clearRoom),
        o.joinRoomInvitation && Yc.preencode(d, o.joinRoomInvitation),
        o.joinRoomKeys && Zc.preencode(d, o.joinRoomKeys),
        o.joinRoomResponse && $c.preencode(d, o.joinRoomResponse),
        o.sendContactRequest && _c.preencode(d, o.sendContactRequest),
        o.migrateV2Room && er.preencode(d, o.migrateV2Room))
    },
    encode(d, o) {
      const n =
        (o.restoreIdentity ? 1 : 0) |
        (o.createRoom ? 2 : 0) |
        (o.leaveRoom ? 4 : 0) |
        (o.clearRoom ? 8 : 0) |
        (o.joinRoomInvitation ? 16 : 0) |
        (o.joinRoomKeys ? 32 : 0) |
        (o.joinRoomResponse ? 64 : 0) |
        (o.sendContactRequest ? 128 : 0) |
        (o.migrateV2Room ? 256 : 0)
      ;(e.fixed32.encode(d, o.discoveryKey),
        e.uint.encode(d, o.priority),
        e.uint.encode(d, o.timestamp),
        e.uint.encode(d, o.type),
        e.uint.encode(d, n),
        o.restoreIdentity && Hc.encode(d, o.restoreIdentity),
        o.createRoom && Gc.encode(d, o.createRoom),
        o.leaveRoom && Qc.encode(d, o.leaveRoom),
        o.clearRoom && Xc.encode(d, o.clearRoom),
        o.joinRoomInvitation && Yc.encode(d, o.joinRoomInvitation),
        o.joinRoomKeys && Zc.encode(d, o.joinRoomKeys),
        o.joinRoomResponse && $c.encode(d, o.joinRoomResponse),
        o.sendContactRequest && _c.encode(d, o.sendContactRequest),
        o.migrateV2Room && er.encode(d, o.migrateV2Room))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d),
        c = e.uint.decode(d),
        r = e.uint.decode(d),
        t = e.uint.decode(d)
      return {
        discoveryKey: o,
        priority: n,
        timestamp: c,
        type: r,
        restoreIdentity: 1 & t ? Hc.decode(d) : null,
        createRoom: 2 & t ? Gc.decode(d) : null,
        leaveRoom: 4 & t ? Qc.decode(d) : null,
        clearRoom: 8 & t ? Xc.decode(d) : null,
        joinRoomInvitation: 16 & t ? Yc.decode(d) : null,
        joinRoomKeys: 32 & t ? Zc.decode(d) : null,
        joinRoomResponse: 64 & t ? $c.decode(d) : null,
        sendContactRequest: 128 & t ? _c.decode(d) : null,
        migrateV2Room: 256 & t ? er.decode(d) : null,
      }
    },
  },
  or = Be,
  nr = {
    preencode(d, o) {
      ;(e.buffer.preencode(d, o.seed), or.preencode(d, o.invitation))
    },
    encode(d, o) {
      ;(e.buffer.encode(d, o.seed), or.encode(d, o.invitation))
    },
    decode: (d) => ({ seed: e.buffer.decode(d), invitation: or.decode(d) }),
  },
  cr = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const c =
        (n.isWritable ? 1 : 0) |
        (n.isReadable ? 2 : 0) |
        (n.isPrivateProfile ? 4 : 0) |
        (o >= 8 && n.isRemoved ? 8 : 0)
      e.uint.encode(d, c)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        isWritable: !!(1 & n),
        isReadable: !!(2 & n),
        isPrivateProfile: !!(4 & n),
        isRemoved: o >= 8 && !!(8 & n),
      }
    },
  },
  rr = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.creation),
        e.uint.preencode(d, o.latestSync),
        e.uint.preencode(d, o.latestChatMessage))
    },
    encode(d, o) {
      ;(e.uint.encode(d, o.creation),
        e.uint.encode(d, o.latestSync),
        e.uint.encode(d, o.latestChatMessage))
    },
    decode: (d) => ({
      creation: e.uint.decode(d),
      latestSync: e.uint.decode(d),
      latestChatMessage: e.uint.decode(d),
    }),
  },
  tr = Yo,
  ir = mo,
  ar = e.frame(rr),
  sr = kc,
  pr = e.frame(cr),
  lr = e.frame(ae),
  ur = e.frame(fd),
  fr = Jo,
  mr = _o,
  yr = e.frame(wo),
  xr = Y,
  br = e.frame(pd),
  vr = Cn,
  kr = {
    preencode(d, n) {
      const c =
        (n.selfDevice ? 1 : 0) |
        (n.selfMember ? 2 : 0) |
        (n.config ? 4 : 0) |
        (n.identity ? 8 : 0) |
        (n.lastMessage ? 16 : 0) |
        (n.dm ? 32 : 0) |
        (o >= 19 && n.readLengths ? 64 : 0) |
        (o >= 19 && n.lastMember ? 128 : 0) |
        (o >= 21 && n.version ? 256 : 0) |
        (o >= 27 && n.preferences ? 512 : 0)
      ;(e.fixed32.preencode(d, n.roomKey),
        e.fixed32.preencode(d, n.discoveryKey),
        e.buffer.preencode(d, n.encryptionKey),
        tr.preencode(d, n.digest),
        ir.preencode(d, n.stats),
        ar.preencode(d, n.timestamps),
        e.uint.preencode(d, n.fork),
        e.uint.preencode(d, n.length),
        e.fixed32.preencode(d, n.seed),
        sr.preencode(d, n.capabilities),
        pr.preencode(d, n.status),
        e.uint.preencode(d, c),
        n.selfDevice && lr.preencode(d, n.selfDevice),
        n.selfMember && ur.preencode(d, n.selfMember),
        n.config && fr.preencode(d, n.config),
        n.identity && mr.preencode(d, n.identity),
        n.lastMessage && yr.preencode(d, n.lastMessage),
        n.dm && xr.preencode(d, n.dm),
        o >= 19 && n.readLengths && Ja.preencode(d, n.readLengths),
        o >= 19 && n.lastMember && br.preencode(d, n.lastMember),
        o >= 21 && n.version && e.uint.preencode(d, n.version),
        o >= 27 && n.preferences && vr.preencode(d, n.preferences))
    },
    encode(d, n) {
      const c =
        (n.selfDevice ? 1 : 0) |
        (n.selfMember ? 2 : 0) |
        (n.config ? 4 : 0) |
        (n.identity ? 8 : 0) |
        (n.lastMessage ? 16 : 0) |
        (n.dm ? 32 : 0) |
        (o >= 19 && n.readLengths ? 64 : 0) |
        (o >= 19 && n.lastMember ? 128 : 0) |
        (o >= 21 && n.version ? 256 : 0) |
        (o >= 27 && n.preferences ? 512 : 0)
      ;(e.fixed32.encode(d, n.roomKey),
        e.fixed32.encode(d, n.discoveryKey),
        e.buffer.encode(d, n.encryptionKey),
        tr.encode(d, n.digest),
        ir.encode(d, n.stats),
        ar.encode(d, n.timestamps),
        e.uint.encode(d, n.fork),
        e.uint.encode(d, n.length),
        e.fixed32.encode(d, n.seed),
        sr.encode(d, n.capabilities),
        pr.encode(d, n.status),
        e.uint.encode(d, c),
        n.selfDevice && lr.encode(d, n.selfDevice),
        n.selfMember && ur.encode(d, n.selfMember),
        n.config && fr.encode(d, n.config),
        n.identity && mr.encode(d, n.identity),
        n.lastMessage && yr.encode(d, n.lastMessage),
        n.dm && xr.encode(d, n.dm),
        o >= 19 && n.readLengths && Ja.encode(d, n.readLengths),
        o >= 19 && n.lastMember && br.encode(d, n.lastMember),
        o >= 21 && n.version && e.uint.encode(d, n.version),
        o >= 27 && n.preferences && vr.encode(d, n.preferences))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.fixed32.decode(d),
        r = e.buffer.decode(d),
        t = tr.decode(d),
        i = ir.decode(d),
        a = ar.decode(d),
        s = e.uint.decode(d),
        p = e.uint.decode(d),
        l = e.fixed32.decode(d),
        u = sr.decode(d),
        f = pr.decode(d),
        m = e.uint.decode(d)
      return {
        roomKey: n,
        discoveryKey: c,
        encryptionKey: r,
        digest: t,
        stats: i,
        timestamps: a,
        fork: s,
        length: p,
        seed: l,
        capabilities: u,
        status: f,
        selfDevice: 1 & m ? lr.decode(d) : null,
        selfMember: 2 & m ? ur.decode(d) : null,
        config: 4 & m ? fr.decode(d) : null,
        identity: 8 & m ? mr.decode(d) : null,
        lastMessage: 16 & m ? yr.decode(d) : null,
        dm: 32 & m ? xr.decode(d) : null,
        readLengths: o >= 19 && 64 & m ? Ja.decode(d) : null,
        lastMember: o >= 19 && 128 & m ? br.decode(d) : null,
        version: o >= 21 && 256 & m ? e.uint.decode(d) : 0,
        preferences: o >= 27 && 512 & m ? vr.decode(d) : null,
      }
    },
  },
  gr = Cn,
  Kr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), gr.preencode(d, o.status))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), gr.encode(d, o.status))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), status: gr.decode(d) }),
  },
  hr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.mailbox),
        e.fixed32.preencode(d, o.key),
        d.end++,
        o.roomKey && e.fixed32.preencode(d, o.roomKey),
        o.keyPair && t.preencode(d, o.keyPair),
        o.responseKeyPair && t.preencode(d, o.responseKeyPair))
    },
    encode(d, o) {
      const n = (o.roomKey ? 1 : 0) | (o.keyPair ? 2 : 0) | (o.responseKeyPair ? 4 : 0)
      ;(e.fixed32.encode(d, o.mailbox),
        e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.roomKey && e.fixed32.encode(d, o.roomKey),
        o.keyPair && t.encode(d, o.keyPair),
        o.responseKeyPair && t.encode(d, o.responseKeyPair))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        mailbox: o,
        key: n,
        roomKey: 1 & c ? e.fixed32.decode(d) : null,
        keyPair: 2 & c ? t.decode(d) : null,
        responseKeyPair: 4 & c ? t.decode(d) : null,
      }
    },
  },
  wr = le,
  Rr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), wr.preencode(d, o.profile))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), wr.encode(d, o.profile))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), profile: wr.decode(d) }),
  },
  Pr = lr,
  Tr = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), Pr.preencode(d, o.device))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), Pr.encode(d, o.device))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), device: Pr.decode(d) }),
  },
  Mr = K,
  Ar = {
    preencode(d, o) {
      ;(Mr.preencode(d, o.file),
        e.fixed32.preencode(d, o.roomKey),
        d.end++,
        o.encryptionKey && e.buffer.preencode(d, o.encryptionKey))
    },
    encode(d, o) {
      const n = (o.encryptionKey ? 1 : 0) | (o.cleared ? 2 : 0) | (o.own ? 4 : 0)
      ;(Mr.encode(d, o.file),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, n),
        o.encryptionKey && e.buffer.encode(d, o.encryptionKey))
    },
    decode(d) {
      const o = Mr.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        file: o,
        roomKey: n,
        encryptionKey: 1 & c ? e.buffer.decode(d) : null,
        cleared: !!(2 & c),
        own: !!(4 & c),
      }
    },
  },
  Dr = _,
  Sr = {
    preencode(d, n) {
      ;(Dr.preencode(d, n.header),
        c.preencode(d, n.oplog),
        e.uint.preencode(d, n.index),
        Wa.preencode(d, n.preview),
        d.end++,
        o >= 12 && n.displayType && Qr.preencode(d, n.displayType))
    },
    encode(d, n) {
      const r = o >= 12 && n.displayType ? 1 : 0
      ;(Dr.encode(d, n.header),
        c.encode(d, n.oplog),
        e.uint.encode(d, n.index),
        Wa.encode(d, n.preview),
        e.uint.encode(d, r),
        o >= 12 && n.displayType && Qr.encode(d, n.displayType))
    },
    decode(d) {
      const n = Dr.decode(d),
        r = c.decode(d),
        t = e.uint.decode(d),
        i = Wa.decode(d),
        a = d.start < d.end ? e.uint.decode(d) : 0
      return {
        header: n,
        oplog: r,
        index: t,
        preview: i,
        displayType: o >= 12 && 1 & a ? Qr.decode(d) : 0,
      }
    },
  },
  Cr = {
    preencode(d, n) {
      ;(d.end++, o >= 4 && n.memberKey && e.fixed32.preencode(d, n.memberKey))
    },
    encode(d, n) {
      const c = o >= 4 && n.memberKey ? 1 : 0
      ;(e.uint.encode(d, c), o >= 4 && n.memberKey && e.fixed32.encode(d, n.memberKey))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { memberKey: o >= 4 && 1 & n ? e.fixed32.decode(d) : null }
    },
  },
  Ir = le,
  jr = {
    preencode(e, d) {
      ;(Ir.preencode(e, d.profile), ce.preencode(e, d.attestation))
    },
    encode(e, d) {
      ;(Ir.encode(e, d.profile), ce.encode(e, d.attestation))
    },
    decode: (e) => ({ profile: Ir.decode(e), attestation: ce.decode(e) }),
  },
  Lr = _,
  Fr = {
    preencode(d, o) {
      ;(Lr.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(Lr.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: Lr.decode(d), key: e.fixed32.decode(d) }),
  },
  qr = {
    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),
    }),
  },
  Br = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.roomKey),
        e.fixed32.preencode(d, n.encryptionKey),
        e.fixed32.preencode(d, n.seed),
        d.end++,
        o >= 9 && n.fastForwardTo && e.fixed32.preencode(d, n.fastForwardTo))
    },
    encode(d, n) {
      const c = o >= 9 && 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 >= 9 && 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 >= 9 && 1 & t ? e.fixed32.decode(d) : null,
      }
    },
  },
  Er = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.publicKey),
        e.fixed32.preencode(d, n.writerKey),
        e.fixed32.preencode(d, n.devicePublicKey),
        d.end++,
        o >= 9 && n.privateProfileKey && e.fixed32.preencode(d, n.privateProfileKey))
    },
    encode(d, n) {
      const c = o >= 9 && 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 >= 9 && 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 >= 9 && 1 & t ? e.fixed32.decode(d) : null,
      }
    },
  },
  Vr = _,
  Nr = {
    preencode(d, o) {
      ;(Vr.preencode(d, o.header), e.fixed32.preencode(d, o.memberKey))
    },
    encode(d, o) {
      ;(Vr.encode(d, o.header), e.fixed32.encode(d, o.memberKey))
    },
    decode: (d) => ({ header: Vr.decode(d), memberKey: e.fixed32.decode(d) }),
  },
  Or = {
    preencode(d, o) {
      e.fixed32.preencode(d, o.privateProfileKey)
    },
    encode(d, o) {
      e.fixed32.encode(d, o.privateProfileKey)
    },
    decode: (d) => ({ privateProfileKey: e.fixed32.decode(d) }),
  },
  Ur = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key), e.fixed32.preencode(d, o.responsePublicKey))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.key), e.fixed32.encode(d, o.responsePublicKey))
    },
    decode: (d) => ({ key: e.fixed32.decode(d), responsePublicKey: e.fixed32.decode(d) }),
  },
  Jr = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.roomKey),
        d.end++,
        o >= 10 && n.repairs && e.uint.preencode(d, n.repairs))
    },
    encode(d, n) {
      const c = o >= 10 && n.repairs ? 1 : 0
      ;(e.fixed32.encode(d, n.roomKey),
        e.uint.encode(d, c),
        o >= 10 && n.repairs && e.uint.encode(d, n.repairs))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return { roomKey: n, repairs: o >= 10 && 1 & c ? e.uint.decode(d) : 0 }
    },
  },
  Wr = {
    preencode(d, n) {
      ;(d.end++,
        o >= 11 && n.key && e.string.preencode(d, n.key),
        o >= 11 && n.description && e.string.preencode(d, n.description))
    },
    encode(d, n) {
      const c =
        (o >= 11 && n.key ? 1 : 0) |
        (o >= 11 && n.value ? 2 : 0) |
        (o >= 11 && n.description ? 4 : 0)
      ;(e.uint.encode(d, c),
        o >= 11 && n.key && e.string.encode(d, n.key),
        o >= 11 && n.description && e.string.encode(d, n.description))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        key: o >= 11 && 1 & n ? e.string.decode(d) : null,
        value: o >= 11 && !!(2 & n),
        description: o >= 11 && 4 & n ? e.string.decode(d) : null,
      }
    },
  },
  zr = e.array(e.frame(Wr)),
  Hr = {
    preencode(e, d) {
      ;(e.end++, o >= 11 && d.flags && zr.preencode(e, d.flags))
    },
    encode(d, n) {
      const c = o >= 11 && n.flags ? 1 : 0
      ;(e.uint.encode(d, c), o >= 11 && n.flags && zr.encode(d, n.flags))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { flags: o >= 11 && 1 & n ? zr.decode(d) : null }
    },
  },
  Gr = { HttpLink: 1, PearLink: 2 },
  Qr = {
    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),
  },
  Xr = _,
  Yr = {
    preencode(d, o) {
      ;(Xr.preencode(d, o.header), e.uint.preencode(d, o.value))
    },
    encode(d, o) {
      ;(Xr.encode(d, o.header), e.uint.encode(d, o.value))
    },
    decode: (d) => ({ header: Xr.decode(d), value: e.uint.decode(d) }),
  },
  Zr = {
    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) }),
  },
  $r = _,
  _r = {
    preencode(d, o) {
      ;($r.preencode(d, o.header), e.uint.preencode(d, o.from), e.uint.preencode(d, o.to))
    },
    encode(d, o) {
      ;($r.encode(d, o.header), e.uint.encode(d, o.from), e.uint.encode(d, o.to))
    },
    decode: (d) => ({ header: $r.decode(d), from: e.uint.decode(d), to: e.uint.decode(d) }),
  },
  et = {
    RoomType: 1,
    IsExperimental: 2,
    IsJoiningDisabled: 3,
    IsAppendingDisabled: 4,
    IsCallingDisabled: 5,
    IsMembershipEventsDisabled: 6,
  },
  dt = {
    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),
  },
  ot = Ge,
  nt = {
    preencode(d, n) {
      ;(d.end++,
        o >= 16 && n.nodes && ot.preencode(d, n.nodes),
        o >= 24 && n.concurrency && e.uint.preencode(d, n.concurrency),
        o >= 24 && n.maxWindow && e.uint.preencode(d, n.maxWindow),
        o >= 24 && n.randomPunchInterval && e.uint.preencode(d, n.randomPunchInterval),
        o >= 24 && n.connectionKeepAlive && e.uint.preencode(d, n.connectionKeepAlive))
    },
    encode(d, n) {
      const c =
        (o >= 16 && n.nodes ? 1 : 0) |
        (o >= 24 && n.concurrency ? 2 : 0) |
        (o >= 24 && n.maxWindow ? 4 : 0) |
        (o >= 24 && n.randomPunchInterval ? 8 : 0) |
        (o >= 24 && n.connectionKeepAlive ? 16 : 0)
      ;(e.uint.encode(d, c),
        o >= 16 && n.nodes && ot.encode(d, n.nodes),
        o >= 24 && n.concurrency && e.uint.encode(d, n.concurrency),
        o >= 24 && n.maxWindow && e.uint.encode(d, n.maxWindow),
        o >= 24 && n.randomPunchInterval && e.uint.encode(d, n.randomPunchInterval),
        o >= 24 && n.connectionKeepAlive && e.uint.encode(d, n.connectionKeepAlive))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        nodes: o >= 16 && 1 & n ? ot.decode(d) : null,
        concurrency: o >= 24 && 2 & n ? e.uint.decode(d) : 0,
        maxWindow: o >= 24 && 4 & n ? e.uint.decode(d) : 0,
        randomPunchInterval: o >= 24 && 8 & n ? e.uint.decode(d) : 0,
        connectionKeepAlive: o >= 24 && 16 & n ? e.uint.decode(d) : 0,
      }
    },
  },
  ct = { en: "en", it: "it", ru: "ru", es: "es", de: "de" },
  rt = {
    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
      }
    },
  },
  tt = Fd,
  it = {
    preencode(d, o) {
      ;(tt.preencode(d, o.range), rt.preencode(d, o.language), e.string.preencode(d, o.text))
    },
    encode(d, o) {
      ;(tt.encode(d, o.range), rt.encode(d, o.language), e.string.encode(d, o.text))
    },
    decode: (d) => ({ range: tt.decode(d), language: rt.decode(d), text: e.string.decode(d) }),
  },
  at = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), count: e.uint.decode(d) }),
  },
  st = {
    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) }),
  },
  pt = _,
  lt = {
    preencode(d, o) {
      ;(pt.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(pt.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: pt.decode(d), key: e.fixed32.decode(d) }),
  },
  ut = _,
  ft = {
    preencode(d, o) {
      ;(ut.preencode(d, o.header), e.fixed32.preencode(d, o.key))
    },
    encode(d, o) {
      ;(ut.encode(d, o.header), e.fixed32.encode(d, o.key))
    },
    decode: (d) => ({ header: ut.decode(d), key: e.fixed32.decode(d) }),
  },
  mt = { Flag: 1 },
  yt = {
    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),
  },
  xt = {
    preencode(d, o) {
      ;(fo.preencode(d, o.id),
        e.fixed32.preencode(d, o.sender),
        e.uint.preencode(d, o.clock),
        yt.preencode(d, o.label))
    },
    encode(d, o) {
      ;(fo.encode(d, o.id),
        e.fixed32.encode(d, o.sender),
        e.uint.encode(d, o.clock),
        yt.encode(d, o.label))
    },
    decode: (d) => ({
      id: fo.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: yt.decode(d),
    }),
  },
  bt = _,
  vt = {
    preencode(e, d) {
      ;(bt.preencode(e, d.header), c.preencode(e, d.oplog), yt.preencode(e, d.label))
    },
    encode(e, d) {
      ;(bt.encode(e, d.header), c.encode(e, d.oplog), yt.encode(e, d.label))
    },
    decode: (e) => ({ header: bt.decode(e), oplog: c.decode(e), label: yt.decode(e) }),
  },
  kt = _,
  gt = {
    preencode(e, d) {
      ;(kt.preencode(e, d.header), c.preencode(e, d.oplog), yt.preencode(e, d.label))
    },
    encode(e, d) {
      ;(kt.encode(e, d.header), c.encode(e, d.oplog), yt.encode(e, d.label))
    },
    decode: (e) => ({ header: kt.decode(e), oplog: c.decode(e), label: yt.decode(e) }),
  },
  Kt = {
    preencode(d, o) {
      ;(yt.preencode(d, o.label), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(yt.encode(d, o.label), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ label: yt.decode(d), count: e.uint.decode(d) }),
  },
  ht = e.array(e.frame(Kt)),
  wt = {
    preencode(d, n) {
      ;(fo.preencode(d, n.id),
        e.uint.preencode(d, n.total),
        ht.preencode(d, n.labels),
        e.uint.preencode(d, n.editedAt),
        d.end++,
        o >= 24 && n.flagsClock && e.uint.preencode(d, n.flagsClock),
        o >= 24 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const c =
        (o >= 24 && n.flagsClock ? 1 : 0) |
        (o >= 24 && n.version ? 2 : 0) |
        (o >= 25 && n.isDeleted ? 4 : 0)
      ;(fo.encode(d, n.id),
        e.uint.encode(d, n.total),
        ht.encode(d, n.labels),
        e.uint.encode(d, n.editedAt),
        e.uint.encode(d, c),
        o >= 24 && n.flagsClock && e.uint.encode(d, n.flagsClock),
        o >= 24 && n.version && e.uint.encode(d, n.version))
    },
    decode(d) {
      const n = fo.decode(d),
        c = e.uint.decode(d),
        r = ht.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 >= 24 && 1 & i ? e.uint.decode(d) : 0,
        version: o >= 24 && 2 & i ? e.uint.decode(d) : 0,
        isDeleted: o >= 25 && !!(4 & i),
      }
    },
  },
  Rt = _,
  Pt = {
    preencode(d, o) {
      ;(Rt.preencode(d, o.header), e.uint.preencode(d, o.length))
    },
    encode(d, o) {
      ;(Rt.encode(d, o.header), e.uint.encode(d, o.length))
    },
    decode: (d) => ({ header: Rt.decode(d), length: e.uint.decode(d) }),
  },
  Tt = {
    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) }),
  },
  Mt = $,
  At = {
    preencode(e, d) {
      e.end++
    },
    encode(d, n) {
      const c = o >= 19 && n.disableReadReceipts ? 1 : 0
      e.uint.encode(d, c)
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { disableReadReceipts: o >= 19 && !!(1 & n) }
    },
  },
  Dt = { disableReadReceipts: "disableReadReceipts" },
  St = {
    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),
  },
  Ct = _,
  It = e.frame(At),
  jt = {
    preencode(e, d) {
      ;(Ct.preencode(e, d.header), St.preencode(e, d.key), It.preencode(e, d.settings))
    },
    encode(e, d) {
      ;(Ct.encode(e, d.header), St.encode(e, d.key), It.encode(e, d.settings))
    },
    decode: (e) => ({ header: Ct.decode(e), key: St.decode(e), settings: It.decode(e) }),
  },
  Lt = {
    preencode(d, n) {
      ;(d.end++,
        o >= 20 && n.roomKey && e.fixed32.preencode(d, n.roomKey),
        o >= 23 && n.coreKey && e.fixed32.preencode(d, n.coreKey))
    },
    encode(d, n) {
      const c = (o >= 20 && n.roomKey ? 1 : 0) | (o >= 23 && n.coreKey ? 2 : 0)
      ;(e.uint.encode(d, c),
        o >= 20 && n.roomKey && e.fixed32.encode(d, n.roomKey),
        o >= 23 && n.coreKey && e.fixed32.encode(d, n.coreKey))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return {
        roomKey: o >= 20 && 1 & n ? e.fixed32.decode(d) : null,
        coreKey: o >= 23 && 2 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  Ft = e.frame(Lt),
  qt = {
    preencode(d, n) {
      ;(e.string.preencode(d, n.code),
        e.string.preencode(d, n.message),
        e.string.preencode(d, n.stack),
        e.uint.preencode(d, n.timestamp),
        d.end++,
        o >= 20 && n.details && Ft.preencode(d, n.details))
    },
    encode(d, n) {
      const c = o >= 20 && n.details ? 1 : 0
      ;(e.string.encode(d, n.code),
        e.string.encode(d, n.message),
        e.string.encode(d, n.stack),
        e.uint.encode(d, n.timestamp),
        e.uint.encode(d, c),
        o >= 20 && n.details && Ft.encode(d, n.details))
    },
    decode(d) {
      const n = e.string.decode(d),
        c = e.string.decode(d),
        r = e.string.decode(d),
        t = e.uint.decode(d),
        i = e.uint.decode(d)
      return {
        code: n,
        message: c,
        stack: r,
        timestamp: t,
        details: o >= 20 && 1 & i ? Ft.decode(d) : null,
      }
    },
  },
  Bt = { RESUME: 1, WAKEUP: 2, PRESUSPEND: 3, SUSPEND: 4 },
  Et = {
    preencode(e, d) {
      e.end++
    },
    encode(d, o) {
      if (o > 4) throw new Error("Unknown enum")
      e.uint.encode(d, o)
    },
    decode: (d) => e.uint.decode(d),
  },
  Vt = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), e.uint.preencode(d, o.total))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), e.uint.encode(d, o.total))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), total: e.uint.decode(d) }),
  },
  Nt = { Flag: 1 },
  Ot = {
    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),
  },
  Ut = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.fixed32.preencode(d, o.sender),
        e.uint.preencode(d, o.clock),
        Ot.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),
        Ot.encode(d, o.label))
    },
    decode: (d) => ({
      key: e.fixed32.decode(d),
      sender: e.fixed32.decode(d),
      clock: e.uint.decode(d),
      label: Ot.decode(d),
    }),
  },
  Jt = _,
  Wt = {
    preencode(d, o) {
      ;(Jt.preencode(d, o.header), e.fixed32.preencode(d, o.key), Ot.preencode(d, o.label))
    },
    encode(d, o) {
      ;(Jt.encode(d, o.header), e.fixed32.encode(d, o.key), Ot.encode(d, o.label))
    },
    decode: (d) => ({ header: Jt.decode(d), key: e.fixed32.decode(d), label: Ot.decode(d) }),
  },
  zt = {
    preencode(d, o) {
      ;(Ot.preencode(d, o.label), e.uint.preencode(d, o.count))
    },
    encode(d, o) {
      ;(Ot.encode(d, o.label), e.uint.encode(d, o.count))
    },
    decode: (d) => ({ label: Ot.decode(d), count: e.uint.decode(d) }),
  },
  Ht = e.array(e.frame(zt)),
  Gt = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        e.uint.preencode(d, o.total),
        Ht.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),
        Ht.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: Ht.decode(d),
      editedAt: e.uint.decode(d),
      flagsClock: e.uint.decode(d),
    }),
  },
  Qt = {
    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) }),
  },
  Xt = _,
  Yt = {
    preencode(d, o) {
      ;(Xt.preencode(d, o.header),
        e.fixed32.preencode(d, o.deviceKey),
        e.fixed32.preencode(d, o.fromDeviceKey))
    },
    encode(d, o) {
      ;(Xt.encode(d, o.header),
        e.fixed32.encode(d, o.deviceKey),
        e.fixed32.encode(d, o.fromDeviceKey))
    },
    decode: (d) => ({
      header: Xt.decode(d),
      deviceKey: e.fixed32.decode(d),
      fromDeviceKey: e.fixed32.decode(d),
    }),
  },
  Zt = _,
  $t = Y,
  _t = {
    preencode(d, n) {
      ;(Zt.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        e.buffer.preencode(d, n.encryptionKey),
        d.end++,
        o >= 28 && n.streams && $t.preencode(d, n.streams),
        o >= 28 && n.discoveryKey && e.fixed32.preencode(d, n.discoveryKey),
        o >= 28 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const c =
        (o >= 28 && n.streams ? 1 : 0) |
        (o >= 28 && n.discoveryKey ? 2 : 0) |
        (o >= 28 && n.version ? 4 : 0)
      ;(Zt.encode(d, n.header),
        e.fixed32.encode(d, n.callKey),
        e.buffer.encode(d, n.encryptionKey),
        e.uint.encode(d, c),
        o >= 28 && n.streams && $t.encode(d, n.streams),
        o >= 28 && n.discoveryKey && e.fixed32.encode(d, n.discoveryKey),
        o >= 28 && n.version && e.uint.encode(d, n.version))
    },
    decode(d) {
      const n = Zt.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 >= 28 && 1 & t ? $t.decode(d) : null,
        discoveryKey: o >= 28 && 2 & t ? e.fixed32.decode(d) : null,
        version: o >= 28 && 4 & t ? e.uint.decode(d) : 0,
      }
    },
  },
  ei = _,
  di = Y,
  oi = {
    preencode(d, n) {
      ;(ei.preencode(d, n.header),
        e.fixed32.preencode(d, n.callKey),
        d.end++,
        o >= 28 && n.streams && di.preencode(d, n.streams))
    },
    encode(d, n) {
      const c = o >= 28 && n.streams ? 1 : 0
      ;(ei.encode(d, n.header),
        e.fixed32.encode(d, n.callKey),
        e.uint.encode(d, c),
        o >= 28 && n.streams && di.encode(d, n.streams))
    },
    decode(d) {
      const n = ei.decode(d),
        c = e.fixed32.decode(d),
        r = e.uint.decode(d)
      return { header: n, callKey: c, streams: o >= 28 && 1 & r ? di.decode(d) : null }
    },
  },
  ni = _,
  ci = {
    preencode(d, o) {
      ;(ni.preencode(d, o.header), e.fixed32.preencode(d, o.callKey))
    },
    encode(d, o) {
      ;(ni.encode(d, o.header), e.fixed32.encode(d, o.callKey))
    },
    decode: (d) => ({ header: ni.decode(d), callKey: e.fixed32.decode(d) }),
  },
  ri = _,
  ti = {
    preencode(d, o) {
      ;(ri.preencode(d, o.header), e.fixed32.preencode(d, o.callKey))
    },
    encode(d, o) {
      ;(ri.encode(d, o.header), e.fixed32.encode(d, o.callKey))
    },
    decode: (d) => ({ header: ri.decode(d), callKey: e.fixed32.decode(d) }),
  },
  ii = _,
  ai = {
    preencode(d, o) {
      ;(ii.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.streamKey))
    },
    encode(d, o) {
      ;(ii.encode(d, o.header), e.fixed32.encode(d, o.callKey), e.fixed32.encode(d, o.streamKey))
    },
    decode: (d) => ({
      header: ii.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  si = _,
  pi = {
    preencode(d, o) {
      ;(si.preencode(d, o.header),
        e.fixed32.preencode(d, o.callKey),
        e.fixed32.preencode(d, o.streamKey))
    },
    encode(d, o) {
      ;(si.encode(d, o.header), e.fixed32.encode(d, o.callKey), e.fixed32.encode(d, o.streamKey))
    },
    decode: (d) => ({
      header: si.decode(d),
      callKey: e.fixed32.decode(d),
      streamKey: e.fixed32.decode(d),
    }),
  },
  li = {
    preencode(d, n) {
      ;(e.fixed32.preencode(d, n.callKey),
        e.buffer.preencode(d, n.encryptionKey),
        e.uint.preencode(d, n.createdAt),
        d.end++,
        o >= 28 && n.endedAt && e.uint.preencode(d, n.endedAt),
        o >= 28 && n.discoveryKey && e.fixed32.preencode(d, n.discoveryKey),
        o >= 28 && n.version && e.uint.preencode(d, n.version))
    },
    encode(d, n) {
      const c =
        (o >= 28 && n.endedAt ? 1 : 0) |
        (o >= 28 && n.discoveryKey ? 2 : 0) |
        (o >= 28 && 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 >= 28 && n.endedAt && e.uint.encode(d, n.endedAt),
        o >= 28 && n.discoveryKey && e.fixed32.encode(d, n.discoveryKey),
        o >= 28 && 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 >= 28 && 1 & t ? e.uint.decode(d) : 0,
        discoveryKey: o >= 28 && 2 & t ? e.fixed32.decode(d) : null,
        version: o >= 28 && 4 & t ? e.uint.decode(d) : 0,
      }
    },
  },
  ui = {
    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),
    }),
  },
  fi = {
    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 >= 28 && n.swarmKey && e.fixed32.preencode(d, n.swarmKey))
    },
    encode(d, n) {
      const c = o >= 28 && 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 >= 28 && 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 >= 28 && 1 & i ? e.fixed32.decode(d) : null,
      }
    },
  },
  mi = {
    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),
    }),
  },
  yi = wc,
  xi = {
    preencode(d, n) {
      ;(e.uint.preencode(d, n.priority),
        d.end++,
        n.v3 && yi.preencode(d, n.v3),
        o >= 5 && n.timestamp && e.uint.preencode(d, n.timestamp))
    },
    encode(d, n) {
      const c = (n.v3 ? 1 : 0) | (o >= 3 && n.errored ? 2 : 0) | (o >= 5 && n.timestamp ? 4 : 0)
      ;(e.uint.encode(d, n.priority),
        e.uint.encode(d, c),
        n.v3 && yi.encode(d, n.v3),
        o >= 5 && n.timestamp && e.uint.encode(d, n.timestamp))
    },
    decode(d) {
      const n = e.uint.decode(d),
        c = e.uint.decode(d)
      return {
        roomKey: null,
        priority: n,
        v3: 1 & c ? yi.decode(d) : null,
        errored: o >= 3 && !!(2 & c),
        timestamp: o >= 5 && 4 & c ? e.uint.decode(d) : 0,
      }
    },
  },
  bi = Yo,
  vi = mo,
  ki = ar,
  gi = kc,
  Ki = pr,
  hi = lr,
  wi = ur,
  Ri = Jo,
  Pi = _o,
  Ti = yr,
  Mi = Y,
  Ai = br,
  Di = Cn,
  Si = {
    preencode(d, n) {
      const c =
        (n.selfDevice ? 1 : 0) |
        (n.selfMember ? 2 : 0) |
        (n.config ? 4 : 0) |
        (n.identity ? 8 : 0) |
        (n.lastMessage ? 16 : 0) |
        (n.dm ? 32 : 0) |
        (o >= 19 && n.readLengths ? 64 : 0) |
        (o >= 19 && n.lastMember ? 128 : 0) |
        (o >= 21 && n.version ? 256 : 0) |
        (o >= 27 && n.preferences ? 512 : 0)
      ;(e.fixed32.preencode(d, n.discoveryKey),
        e.buffer.preencode(d, n.encryptionKey),
        bi.preencode(d, n.digest),
        vi.preencode(d, n.stats),
        ki.preencode(d, n.timestamps),
        e.uint.preencode(d, n.fork),
        e.uint.preencode(d, n.length),
        e.fixed32.preencode(d, n.seed),
        gi.preencode(d, n.capabilities),
        Ki.preencode(d, n.status),
        e.uint.preencode(d, c),
        n.selfDevice && hi.preencode(d, n.selfDevice),
        n.selfMember && wi.preencode(d, n.selfMember),
        n.config && Ri.preencode(d, n.config),
        n.identity && Pi.preencode(d, n.identity),
        n.lastMessage && Ti.preencode(d, n.lastMessage),
        n.dm && Mi.preencode(d, n.dm),
        o >= 19 && n.readLengths && za.preencode(d, n.readLengths),
        o >= 19 && n.lastMember && Ai.preencode(d, n.lastMember),
        o >= 21 && n.version && e.uint.preencode(d, n.version),
        o >= 27 && n.preferences && Di.preencode(d, n.preferences))
    },
    encode(d, n) {
      const c =
        (n.selfDevice ? 1 : 0) |
        (n.selfMember ? 2 : 0) |
        (n.config ? 4 : 0) |
        (n.identity ? 8 : 0) |
        (n.lastMessage ? 16 : 0) |
        (n.dm ? 32 : 0) |
        (o >= 19 && n.readLengths ? 64 : 0) |
        (o >= 19 && n.lastMember ? 128 : 0) |
        (o >= 21 && n.version ? 256 : 0) |
        (o >= 27 && n.preferences ? 512 : 0)
      ;(e.fixed32.encode(d, n.discoveryKey),
        e.buffer.encode(d, n.encryptionKey),
        bi.encode(d, n.digest),
        vi.encode(d, n.stats),
        ki.encode(d, n.timestamps),
        e.uint.encode(d, n.fork),
        e.uint.encode(d, n.length),
        e.fixed32.encode(d, n.seed),
        gi.encode(d, n.capabilities),
        Ki.encode(d, n.status),
        e.uint.encode(d, c),
        n.selfDevice && hi.encode(d, n.selfDevice),
        n.selfMember && wi.encode(d, n.selfMember),
        n.config && Ri.encode(d, n.config),
        n.identity && Pi.encode(d, n.identity),
        n.lastMessage && Ti.encode(d, n.lastMessage),
        n.dm && Mi.encode(d, n.dm),
        o >= 19 && n.readLengths && za.encode(d, n.readLengths),
        o >= 19 && n.lastMember && Ai.encode(d, n.lastMember),
        o >= 21 && n.version && e.uint.encode(d, n.version),
        o >= 27 && n.preferences && Di.encode(d, n.preferences))
    },
    decode(d) {
      const n = e.fixed32.decode(d),
        c = e.buffer.decode(d),
        r = bi.decode(d),
        t = vi.decode(d),
        i = ki.decode(d),
        a = e.uint.decode(d),
        s = e.uint.decode(d),
        p = e.fixed32.decode(d),
        l = gi.decode(d),
        u = Ki.decode(d),
        f = e.uint.decode(d)
      return {
        roomKey: null,
        discoveryKey: n,
        encryptionKey: c,
        digest: r,
        stats: t,
        timestamps: i,
        fork: a,
        length: s,
        seed: p,
        capabilities: l,
        status: u,
        selfDevice: 1 & f ? hi.decode(d) : null,
        selfMember: 2 & f ? wi.decode(d) : null,
        config: 4 & f ? Ri.decode(d) : null,
        identity: 8 & f ? Pi.decode(d) : null,
        lastMessage: 16 & f ? Ti.decode(d) : null,
        dm: 32 & f ? Mi.decode(d) : null,
        readLengths: o >= 19 && 64 & f ? za.decode(d) : null,
        lastMember: o >= 19 && 128 & f ? Ai.decode(d) : null,
        version: o >= 21 && 256 & f ? e.uint.decode(d) : 0,
        preferences: o >= 27 && 512 & f ? Di.decode(d) : null,
      }
    },
  },
  Ci = Cn,
  Ii = {
    preencode(e, d) {
      Ci.preencode(e, d.status)
    },
    encode(e, d) {
      Ci.encode(e, d.status)
    },
    decode: (e) => ({ roomKey: null, status: Ci.decode(e) }),
  },
  ji = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.key),
        d.end++,
        o.roomKey && e.fixed32.preencode(d, o.roomKey),
        o.keyPair && t.preencode(d, o.keyPair),
        o.responseKeyPair && t.preencode(d, o.responseKeyPair))
    },
    encode(d, o) {
      const n = (o.roomKey ? 1 : 0) | (o.keyPair ? 2 : 0) | (o.responseKeyPair ? 4 : 0)
      ;(e.fixed32.encode(d, o.key),
        e.uint.encode(d, n),
        o.roomKey && e.fixed32.encode(d, o.roomKey),
        o.keyPair && t.encode(d, o.keyPair),
        o.responseKeyPair && t.encode(d, o.responseKeyPair))
    },
    decode(d) {
      const o = e.fixed32.decode(d),
        n = e.uint.decode(d)
      return {
        mailbox: null,
        key: o,
        roomKey: 1 & n ? e.fixed32.decode(d) : null,
        keyPair: 2 & n ? t.decode(d) : null,
        responseKeyPair: 4 & n ? t.decode(d) : null,
      }
    },
  },
  Li = le,
  Fi = {
    preencode(e, d) {
      Li.preencode(e, d.profile)
    },
    encode(e, d) {
      Li.encode(e, d.profile)
    },
    decode: (e) => ({ key: null, profile: Li.decode(e) }),
  },
  qi = te,
  Bi = ie,
  Ei = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.memberKey),
        qi.preencode(d, o.status),
        Ha.preencode(d, o.profile),
        d.end++,
        o.invitation && Bi.preencode(d, o.invitation))
    },
    encode(d, o) {
      const n = o.invitation ? 1 : 0
      ;(e.fixed32.encode(d, o.memberKey),
        qi.encode(d, o.status),
        Ha.encode(d, o.profile),
        e.uint.encode(d, n),
        o.invitation && Bi.encode(d, o.invitation))
    },
    decode: (d) => ({
      key: null,
      memberKey: e.fixed32.decode(d),
      status: qi.decode(d),
      profile: Ha.decode(d),
      invitation: 1 & e.uint.decode(d) ? Bi.decode(d) : null,
    }),
  },
  Vi = lr,
  Ni = {
    preencode(d, o) {
      ;(e.fixed32.preencode(d, o.roomKey), Vi.preencode(d, o.device))
    },
    encode(d, o) {
      ;(e.fixed32.encode(d, o.roomKey), Vi.encode(d, o.device))
    },
    decode: (d) => ({ roomKey: e.fixed32.decode(d), device: Vi.decode(d) }),
  },
  Oi = {
    preencode(d, o) {
      ;(Ga.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)
      ;(Ga.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 = Ga.decode(d),
        n = e.uint.decode(d)
      return {
        memberKey: null,
        status: o,
        mailbox: 1 & n ? e.fixed32.decode(d) : null,
        roomKey: 2 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  Ui = Hc,
  Ji = Gc,
  Wi = Qc,
  zi = Xc,
  Hi = Yc,
  Gi = Zc,
  Qi = $c,
  Xi = _c,
  Yi = er,
  Zi = {
    preencode(d, o) {
      const n =
        (o.restoreIdentity ? 1 : 0) |
        (o.createRoom ? 2 : 0) |
        (o.leaveRoom ? 4 : 0) |
        (o.clearRoom ? 8 : 0) |
        (o.joinRoomInvitation ? 16 : 0) |
        (o.joinRoomKeys ? 32 : 0) |
        (o.joinRoomResponse ? 64 : 0) |
        (o.sendContactRequest ? 128 : 0) |
        (o.migrateV2Room ? 256 : 0)
      ;(e.uint.preencode(d, n),
        o.restoreIdentity && Ui.preencode(d, o.restoreIdentity),
        o.createRoom && Ji.preencode(d, o.createRoom),
        o.leaveRoom && Wi.preencode(d, o.leaveRoom),
        o.clearRoom && zi.preencode(d, o.clearRoom),
        o.joinRoomInvitation && Hi.preencode(d, o.joinRoomInvitation),
        o.joinRoomKeys && Gi.preencode(d, o.joinRoomKeys),
        o.joinRoomResponse && Qi.preencode(d, o.joinRoomResponse),
        o.sendContactRequest && Xi.preencode(d, o.sendContactRequest),
        o.migrateV2Room && Yi.preencode(d, o.migrateV2Room))
    },
    encode(d, o) {
      const n =
        (o.restoreIdentity ? 1 : 0) |
        (o.createRoom ? 2 : 0) |
        (o.leaveRoom ? 4 : 0) |
        (o.clearRoom ? 8 : 0) |
        (o.joinRoomInvitation ? 16 : 0) |
        (o.joinRoomKeys ? 32 : 0) |
        (o.joinRoomResponse ? 64 : 0) |
        (o.sendContactRequest ? 128 : 0) |
        (o.migrateV2Room ? 256 : 0)
      ;(e.uint.encode(d, n),
        o.restoreIdentity && Ui.encode(d, o.restoreIdentity),
        o.createRoom && Ji.encode(d, o.createRoom),
        o.leaveRoom && Wi.encode(d, o.leaveRoom),
        o.clearRoom && zi.encode(d, o.clearRoom),
        o.joinRoomInvitation && Hi.encode(d, o.joinRoomInvitation),
        o.joinRoomKeys && Gi.encode(d, o.joinRoomKeys),
        o.joinRoomResponse && Qi.encode(d, o.joinRoomResponse),
        o.sendContactRequest && Xi.encode(d, o.sendContactRequest),
        o.migrateV2Room && Yi.encode(d, o.migrateV2Room))
    },
    decode(d) {
      const o = e.uint.decode(d)
      return {
        discoveryKey: null,
        priority: 0,
        timestamp: 0,
        type: 0,
        restoreIdentity: 1 & o ? Ui.decode(d) : null,
        createRoom: 2 & o ? Ji.decode(d) : null,
        leaveRoom: 4 & o ? Wi.decode(d) : null,
        clearRoom: 8 & o ? zi.decode(d) : null,
        joinRoomInvitation: 16 & o ? Hi.decode(d) : null,
        joinRoomKeys: 32 & o ? Gi.decode(d) : null,
        joinRoomResponse: 64 & o ? Qi.decode(d) : null,
        sendContactRequest: 128 & o ? Xi.decode(d) : null,
        migrateV2Room: 256 & o ? Yi.decode(d) : null,
      }
    },
  },
  $i = {
    preencode(d, o) {
      ;(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.blockLength),
        e.uint.encode(d, o.byteOffset),
        e.uint.encode(d, o.byteLength))
    },
    decode: (d) => ({
      blockOffset: 0,
      blockLength: e.uint.decode(d),
      byteOffset: e.uint.decode(d),
      byteLength: e.uint.decode(d),
    }),
  },
  _i = {
    preencode(e, d) {
      s.preencode(e, d.blob)
    },
    encode(e, d) {
      s.encode(e, d.blob)
    },
    decode: (e) => ({ key: null, blob: s.decode(e) }),
  },
  ea = y,
  da = x,
  oa = {
    preencode(d, o) {
      ;(d.end++,
        o.inlined && e.buffer.preencode(d, o.inlined),
        o.blob && s.preencode(d, o.blob),
        o.externalBlob && ea.preencode(d, o.externalBlob),
        o.externalDrive && da.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 && ea.encode(d, o.externalBlob),
        o.externalDrive && da.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 ? ea.decode(d) : null,
        externalDrive: 8 & o ? da.decode(d) : null,
      }
    },
  },
  na = v,
  ca = k,
  ra = {
    preencode(d, o) {
      ;(na.preencode(d, o.pointer),
        d.end++,
        o.metadata && ca.preencode(d, o.metadata),
        o.preview && Qa.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)
      ;(na.encode(d, o.pointer),
        e.uint.encode(d, n),
        o.metadata && ca.encode(d, o.metadata),
        o.preview && Qa.encode(d, o.preview),
        o.hash && e.fixed32.encode(d, o.hash))
    },
    decode(d) {
      const o = na.decode(d),
        n = e.uint.decode(d)
      return {
        pointer: o,
        metadata: 1 & n ? ca.decode(d) : null,
        preview: 2 & n ? Qa.decode(d) : null,
        hash: 4 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  ta = K,
  ia = {
    preencode(d, o) {
      ;(ta.preencode(d, o.file),
        e.fixed32.preencode(d, o.roomKey),
        d.end++,
        o.encryptionKey && e.buffer.preencode(d, o.encryptionKey))
    },
    encode(d, o) {
      const n = (o.encryptionKey ? 1 : 0) | (o.cleared ? 2 : 0) | (o.own ? 4 : 0)
      ;(ta.encode(d, o.file),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, n),
        o.encryptionKey && e.buffer.encode(d, o.encryptionKey))
    },
    decode(d) {
      const o = ta.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        file: o,
        roomKey: n,
        encryptionKey: 1 & c ? e.buffer.decode(d) : null,
        cleared: !!(2 & c),
        own: !!(4 & c),
      }
    },
  },
  aa = {
    preencode(d, o) {
      e.uint.preencode(d, o.size)
    },
    encode(d, o) {
      e.uint.encode(d, o.size)
    },
    decode: (d) => ({ key: null, path: null, version: 0, size: e.uint.decode(d) }),
  },
  sa = y,
  pa = x,
  la = {
    preencode(d, o) {
      ;(d.end++,
        o.inlined && e.buffer.preencode(d, o.inlined),
        o.blob && s.preencode(d, o.blob),
        o.externalBlob && sa.preencode(d, o.externalBlob),
        o.externalDrive && pa.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 && sa.encode(d, o.externalBlob),
        o.externalDrive && pa.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 ? sa.decode(d) : null,
        externalDrive: 8 & o ? pa.decode(d) : null,
      }
    },
  },
  ua = v,
  fa = k,
  ma = {
    preencode(d, o) {
      ;(ua.preencode(d, o.pointer),
        d.end++,
        o.metadata && fa.preencode(d, o.metadata),
        o.preview && Xa.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)
      ;(ua.encode(d, o.pointer),
        e.uint.encode(d, n),
        o.metadata && fa.encode(d, o.metadata),
        o.preview && Xa.encode(d, o.preview),
        o.hash && e.fixed32.encode(d, o.hash))
    },
    decode(d) {
      const o = ua.decode(d),
        n = e.uint.decode(d)
      return {
        pointer: o,
        metadata: 1 & n ? fa.decode(d) : null,
        preview: 2 & n ? Xa.decode(d) : null,
        hash: 4 & n ? e.fixed32.decode(d) : null,
      }
    },
  },
  ya = K,
  xa = {
    preencode(d, o) {
      ;(ya.preencode(d, o.file),
        e.fixed32.preencode(d, o.roomKey),
        d.end++,
        o.encryptionKey && e.buffer.preencode(d, o.encryptionKey))
    },
    encode(d, o) {
      const n = (o.encryptionKey ? 1 : 0) | (o.cleared ? 2 : 0) | (o.own ? 4 : 0)
      ;(ya.encode(d, o.file),
        e.fixed32.encode(d, o.roomKey),
        e.uint.encode(d, n),
        o.encryptionKey && e.buffer.encode(d, o.encryptionKey))
    },
    decode(d) {
      const o = ya.decode(d),
        n = e.fixed32.decode(d),
        c = e.uint.decode(d)
      return {
        file: o,
        roomKey: n,
        encryptionKey: 1 & c ? e.buffer.decode(d) : null,
        cleared: !!(2 & c),
        own: !!(4 & c),
      }
    },
  },
  ba = {
    preencode(d, o) {
      ;(e.uint.preencode(d, o.timestamp),
        d.end++,
        o.lastSynced && e.uint.preencode(d, o.lastSynced))
    },
    encode(d, o) {
      const n = (o.lastSynced ? 1 : 0) | (o.dirty ? 2 : 0)
      ;(e.uint.encode(d, o.timestamp),
        e.uint.encode(d, n),
        o.lastSynced && e.uint.encode(d, o.lastSynced))
    },
    decode(d) {
      const o = e.uint.decode(d),
        n = e.uint.decode(d)
      return {
        discoveryPublicKey: null,
        timestamp: o,
        lastSynced: 1 & n ? e.uint.decode(d) : 0,
        dirty: !!(2 & n),
      }
    },
  },
  va = {
    preencode(e, d) {},
    encode(e, d) {},
    decode: (e) => ({ key: null, responsePublicKey: null }),
  },
  ka = {
    preencode(d, n) {
      ;(d.end++, o >= 10 && n.repairs && e.uint.preencode(d, n.repairs))
    },
    encode(d, n) {
      const c = o >= 10 && n.repairs ? 1 : 0
      ;(e.uint.encode(d, c), o >= 10 && n.repairs && e.uint.encode(d, n.repairs))
    },
    decode(d) {
      const n = e.uint.decode(d)
      return { roomKey: null, repairs: o >= 10 && 1 & n ? e.uint.decode(d) : 0 }
    },
  },
  ga = {
    preencode(d, o) {
      e.uint.preencode(d, o.count)
    },
    encode(d, o) {
      e.uint.encode(d, o.count)
    },
    decode: (d) => ({ roomKey: null, count: e.uint.decode(d) }),
  },
  Ka = Ft,
  ha = {
    preencode(d, n) {
      ;(e.string.preencode(d, n.code),
        e.string.preencode(d, n.message),
        e.string.preencode(d, n.stack),
        d.end++,
        o >= 20 && n.details && Ka.preencode(d, n.details))
    },
    encode(d, n) {
      const c = o >= 20 && n.details ? 1 : 0
      ;(e.string.encode(d, n.code),
        e.string.encode(d, n.message),
        e.string.encode(d, n.stack),
        e.uint.encode(d, c),
        o >= 20 && n.details && Ka.encode(d, n.details))
    },
    decode(d) {
      const n = e.string.decode(d),
        c = e.string.decode(d),
        r = e.string.decode(d),
        t = e.uint.decode(d)
      return {
        code: n,
        message: c,
        stack: r,
        timestamp: 0,
        details: o >= 20 && 1 & t ? Ka.decode(d) : null,
      }
    },
  },
  wa = {
    preencode(d, o) {
      e.uint.preencode(d, o.total)
    },
    encode(d, o) {
      e.uint.encode(d, o.total)
    },
    decode: (d) => ({ roomKey: null, total: e.uint.decode(d) }),
  },
  Ra = e.frame(R),
  Pa = Ra,
  Ta = e.array(rt),
  Ma = e.frame(pe),
  Aa = Ra,
  Da = Ma,
  Sa = e.frame(Br),
  Ca = Ma,
  Ia = e.frame(md),
  ja = e.frame(Cr),
  La = e.frame(Qt),
  Fa = La,
  qa = e.array(e.frame(it)),
  Ba = Ra,
  Ea = e.frame(Un),
  Va = Ea,
  Na = Ea,
  Oa = e.frame(Er),
  Ua = e.frame(jr),
  Ja = e.array(e.frame(Tt)),
  Wa = Ra,
  za = Ja,
  Ha = Ma,
  Ga = Ea,
  Qa = Ra,
  Xa = Ra
function Ya(e) {
  o = e
}
function Za(d, n, c = 28) {
  return ((o = c), e.encode(es(d), n))
}
function $a(d, n, c = 28) {
  return ((o = c), e.decode(es(d), n))
}
function _a(e) {
  switch (e) {
    case "@keet/room-type":
      return U
    case "@local/tasks":
      return Dc
    case "@keet/display-type":
      return Gr
    case "@keet/system-settings-keys":
      return et
    case "@keet/room-supported-language":
      return ct
    case "@keet/label-type":
      return mt
    case "@keet-private-id/user-settings-key":
      return Dt
    case "@local/keet-state":
      return Bt
    case "@keet/member-label-type":
      return Nt
    default:
      throw new Error("Enum not found " + e)
  }
}
function es(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 u
    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 R
    case "@keet/file-status":
      return P
    case "@keet/file-record":
      return A
    case "@keet/device-status":
      return D
    case "@keet/member-status":
      return S
    case "@keet/member-moderation-status":
      return C
    case "@keet/abi":
      return I
    case "@keet/device-stats":
      return j
    case "@keet/member-stats":
      return L
    case "@keet/chat-stats":
      return F
    case "@keet/file-stats":
      return q
    case "@keet/stats":
      return O
    case "@keet/room-type":
      return J
    case "@keet/system-settings":
      return W
    case "@keet/system-digest":
      return G
    case "@keet/room-seed":
      return Q
    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 ue
    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 he
    case "@keet/device-request-with-member-proof":
      return Pe
    case "@keet/device-request":
      return Ae
    case "@keet/device-response":
      return Ce
    case "@keet/invitation-metadata":
      return Ie
    case "@keet/invitation":
      return Fe
    case "@keet/add-invitation-operation":
      return Ee
    case "@keet/remove-invitation-operation":
      return Ne
    case "@keet/sendable-room-invitation":
      return Oe
    case "@keet/sendable-identity-invitation":
      return Ue
    case "@keet/sendable-contact-invitation":
      return Je
    case "@keet/sendable-invitation":
      return Qe
    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 hd
    case "@keet/remove-member-operation":
      return Rd
    case "@keet/member-activity":
      return Pd
    case "@keet/member-joined-event":
      return Td
    case "@keet/member-left-event":
      return Md
    case "@keet/title-changed-chat-event":
      return Ad
    case "@keet/chat-event":
      return Id
    case "@keet/sendable-event":
      return jd
    case "@keet/display-range":
      return Ld
    case "@keet/display-content-range":
      return qd
    case "@keet/mention-display-item":
      return Ed
    case "@keet/link-preview":
      return Od
    case "@keet/display-link-item":
      return Wd
    case "@keet/display":
      return eo
    case "@keet/oplog-message":
      return ro
    case "@keet/index-message":
      return ao
    case "@keet/full-index-message":
      return lo
    case "@keet/message-status":
      return uo
    case "@keet/message-index-id":
      return fo
    case "@keet/thread":
      return yo
    case "@keet/chat-message-record":
      return ko
    case "@keet/full-chat-message-record":
      return wo
    case "@keet/add-chat-message-operation":
      return To
    case "@keet/remove-chat-message-operation":
      return Ao
    case "@keet/update-chat-message-operation":
      return Co
    case "@keet/pin-chat-message-operation":
      return jo
    case "@keet/reaction":
      return Lo
    case "@keet/reactions-summary":
      return Fo
    case "@keet/reactions-digest":
      return Bo
    case "@keet/add-reaction-operation":
      return Vo
    case "@keet/remove-reaction-operation":
      return Oo
    case "@keet/update-room-config-operation":
      return Wo
    case "@keet/group-member":
      return zo
    case "@keet/user-registry-info":
      return Ho
    case "@keet/room-identity":
      return Qo
    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 vn
    case "@keet-private-id/pending-invitation-identity":
      return kn
    case "@keet-private-id/pending-invitation":
      return Kn
    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 An
    case "@keet-private-id/identity-swap":
      return Dn
    case "@keet-private-id/room-status":
      return Sn
    case "@keet-private-id/room":
      return Ln
    case "@keet-private-id/add-room-operation":
      return qn
    case "@keet-private-id/remove-room-operation":
      return En
    case "@keet-private-id/update-room-status-operation":
      return On
    case "@keet-private-id/contact-status":
      return Un
    case "@keet-private-id/contact-record":
      return Jn
    case "@keet-private-id/add-contact-operation":
      return Hn
    case "@keet-private-id/update-contact-status-operation":
      return Qn
    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 lc
    case "@keet-private-id/profile-discovery-record-v1":
      return uc
    case "@keet-private-id/profile-discovery-record":
      return fc
    case "@local/background-sync-room":
      return mc
    case "@local/stats":
      return yc
    case "@local/migration-status":
      return xc
    case "@local/v3-private-profile-migration":
      return vc
    case "@local/v3-room-migration":
      return Kc
    case "@local/room-migration-stats":
      return hc
    case "@local/room-migration":
      return Rc
    case "@local/identity-status":
      return Pc
    case "@local/identity-record":
      return Ac
    case "@local/tasks":
      return Sc
    case "@local/room-keys":
      return Cc
    case "@local/join-room-invitation-task":
      return jc
    case "@local/join-room-response-task":
      return Lc
    case "@local/fast-forward-to":
      return Fc
    case "@local/add-room-fields":
      return qc
    case "@local/join-room-keys-task":
      return Ec
    case "@local/create-room-task":
      return Nc
    case "@local/leave-room-task":
      return Oc
    case "@local/clear-room-task":
      return Uc
    case "@local/restore-identity-task":
      return Jc
    case "@local/send-contact-request-task":
      return Wc
    case "@local/migrate-v2-room-task":
      return zc
    case "@local/task":
      return dr
    case "@local/shared-invitation":
      return nr
    case "@local/room-status":
      return cr
    case "@local/room-timestamps":
      return rr
    case "@local/room":
      return kr
    case "@local/room-preferences":
      return Kr
    case "@local/writer":
      return hr
    case "@local/member":
      return Rr
    case "@local/device":
      return Tr
    case "@local/file":
      return Ar
    case "@keet/add-file-preview-operation":
      return Sr
    case "@keet/member-removed-event":
      return Cr
    case "@keet/member-contact-info":
      return jr
    case "@keet/remove-device-operation":
      return Fr
    case "@keet/device-identity":
      return qr
    case "@keet/readonly-room-invitation":
      return Br
    case "@keet-private-id/identity-swap-v2":
      return Er
    case "@keet-private-id/activate-contact-room-operation":
      return Nr
    case "@local/identity-swap":
      return Or
    case "@local/writer-append":
      return Ur
    case "@local/room-metadata":
      return Jr
    case "@local/debug-flag":
      return Wr
    case "@local/debug":
      return Hr
    case "@keet/display-type":
      return Qr
    case "@keet/test-increment-operation":
      return Yr
    case "@keet/test-collection-record-1":
      return Zr
    case "@keet/migrate-abi-operation":
      return _r
    case "@keet/system-settings-keys":
      return dt
    case "@local/hyperdht-record":
      return nt
    case "@keet/room-supported-language":
      return rt
    case "@keet/translation-display-item":
      return it
    case "@local/unread":
      return at
    case "@keet-private-id/unreads":
      return st
    case "@keet-private-id/add-unreads-key-operation":
      return lt
    case "@keet-private-id/remove-unreads-key-operation":
      return ft
    case "@keet/label-type":
      return yt
    case "@keet/chat-label":
      return xt
    case "@keet/add-chat-label-operation":
      return vt
    case "@keet/remove-chat-label-operation":
      return gt
    case "@keet/chat-label-summary":
      return Kt
    case "@keet/chat-label-digest":
      return wt
    case "@keet/update-read-length-operation":
      return Pt
    case "@keet/read-length":
      return Tt
    case "@keet/tmp-removed-member":
      return Mt
    case "@keet-private-id/settings":
      return At
    case "@keet-private-id/user-settings-key":
      return St
    case "@keet-private-id/update-settings-operation":
      return jt
    case "@local/error-record-details":
      return Lt
    case "@local/error-record":
      return qt
    case "@local/keet-state":
      return Et
    case "@local/file-stats":
      return Vt
    case "@keet/member-label-type":
      return Ot
    case "@keet/member-label":
      return Ut
    case "@keet/add-member-label-operation":
      return Wt
    case "@keet/member-label-summary":
      return zt
    case "@keet/member-label-digest":
      return Gt
    case "@keet/location-shared-event":
      return Qt
    case "@keet/move-indexer-operation":
      return Yt
    case "@keet/start-call":
      return _t
    case "@keet/join-call":
      return oi
    case "@keet/leave-call":
      return ci
    case "@keet/end-call":
      return ti
    case "@keet/add-call-stream":
      return ai
    case "@keet/remove-call-stream":
      return pi
    case "@keet/call-record":
      return li
    case "@keet/call-member-record":
      return ui
    case "@keet/call-device-record":
      return fi
    case "@keet/call-stream-record":
      return mi
    case "@local/room-migration/hyperdb#3":
      return xi
    case "@local/room/hyperdb#6":
      return Si
    case "@local/room-preferences/hyperdb#13":
      return Ii
    case "@local/writer/hyperdb#14":
      return ji
    case "@local/member/hyperdb#17":
      return Fi
    case "@keet/device/hyperdb#18":
      return Ei
    case "@local/device/hyperdb#18":
      return Ni
    case "@keet-private-id/contact/hyperdb#19":
      return Oi
    case "@local/task/hyperdb#21":
      return Zi
    case "@keet/blob-pointer/hyperdb#23":
      return $i
    case "@keet/external-blob-pointer/hyperdb#23":
      return _i
    case "@keet/file-pointer/hyperdb#23":
      return oa
    case "@keet/file/hyperdb#23":
      return ra
    case "@local/file/hyperdb#23":
      return ia
    case "@keet/external-drive-pointer/hyperdb#24":
      return aa
    case "@keet/file-pointer/hyperdb#24":
      return la
    case "@keet/file/hyperdb#24":
      return ma
    case "@local/file/hyperdb#24":
      return xa
    case "@local/background-sync-room/hyperdb#27":
      return ba
    case "@local/writer-append/hyperdb#29":
      return va
    case "@local/room-metadata/hyperdb#30":
      return ka
    case "@local/unread/hyperdb#33":
      return ga
    case "@local/error-record/hyperdb#35":
      return ha
    case "@local/file-stats/hyperdb#37":
      return wa
    default:
      throw new Error("Encoder not found " + e)
  }
}
function ds(e, d = 28) {
  const n = es(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 os = ds
module.exports = {
  resolveStruct: os,
  getStruct: ds,
  getEnum: _a,
  getEncoding: es,
  encode: Za,
  decode: $a,
  setVersion: Ya,
  version: o,
}