import { aW as f, aX as s, aY as t, aZ as c, a_ as O, a$ as d, ac as o, b0 as A, b1 as p } from "./index-CTdUTRp6.mjs";
import { b2 as h } from "./index-CTdUTRp6.mjs";
class l extends Error {
  constructor(r) {
    super(r);
  }
}
class m extends l {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const y = f([
  s("mintAuthorityOption"),
  t("mintAuthority"),
  c("supply"),
  O("decimals"),
  d("isInitialized"),
  s("freezeAuthorityOption"),
  t("freezeAuthority")
]);
y.span;
async function E(e, r, a = !1, n = A, u = p) {
  if (!a && !o.isOnCurve(r.toBuffer()))
    throw new m();
  const [i] = await o.findProgramAddress([r.toBuffer(), n.toBuffer(), e.toBuffer()], u);
  return i;
}
export {
  p as ASSOCIATED_TOKEN_PROGRAM_ID,
  y as MintLayout,
  h as TOKEN_2022_PROGRAM_ID,
  A as TOKEN_PROGRAM_ID,
  l as TokenError,
  m as TokenOwnerOffCurveError,
  E as getAssociatedTokenAddress
};
