import { c as i, g as d, a as m, M as p, B as g, b as u, s as n, d as h, e as o, T as y, f } from "./en_US-VXVFCG4S-DPSlm2jp.js";
const l = ({
  solanaWallet: a,
  walletDetailsParams: r,
  connection: s
}) => i((e) => ({
  ...r,
  isSolanaConnector: !0,
  id: a.adapter.name,
  name: a.adapter.name,
  type: a.adapter.name,
  showQrModal: !1,
  sendTransaction: async (t) => {
    const c = y.from(f.from(t, "hex"));
    return await a.adapter.sendTransaction(c, s);
  },
  connect: async () => (e.emitter.emit("message", {
    type: "connecting"
  }), o("sk-widget@1//shimDisconnect/solana", !0), await a.adapter.connect(), {
    accounts: [a.adapter.publicKey?.toBase58()],
    chainId: n.id
  }),
  disconnect: () => (o("sk-widget@1//shimDisconnect/solana", !1), a.adapter.disconnect()),
  getAccounts: async () => h.fromNullable(a.adapter.publicKey?.toBase58()).map((t) => [t]).unsafeCoerce(),
  switchChain: async () => n,
  getChainId: async () => n.id,
  isAuthorized: async () => u("sk-widget@1//shimDisconnect/solana").map((t) => !!(t && a.adapter.connected && a.adapter.publicKey?.toBase58())).orDefault(!1),
  onAccountsChanged: (t) => {
    t.length === 0 ? e.emitter.emit("disconnect") : e.emitter.emit("change", {
      accounts: t
    });
  },
  onChainChanged: (t) => {
    e.emitter.emit("change", {
      chainId: t
    });
  },
  onDisconnect: () => {
    e.emitter.emit("disconnect");
  },
  getProvider: async () => ({}),
  $filteredChains: new g([n]).asObservable()
})), b = ({
  wallets: a,
  forceWalletConnectOnly: r,
  connection: s
}) => ({
  groupName: "Solana",
  wallets: r ? [] : a.map((e) => () => ({
    id: e.adapter.name,
    name: e.adapter.name,
    iconUrl: e.adapter.icon,
    iconBackground: "#fff",
    chainGroup: {
      iconUrl: m(p.Solana),
      title: "Solana",
      id: "solana"
    },
    installed: e.readyState === "Installed" || e.readyState === "Loadable",
    ...d(e.adapter),
    createConnector: (t) => l({
      solanaWallet: e,
      walletDetailsParams: t,
      connection: s
    })
  }))
});
export {
  b as getSolanaConnectors
};
//# sourceMappingURL=solana-connector-CkMNGSHf.js.map
