var u=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var A=Object.prototype.hasOwnProperty;var M=(t,e)=>{for(var n in e)u(t,n,{get:e[n],enumerable:!0})},_=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of x(e))!A.call(t,c)&&c!==n&&u(t,c,{get:()=>e[c],enumerable:!(s=w(e,c))||s.enumerable});return t};var $=t=>_(u({},"__esModule",{value:!0}),t);var q={};M(q,{default:()=>U,getUrls:()=>p});module.exports=$(q);var b=require("@chakra-ui/react"),i=require("@metaplex-foundation/js"),f=require("@solana/wallet-adapter-react"),d=require("@solana/web3.js"),r=require("react"),p=(t,e,n)=>t==="devnet"||t===9091?{rpc:"https://skilled-damp-glade.solana-devnet.discover.quiknode.pro/5eab58b431f2edb5c03a4a04e1cec02848871190/",bundlrAddress:"https://devnet.bundlr.network",bundlrProviderUrl:"https://skilled-damp-glade.solana-devnet.discover.quiknode.pro/5eab58b431f2edb5c03a4a04e1cec02848871190/",explorer:`https://solscan.io/${n}/${e}?cluster=devnet`}:t==="mainnet-beta"||t===9090?{rpc:"https://yolo-smart-sunset.solana-mainnet.quiknode.pro/0b35b5967d53895fd926312245f3c1e7026c1e7c/",bundlrAddress:"https://node1.bundlr.network",bundlrProviderUrl:"https://yolo-smart-sunset.solana-mainnet.quiknode.pro/0b35b5967d53895fd926312245f3c1e7026c1e7c/",explorer:`https://solscan.io/${n}/${e}`}:{rpc:"http://127.0.0.1:8899",bundlrAddress:"https://devnet.bundlr.network",bundlrProviderUrl:(0,d.clusterApiUrl)("devnet"),explorer:`https://solscan.io/${n}/${e}?cluster=custom`},C=t=>{let e=(0,f.useWallet)(),n=(0,b.useToast)(),[s,c]=(0,r.useState)(null),[h,v]=(0,r.useState)();(0,r.useEffect)(()=>{if([9090,9091].includes(t)){let o=t===9091?"devnet":"mainnet-beta",a=new d.Connection(p(o).rpc);v(a),c(i.Metaplex.make(a).use((0,i.walletAdapterIdentity)(e)))}},[e]);let y=(0,r.useCallback)(o=>o==="candyMachine",[]),m=(0,r.useCallback)(async o=>{let a=new d.PublicKey(o);try{return await s.candyMachines().findByAddress({address:a})}catch(l){throw console.log(l),n({title:"invalid cm",description:"provided id is neither cm v2 or v3.",status:"error",duration:6e3}),l}},[s,n]),k=(0,r.useCallback)(async o=>{let a=new d.PublicKey(o);try{return await s.candyMachinesV2().findByAddress({address:a})}catch{return m(o)}},[m,s]);return{metaplex:s,getCandyMachine:k,isV3:y,getUrls:p,connection:h}},U=C;0&&(module.exports={getUrls});
