import{Button as x,Icon as v}from"@chakra-ui/react";import{FiExternalLink as I}from"react-icons/fi";import{useDispatch as b,useSelector as M}from"react-redux";import C from"axios";import{createContext as y,useMemo as B}from"react";import{jsx as R}from"react/jsx-runtime";var N=y(void 0),s="production";var l=s==="development"?"https://qa-api-v2.bandit.network/sdk":"https://api-v2.bandit.network/sdk";var p=async(e,t,r)=>{try{await C.post(`${l}/metrics/${t}`,r,{headers:{"X-API-KEY":e}})}catch(o){console.log(o)}};var d={MINT_CLICK:"MINT_CLICK",SOURCE:"SOURCE"};import{createSlice as g}from"@reduxjs/toolkit";var S={selectedCollectionId:null,showMint:!1,collectionViewOpen:!1,selectedSpaceId:!1},f=g({name:"collection",initialState:S,reducers:{updateSelectedCollectionId(e,{payload:{id:t}}){e.selectedCollectionId=t},updateShowMint(e,{payload:{showMint:t}}){e.showMint=t},updateCollectionViewOpen(e,{payload:{collectionViewOpen:t}}){e.collectionViewOpen=t},updateSelectedSpaceId(e,{payload:{id:t}}){e.selectedSpaceId=t}}}),{updateSelectedCollectionId:u,updateShowMint:m,updateCollectionViewOpen:Y,updateSelectedSpaceId:j}=f.actions,G=f.reducer;var h=(e,t,r,o,i,a,c)=>{if(c)o(t);else{let n=new URLSearchParams(e);n.set("collectionId",r);let w=`${t}?${n.toString()}${a?"#mint":""}`;o(w)}};import{jsx as P,jsxs as k}from"react/jsx-runtime";var A=({collectionId:e,isExternalMint:t,profile:r,isCollectionContest:o})=>{let i=b(),a=M(n=>n.user.accessKey);return k(x,{variant:"outline",size:"sm",w:"20",onClick:()=>{t?window.open(r.socialmedia.website):(i(u({id:e})),i(m({showMint:!0})),h(window.location.search,window.location.pathname,e,n=>{window.history.pushState({},"",n)},!1,!0,!1)),p(a,d.MINT_CLICK,{collectionId:e})},children:[o?"Claim":"Mint",t&&P(v,{as:I,pos:"absolute",right:"2.5",h:"3",w:"3"})]})},re=A;export{re as default};
