const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ownerOf-B0gQXZrQ.js","assets/thirdweb-Co3M1EyP.js"])))=>i.map(i=>d[i]);
import{r as i,M as u,_ as o}from"./thirdweb-Co3M1EyP.js";import{f}from"./fetchTokenMetadata-dQEbpZ5P.js";import{parseNFT as d}from"./parseNft-DD6m8xPf.js";import"./uint8-array-DZKEMhA1.js";const y="0xc87b56dd",I=[{name:"_tokenId",type:"uint256"}],h=[{type:"string"}];async function k(t){return i({contract:t.contract,method:[y,I,h],params:[t.tokenId]})}const l="0x4f6ccce7",m=[{name:"_index",type:"uint256"}],s=[{type:"uint256"}];async function _(t){return i({contract:t.contract,method:[l,m,s],params:[t.index]})}async function R(t){const{useIndexer:n=!0}=t;if(n)try{return await T(t)}catch{return await r(t)}return await r(t)}async function T(t){const n=await u({chain:t.contract.chain,client:t.contract.client,contractAddress:t.contract.address,includeOwners:t.includeOwner,tokenId:t.tokenId});return n||r(t)}async function r(t){let n=t.tokenId;if(t.tokenByIndex)try{n=await _({contract:t.contract,index:t.tokenId})}catch{}const[c,a]=await Promise.all([k({contract:t.contract,tokenId:n}).catch(()=>null),t.includeOwner?o(()=>import("./ownerOf-B0gQXZrQ.js"),__vite__mapDeps([0,1])).then(e=>e.ownerOf({contract:t.contract,tokenId:n})).catch(()=>null):null]);return c!=null&&c.trim()?d(await f({client:t.contract.client,tokenId:n,tokenUri:c}).then(e=>e||{id:n,type:"ERC721",uri:c}).catch(()=>({id:n,type:"ERC721",uri:c})),{chainId:t.contract.chain.id,owner:a,tokenAddress:t.contract.address,tokenId:n,tokenUri:c,type:"ERC721"}):d({id:n,type:"ERC721",uri:""},{chainId:t.contract.chain.id,owner:a,tokenAddress:t.contract.address,tokenId:n,tokenUri:"",type:"ERC721"})}export{R as getNFT};
