import { T as f, A as c } from "./unsignedTransaction-DkC9OIgh.mjs";
import { c as K } from "./unsignedTransaction-DkC9OIgh.mjs";
import { af as s, as as p, aG as e, av as O } from "./address-BkeBsCZD.mjs";
import { p as o, u as m, b as A } from "./web3-L0yKkQfC.mjs";
class d extends Error {
  constructor(r) {
    super(r);
  }
}
class l extends d {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const y = p([
  e("mintAuthorityOption"),
  o("mintAuthority"),
  m("supply"),
  O("decimals"),
  A("isInitialized"),
  e("freezeAuthorityOption"),
  o("freezeAuthority")
]);
y.span;
async function h(t, r, a = !1, n = f, u = c) {
  if (!a && !s.isOnCurve(r.toBuffer()))
    throw new l();
  const [i] = await s.findProgramAddress([r.toBuffer(), n.toBuffer(), t.toBuffer()], u);
  return i;
}
export {
  c as ASSOCIATED_TOKEN_PROGRAM_ID,
  y as MintLayout,
  K as TOKEN_2022_PROGRAM_ID,
  f as TOKEN_PROGRAM_ID,
  d as TokenError,
  l as TokenOwnerOffCurveError,
  h as getAssociatedTokenAddress
};
