import { c as e } from "hyperschema/runtime"
const d = 1
let n = 1
const t = {
preencode(d, n) {
;(e.uint.preencode(d, n.width), e.uint.preencode(d, n.height))
},
encode(d, n) {
;(e.uint.encode(d, n.width), e.uint.encode(d, n.height))
},
decode: (d) => ({ width: e.uint.decode(d), height: e.uint.decode(d) }),
},
o = e.frame(t),
c = {
preencode(d, n) {
;(d.end++,
n.mimetype && e.string.preencode(d, n.mimetype),
n.dimensions && o.preencode(d, n.dimensions),
n.duration && e.uint.preencode(d, n.duration))
},
encode(d, n) {
const t = (n.mimetype ? 1 : 0) | (n.dimensions ? 2 : 0) | (n.duration ? 4 : 0)
;(e.uint.encode(d, t),
n.mimetype && e.string.encode(d, n.mimetype),
n.dimensions && o.encode(d, n.dimensions),
n.duration && e.uint.encode(d, n.duration))
},
decode(d) {
const n = e.uint.decode(d)
return {
mimetype: 1 & n ? e.string.decode(d) : null,
dimensions: 2 & n ? o.decode(d) : null,
duration: 4 & n ? e.uint.decode(d) : 0,
}
},
},
r = e.frame(c),
a = {
preencode(d, n) {
;(d.end++,
n.metadata && r.preencode(d, n.metadata),
n.base64 && e.string.preencode(d, n.base64),
n.buffer && e.buffer.preencode(d, n.buffer))
},
encode(d, n) {
const t = (n.metadata ? 1 : 0) | (n.base64 ? 2 : 0) | (n.buffer ? 4 : 0)
;(e.uint.encode(d, t),
n.metadata && r.encode(d, n.metadata),
n.base64 && e.string.encode(d, n.base64),
n.buffer && e.buffer.encode(d, n.buffer))
},
decode(d) {
const n = e.uint.decode(d)
return {
metadata: 1 & n ? r.decode(d) : null,
base64: 2 & n ? e.string.decode(d) : null,
buffer: 4 & n ? e.buffer.decode(d) : null,
}
},
},
i = {
preencode(d, n) {
;(d.end++,
n.left && e.uint.preencode(d, n.left),
n.top && e.uint.preencode(d, n.top),
n.width && e.uint.preencode(d, n.width),
n.height && e.uint.preencode(d, n.height))
},
encode(d, n) {
const t = (n.left ? 1 : 0) | (n.top ? 2 : 0) | (n.width ? 4 : 0) | (n.height ? 8 : 0)
;(e.uint.encode(d, t),
n.left && e.uint.encode(d, n.left),
n.top && e.uint.encode(d, n.top),
n.width && e.uint.encode(d, n.width),
n.height && e.uint.encode(d, n.height))
},
decode(d) {
const n = e.uint.decode(d)
return {
left: 1 & n ? e.uint.decode(d) : 0,
top: 2 & n ? e.uint.decode(d) : 0,
width: 4 & n ? e.uint.decode(d) : 0,
height: 8 & n ? e.uint.decode(d) : 0,
}
},
},
u = e.array(e.string),
s = {
preencode(d, n) {
;(d.end++, n.path && e.string.preencode(d, n.path), n.sizes && u.preencode(d, n.sizes))
},
encode(d, n) {
const t = (n.path ? 1 : 0) | (n.sizes ? 2 : 0)
;(e.uint.encode(d, t), n.path && e.string.encode(d, n.path), n.sizes && u.encode(d, n.sizes))
},
decode(d) {
const n = e.uint.decode(d)
return { path: 1 & n ? e.string.decode(d) : null, sizes: 2 & n ? u.decode(d) : null }
},
},
p = r,
m = e.frame(a),
l = m,
f = m,
h = {
preencode(e, d) {
;(p.preencode(e, d.metadata),
e.end++,
d.small && m.preencode(e, d.small),
d.medium && l.preencode(e, d.medium),
d.large && f.preencode(e, d.large))
},
encode(d, n) {
const t = (n.small ? 1 : 0) | (n.medium ? 2 : 0) | (n.large ? 4 : 0)
;(p.encode(d, n.metadata),
e.uint.encode(d, t),
n.small && m.encode(d, n.small),
n.medium && l.encode(d, n.medium),
n.large && f.encode(d, n.large))
},
decode(d) {
const n = p.decode(d),
t = e.uint.decode(d)
return {
metadata: n,
small: 1 & t ? m.decode(d) : null,
medium: 2 & t ? l.decode(d) : null,
large: 4 & t ? f.decode(d) : null,
}
},
},
g = u,
b = {
preencode(d, n) {
;(d.end++, n.path && e.string.preencode(d, n.path), n.sizes && g.preencode(d, n.sizes))
},
encode(d, n) {
const t = (n.path ? 1 : 0) | (n.sizes ? 2 : 0)
;(e.uint.encode(d, t), n.path && e.string.encode(d, n.path), n.sizes && g.encode(d, n.sizes))
},
decode(d) {
const n = e.uint.decode(d)
return { path: 1 & n ? e.string.decode(d) : null, sizes: 2 & n ? g.decode(d) : null }
},
},
w = r,
v = m,
z = m,
k = m,
y = {
preencode(e, d) {
;(w.preencode(e, d.metadata),
e.end++,
d.small && v.preencode(e, d.small),
d.medium && z.preencode(e, d.medium),
d.large && k.preencode(e, d.large))
},
encode(d, n) {
const t = (n.small ? 1 : 0) | (n.medium ? 2 : 0) | (n.large ? 4 : 0)
;(w.encode(d, n.metadata),
e.uint.encode(d, t),
n.small && v.encode(d, n.small),
n.medium && z.encode(d, n.medium),
n.large && k.encode(d, n.large))
},
decode(d) {
const n = w.decode(d),
t = e.uint.decode(d)
return {
metadata: n,
small: 1 & t ? v.decode(d) : null,
medium: 2 & t ? z.decode(d) : null,
large: 4 & t ? k.decode(d) : null,
}
},
},
q = {
preencode(d, n) {
;(d.end++,
n.path && e.string.preencode(d, n.path),
n.buffer && e.buffer.preencode(d, n.buffer))
},
encode(d, n) {
const t = (n.path ? 1 : 0) | (n.buffer ? 2 : 0)
;(e.uint.encode(d, t),
n.path && e.string.encode(d, n.path),
n.buffer && e.buffer.encode(d, n.buffer))
},
decode(d) {
const n = e.uint.decode(d)
return { path: 1 & n ? e.string.decode(d) : null, buffer: 2 & n ? e.buffer.decode(d) : null }
},
},
L = r,
E = {
preencode(d, n) {
;(d.end++,
n.metadata && L.preencode(d, n.metadata),
n.buffer && e.buffer.preencode(d, n.buffer))
},
encode(d, n) {
const t = (n.metadata ? 1 : 0) | (n.buffer ? 2 : 0)
;(e.uint.encode(d, t),
n.metadata && L.encode(d, n.metadata),
n.buffer && e.buffer.encode(d, n.buffer))
},
decode(d) {
const n = e.uint.decode(d)
return { metadata: 1 & n ? L.decode(d) : null, buffer: 2 & n ? e.buffer.decode(d) : null }
},
},
x = e.frame(i),
j = {
preencode(d, n) {
;(d.end++, n.path && e.string.preencode(d, n.path), n.crop && x.preencode(d, n.crop))
},
encode(d, n) {
const t = (n.path ? 1 : 0) | (n.crop ? 2 : 0)
;(e.uint.encode(d, t), n.path && e.string.encode(d, n.path), n.crop && x.encode(d, n.crop))
},
decode(d) {
const n = e.uint.decode(d)
return { path: 1 & n ? e.string.decode(d) : null, crop: 2 & n ? x.decode(d) : null }
},
},
A = m,
B = m,
C = {
preencode(e, d) {
;(A.preencode(e, d.small), B.preencode(e, d.medium))
},
encode(e, d) {
;(A.encode(e, d.small), B.encode(e, d.medium))
},
decode: (e) => ({ small: A.decode(e), medium: B.decode(e) }),
},
D = x,
F = {
preencode(d, n) {
;(d.end++, n.path && e.string.preencode(d, n.path), n.crop && D.preencode(d, n.crop))
},
encode(d, n) {
const t = (n.path ? 1 : 0) | (n.crop ? 2 : 0)
;(e.uint.encode(d, t), n.path && e.string.encode(d, n.path), n.crop && D.encode(d, n.crop))
},
decode(d) {
const n = e.uint.decode(d)
return { path: 1 & n ? e.string.decode(d) : null, crop: 2 & n ? D.decode(d) : null }
},
},
G = m,
H = m,
I = {
preencode(e, d) {
;(G.preencode(e, d.small), H.preencode(e, d.medium))
},
encode(e, d) {
;(G.encode(e, d.small), H.encode(e, d.medium))
},
decode: (e) => ({ small: G.decode(e), medium: H.decode(e) }),
},
J = {
preencode(d, n) {
;(d.end++, n.httpLink && e.string.preencode(d, n.httpLink))
},
encode(d, n) {
const t = n.httpLink ? 1 : 0
;(e.uint.encode(d, t), n.httpLink && e.string.encode(d, n.httpLink))
},
decode: (d) => ({ httpLink: 1 & e.uint.decode(d) ? e.string.decode(d) : null }),
},
K = r,
M = {
preencode(d, n) {
;(d.end++, n.metadata && K.preencode(d, n.metadata), n.data && e.buffer.preencode(d, n.data))
},
encode(d, n) {
const t = (n.metadata ? 1 : 0) | (n.data ? 2 : 0)
;(e.uint.encode(d, t),
n.metadata && K.encode(d, n.metadata),
n.data && e.buffer.encode(d, n.data))
},
decode(d) {
const n = e.uint.decode(d)
return { metadata: 1 & n ? K.decode(d) : null, data: 2 & n ? e.buffer.decode(d) : null }
},
}
function N(e) {
n = e
}
function O(d, t, o = 1) {
return ((n = o), e.encode(R(d), t))
}
function P(d, t, o = 1) {
return ((n = o), e.decode(R(d), t))
}
function Q(e) {
throw new Error("Enum not found " + e)
}
function R(e) {
switch (e) {
case "@media/dimensions":
return t
case "@media/metadata":
return c
case "@media/file":
return a
case "@media/crop":
return i
case "@media/create-chat-image-preview-request":
return s
case "@media/create-chat-image-preview-response":
return h
case "@media/create-chat-video-preview-request":
return b
case "@media/create-chat-video-preview-response":
return y
case "@media/create-chat-link-preview-request":
return q
case "@media/create-chat-link-preview-response":
return E
case "@media/create-profile-avatar-request":
return j
case "@media/create-profile-avatar-response":
return C
case "@media/create-room-avatar-request":
return F
case "@media/create-room-avatar-response":
return I
case "@media/decode-image-request":
return J
case "@media/decode-image-response":
return M
default:
throw new Error("Encoder not found " + e)
}
}
function S(e, d = 1) {
const t = R(e)
return {
preencode(e, o) {
;((n = d), t.preencode(e, o))
},
encode(e, o) {
;((n = d), t.encode(e, o))
},
decode: (e) => ((n = d), t.decode(e)),
}
}
const T = S
export {
T as resolveStruct,
S as getStruct,
Q as getEnum,
R as getEncoding,
O as encode,
P as decode,
N as setVersion,
n as version,
}