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