import { bA as f, bB as c, P as s, bC as O, bD as t, bE as o, bF as A, bG as b, bH as d } from "./index-TykGc-eA.mjs";
import { bI as h } from "./index-TykGc-eA.mjs";
class p extends Error {
  constructor(r) {
    super(r);
  }
}
class l extends p {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const m = O([
  t("mintAuthorityOption"),
  o("mintAuthority"),
  A("supply"),
  b("decimals"),
  d("isInitialized"),
  t("freezeAuthorityOption"),
  o("freezeAuthority")
]);
m.span;
async function E(e, r, n = !1, u = f, a = c) {
  if (!n && !s.isOnCurve(r.toBuffer()))
    throw new l();
  const [i] = await s.findProgramAddress([r.toBuffer(), u.toBuffer(), e.toBuffer()], a);
  return i;
}
export {
  c as ASSOCIATED_TOKEN_PROGRAM_ID,
  m as MintLayout,
  h as TOKEN_2022_PROGRAM_ID,
  f as TOKEN_PROGRAM_ID,
  p as TokenError,
  l as TokenOwnerOffCurveError,
  E as getAssociatedTokenAddress
};
