var F=Object.defineProperty;var h=(e,o)=>()=>(e&&(o=e(e=0)),o);var U=(e,o)=>{for(var t in o)F(e,t,{get:o[t],enumerable:!0})};import{createContext as $,useContext as z,useRef as ae}from"react";import{jsx as se}from"react/jsx-runtime";var k,v,w=h(()=>{k=$(void 0),v=()=>z(k)});var B={};U(B,{default:()=>Y});import"react";import{Button as M,Flex as u,Icon as b,Modal as T,ModalBody as A,ModalCloseButton as L,ModalContent as G,ModalHeader as P,ModalOverlay as E,Text as S}from"@chakra-ui/react";import{BsApple as H,BsGoogle as N}from"react-icons/bs";import{createEvent as j}from"ics";import{jsx as n,jsxs as s}from"react/jsx-runtime";var V,W,Y,I=h(()=>{w();V=e=>{let o=e.getFullYear(),t=e.getMonth()+1,l=e.getDate(),m=e.getHours(),p=e.getMinutes();return[o,t,l,m,p]},W=({isOpen:e,onClose:o,reminderCollection:t})=>{let{rootRef:l}=v(),m=async(a,c,f)=>{let C={start:V(new Date(a*1e3)),duration:{hours:24},title:c,description:f},d=`${c}.ics`,g=await new Promise((R,O)=>{j(C,(y,D)=>{y&&O(y),R(new File([D],d,{type:"plain/text"}))})}),i=URL.createObjectURL(g),r=document.createElement("a");r.href=i,r.download=d,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)},p=(a,c,f)=>{let C=new Date(a*1e3).toISOString().replace(/-|:|\.\d+/g,""),d=new Date(a*1e3+1*24*60*60*1e3).toISOString().replace(/-|:|\.\d+/g,""),g=encodeURIComponent(c),i=encodeURIComponent(f),r="https://calendar.google.com/calendar/u/0/r/eventedit",R=`dates=${C}/${d}&text=${g}&details=${i}&location=&allday=false`;return`${r}?${R}`};return s(T,{blockScrollOnMount:!1,isOpen:e,onClose:o,portalProps:{containerRef:l},children:[n(E,{}),s(G,{children:[n(P,{color:"foreground",fontSize:"md",children:"Add reminder to your calender"}),n(L,{}),s(A,{pb:4,children:[s(u,{justifyContent:"space-between",alignItems:"center",mb:1,children:[s(u,{alignItems:"center",children:[n(b,{as:N,h:"4",w:"4",color:"mutedForeground"}),n(S,{ml:"2",fontSize:"sm",children:"Google Calender"})]}),n(M,{variant:"outline",size:"sm",onClick:()=>{let a=p(t?.stats?.startDate,t?.profile?.name,`Get your hands on ${t?.profile?.name} NFT Collection. Mint powered by Bandit.`);window.open(a)},children:"Add"})]}),s(u,{justifyContent:"space-between",alignItems:"center",mv:"6",children:[s(u,{alignItems:"center",children:[n(b,{as:H,h:"4",w:"4",color:"mutedForeground"}),n(S,{ml:"2",fontSize:"sm",children:"iCalender"})]}),n(M,{variant:"outline",size:"sm",onClick:()=>{m(t?.stats?.startDate,t?.profile?.name,`Get your hands on ${t?.profile?.name} NFT Collection. Mint powered by Bandit.`).catch(a=>console.log(a))},children:"Add"})]})]})]})]})},Y=W});import{lazy as q,Suspense as J}from"react";import{Button as K,useDisclosure as Q}from"@chakra-ui/react";import{Fragment as _,jsx as x,jsxs as ee}from"react/jsx-runtime";var X=q(()=>Promise.resolve().then(()=>(I(),B))),Z=({collection:e})=>{let{isOpen:o,onOpen:t,onClose:l}=Q();return ee(_,{children:[x(K,{fontSize:"sm",fontWeight:500,variant:"outline",size:"sm",onClick:t,children:"Add"}),x(J,{fallback:null,children:x(X,{isOpen:o,onClose:l,reminderCollection:e})})]})},xe=Z;export{xe as default};
