import { T as f, A as c } from "./unsignedTransaction-C0WXQMmv.mjs";
import { c as K } from "./unsignedTransaction-C0WXQMmv.mjs";
import { ae as e, ar as p, aG as s, au as O } from "./address-CBux52Na.mjs";
import { p as o, u as m, b as A } from "./web3-B3Usc-Qj.mjs";
class d extends Error {
  constructor(r) {
    super(r);
  }
}
class l extends d {
  constructor() {
    super(...arguments), this.name = "TokenOwnerOffCurveError";
  }
}
const y = p([
  s("mintAuthorityOption"),
  o("mintAuthority"),
  m("supply"),
  O("decimals"),
  A("isInitialized"),
  s("freezeAuthorityOption"),
  o("freezeAuthority")
]);
y.span;
async function h(t, r, a = !1, u = f, n = c) {
  if (!a && !e.isOnCurve(r.toBuffer()))
    throw new l();
  const [i] = await e.findProgramAddress([r.toBuffer(), u.toBuffer(), t.toBuffer()], n);
  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
};
