var b=Object.create;var p=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames,x=Object.getOwnPropertySymbols,K=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var w=(t,e,o)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,P=(t,e)=>{for(var o in e||(e={}))I.call(e,o)&&w(t,o,e[o]);if(x)for(var o of x(e))S.call(e,o)&&w(t,o,e[o]);return t};var Y=(t,e)=>{for(var o in e)p(t,o,{get:e[o],enumerable:!0})},v=(t,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of k(e))!I.call(t,r)&&r!==o&&p(t,r,{get:()=>e[r],enumerable:!(c=E(e,r))||c.enumerable});return t};var B=(t,e,o)=>(o=t!=null?b(K(t)):{},v(e||!t||!t.__esModule?p(o,"default",{value:t,enumerable:!0}):o,t)),M=t=>v(p({},"__esModule",{value:!0}),t);var l=(t,e,o)=>new Promise((c,r)=>{var h=n=>{try{s(o.next(n))}catch(i){r(i)}},m=n=>{try{s(o.throw(n))}catch(i){r(i)}},s=n=>n.done?c(n.value):Promise.resolve(n.value).then(h,m);s((o=o.apply(t,e)).next())});var N={};Y(N,{default:()=>D});module.exports=M(N);var d=require("react");var u=require("react"),_=require("react/jsx-runtime"),q=(0,u.createContext)(void 0),A="production";var C=A==="development"?"https://qa-api-v2.bandit.network/sdk":"https://api-v2.bandit.network/sdk";var $=B(require("axios"),1);var g=(t,e)=>l(void 0,null,function*(){try{return(yield $.default.get(`${C}/collection/${e}`,{headers:{"X-API-KEY":t}})).data}catch(o){throw new Error(o)}});var X=(t,e)=>{let[o,c]=(0,d.useState)({}),[r,h]=(0,d.useState)(null),[m,s]=(0,d.useState)(!0);return(0,d.useEffect)(()=>{function n(){return l(this,null,function*(){var i,y,f;try{s(!0);let a=yield g(e,t);c(P({collectionId:t,contractAddress:(i=a==null?void 0:a.contract)==null?void 0:i.contractAddress,chainId:(y=a==null?void 0:a.contract)==null?void 0:y.chainId,mintPrice:a.stats.price.value,mintPriceUnit:a.stats.price.unit,mintFunction:a.contract.mintFunction,abi:a.contract.abi,profile:a.profile,contract:a==null?void 0:a.contract,stats:a==null?void 0:a.stats},a)),h((f=a==null?void 0:a.contract)==null?void 0:f.candyMachineId)}catch(a){console.log(`Failed to fetch collection details from collection ID: ${t}`)}finally{s(!1)}})}t&&n()},[t,e]),{collectionState:o,isLoading:m,candyMachineId:r}},D=X;
