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