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