import { bl as f, bm as t, bn as e, bo as c, bp as O, bq as b, b0 as o, br as d, bs as p } from "./index-CJcmyOAU.mjs";
import { bt as h } from "./index-CJcmyOAU.mjs";
class A extends Error {
  constructor(r) {
    super(r);
  }
}
class l extends A {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const m = f([
  t("mintAuthorityOption"),
  e("mintAuthority"),
  c("supply"),
  O("decimals"),
  b("isInitialized"),
  t("freezeAuthorityOption"),
  e("freezeAuthority")
]);
m.span;
async function E(s, r, n = !1, u = d, a = p) {
  if (!n && !o.isOnCurve(r.toBuffer()))
    throw new l();
  const [i] = await o.findProgramAddress([r.toBuffer(), u.toBuffer(), s.toBuffer()], a);
  return i;
}
export {
  p as ASSOCIATED_TOKEN_PROGRAM_ID,
  m as MintLayout,
  h as TOKEN_2022_PROGRAM_ID,
  d as TOKEN_PROGRAM_ID,
  A as TokenError,
  l as TokenOwnerOffCurveError,
  E as getAssociatedTokenAddress
};
