import{Button as w,Icon as C}from"@chakra-ui/react";import{FiExternalLink as g}from"react-icons/fi";import{useDispatch as x,useSelector as I}from"react-redux";import{createSlice as h}from"@reduxjs/toolkit";var m={selectedCollectionId:null,showMint:!1,collectionViewOpen:!1,selectedSpaceId:!1},l=h({name:"collection",initialState:m,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:s,updateShowMint:p,updateCollectionViewOpen:L,updateSelectedSpaceId:b}=l.actions,A=l.reducer;var f=(e,t,n,r,i,a,c)=>{if(c)r(t);else{let o=new URLSearchParams(e);o.set("collectionId",n);let u=`${t}?${o.toString()}${a?"#mint":""}`;r(u)}};import y from"posthog-js";function d(e,t){try{y.capture(e,t)}catch(n){}}import{jsx as M,jsxs as T}from"react/jsx-runtime";var S=({collectionId:e,isExternalMint:t,profile:n,isCollectionContest:r})=>{let i=x(),a=I(o=>o.user.accessKey);return T(w,{variant:"outline",size:"sm",w:"20",onClick:()=>{t?window.open(n.socialmedia.website):(i(s({id:e})),i(p({showMint:!0})),f(window.location.search,window.location.pathname,e,o=>{window.history.pushState({},"",o)},!1,!0,!1)),d("Collection Mint Button Clicked",{collectionId:e})},children:[r?"Claim":"Mint",t&&M(C,{as:g,pos:"absolute",right:"2.5",h:"3",w:"3"})]})},oe=S;export{oe as default};
