1import{j as e}from"./vendor-dotlottie-CKWLB76h.js";import{j as Q,a as i}from"./vendor-react-CCzXVbVA.js";import{u as ne,H as re}from"./useHacksOverview-Yir5wjid.js";import{c as K}from"./index.esm-DOW5uEmc.js";import{F as m,V as oe,H as w,h as M,T as y,aF as le,j as J,B as O,L as ie,u as ce,ac as R,af as X,g as V,I as Z,aM as de,ak as xe,al as ue,bx as pe,l as he,m as fe,b2 as me,o as ge,p as be,aD as je,s as Fe}from"./vendor-chakra-z2eW50qa.js";import{g as ee,aD as we,bP as ye,bQ as Ce,A as Se,c as ve,s as te,ag as q,O as Y,b as se,N as ke}from"./app-ZGxtfi_0.js";import{u as Ie}from"./vendor-query-Cq2FYR_1.js";import{P as _e}from"./PaginationNav-B79VVQAb.js";import{S as B}from"./react-select.esm-f8TJ4I6W.js";import{F as D}from"./FormatOptionLabel-2vVxqozM.js";import"./vendor-monaco-CiJro7ev.js";import"./stylesForCustomSelect-_IRGt3_J.js";import"./header-C8ZdLDuh.js";import"./vendor-analytics-kxESroPO.js";import"./vendor-victory-2uYGyQN6.js";import"./assertThisInitialized-DtB8HoZg.js";const Le=({hackData:s})=>{const n=ee(),r=/[^0-9$]/;return e.jsxs(m,{justifyContent:"space-between",alignItems:"center",flexDir:"column",w:["100%","100%","calc(50% - 15px)","calc(33.33% - 15px)"],maxW:["550px"],minW:["0px","300px"],height:"250px",borderRadius:"25px",mr:"15px",mb:"15px",p:7,background:"#FFFFFF",children:[e.jsxs(oe,{w:"100%",justifyContent:"flex-start",alignItems:"flex-start",children:[e.jsxs(w,{justifyContent:"space-between",alignItems:"center",w:"100%",height:"fit-content",mb:3,children:[e.jsx(M,{fontSize:"lg",children:s.target}),e.jsxs(w,{maxW:"40%",alignItems:"flex-start",children:[e.jsx(m,{alignItems:"center",justifyContent:"center",h:5,children:e.jsx(we,{variant:ye[s.attacked_method]||"low"})}),e.jsx(y,{fontSize:"sm",textAlign:"right",children:s.attacked_method})]})]}),e.jsx(y,{fontSize:"xs",color:"#78909C",children:"Total Loss"}),e.jsxs(w,{mt:5,w:["100%","100%","100%"],flexWrap:"wrap",justifyContent:"space-between",children:[e.jsxs(w,{mr:3,children:[e.jsx(le,{label:s.chain,children:e.jsx(J,{mr:0,src:`${n}blockscan/${s.chain.toLowerCase()}.svg`,alt:"Unknown",h:"26px",w:"26px",onError:({currentTarget:l})=>{l.onerror=null,l.src=`${n}blockscan/other.svg`}})}),e.jsx(M,{mb:3,fontSize:"lg",children:r.test(s.amount)?s.amount:"$ "+Number(s.amount).toLocaleString()})]}),s&&s.hack_scwe_id&&s.hack_scwe_link&&e.jsx(m,{children:e.jsxs(O,{display:"inline-flex",alignItems:"center",backgroundColor:"#FFFFFF",borderRadius:"7px",width:"fit-content",height:"26px",onClick:()=>window.open(s.hack_scwe_link,"_blank"),style:{cursor:"pointer"},children:[e.jsx(J,{src:ee()+"logo/owasp_logo.svg",height:"16px",width:"16px",mr:1}),e.jsx(y,{fontSize:"14px",fontWeight:"600",color:"#666666",mr:1,children:"OWASP:"}),e.jsx(y,{fontSize:"14px",fontWeight:"600",color:"#0000FF",children:s.hack_scwe_id})]})})]})]}),e.jsxs(w,{justifyContent:"space-between",alignItems:"center",w:"100%",height:"fit-content",children:[e.jsx(y,{color:"#78909C",children:Ce(new Date(s.date))}),s.reference&&s.reference!=="-"&&e.jsx(ie,{id:"ss-hack-learn",variant:"text",color:"#3300FF",href:s.reference.split(",")[0],target:"_blank",children:"Learn More"})]})]})},Pe=async(s,n,r,l)=>{const{data:x}=await Se.post(ve.API_GET_ATTACKS,{page:s.pageNo,per_page:s.perPageCount,filter:n,sort_by:r,search_query:l});return x},Re=(s,n,r,l)=>Ie(["hacks",s.pageNo,s.perPageCount,n],()=>Pe(s,n,r,l)),ae=({overviewData:s,filters:n,setFilters:r,sortBy:l,setSortBy:x,refetchHacks:W})=>{const G=Q(),j=new URLSearchParams(G.search),E=j.get("month"),T=j.get("year"),[u]=ce("(min-width: 1024px)"),[I,C]=i.useState(""),[_,A]=i.useState(""),[c,S]=i.useState(E||""),[f,L]=i.useState(T||""),H=[{value:"-date",label:"Date"},{value:"chain",label:"BlockChain"},{value:"attacked_method",label:"Attack Method"}],$=s?.all_chains?s.all_chains.sort((t,a)=>t.localeCompare(a)).map(t=>({value:t,icon:t.toLowerCase(),label:t})):[],z=s?.all_categories?s.all_categories.map(t=>({value:t,label:t})):[],p=new Date().getFullYear(),v=2011,P=Array.from({length:p-v+1},(t,a)=>{const o=v+a;return{value:String(o),label:String(o)}}),U={option:(t,a)=>({...t,borderBottom:"1px solid #f3f3f3",backgroundColor:a.isSelected?"#F
1FFFFF":a.isFocused?"#E6E6E6":"#FFFFFF",color:"#000000"}),menu:(t,a)=>({...t,borderRadius:10,border:"0px solid #ffffff",overflowY:"hidden",width:"300px",textAlign:"left"}),control:t=>({display:"flex",flexDirection:"row",backgroundColor:"#FFFFFF",padding:5,margin:0,borderTopLeftRadius:15,borderBottomLeftRadius:15,borderTopRightRadius:u?0:15,borderBottomRightRadius:u?0:15,border:t.isFocused?"2px solid #52FF00":"2px solid #EDF2F7"}),singleValue:(t,a)=>{const o=a.isDisabled?.3:1;return{...t,opacity:o,transition:"opacity 300ms"}}},h={option:(t,a)=>({...t,borderBottom:"1px solid #f3f3f3",backgroundColor:a.isSelected?"#FFFFFF":a.isFocused?"#E6E6E6":"#FFFFFF",color:"#000000"}),menu:(t,a)=>({...t,color:a.selectProps.menuColor,borderRadius:10,border:"0px solid #ffffff",overflowY:"hidden",width:"250px"}),control:t=>({display:"flex",flexDirection:"row",backgroundColor:"#FFFFFF",padding:5,borderTopLeftRadius:0,borderBottomLeftRadius:0,borderRadius:u?0:15,marginLeft:u?-2:0,marginRight:u?-2:0,marginBottom:u?0:10,border:t.isFocused?"2px solid #52FF00":"2px solid #EDF2F7"}),singleValue:(t,a)=>{const o=a.isDisabled?.3:1;return{...t,opacity:o,transition:"opacity 300ms"}}};i.useEffect(()=>{(I||_||c||f||l)&&W()},[I,_,c,f,l]);const F=(t,a)=>{const o=q.findIndex(N=>N.toLowerCase()===t.toLowerCase()),d=Number(a)||p;let g="",b="";o!==-1?(g=Y(new Date(d,o,1),"2-digit","es-CL"),b=Y(new Date(d,o+1,0),"2-digit","es-CL"),r({...n,start_date:g,end_date:b})):a?k(d.toString(),t):r({...n,start_date:g,end_date:b}),S(t)},k=(t,a)=>{L(t),a?F(a,t):r(t?{...n,start_date:`01-01-${t}`,end_date:`31-12-${t}`}:{...n,start_date:"",end_date:""})};return e.jsxs(e.Fragment,{children:[e.jsx(R,{mt:[5,5,5,0],mx:[3,3,3,0],w:["280px","280px","280px","21%"],children:e.jsx(B,{formatOptionLabel:D,options:$,isSearchable:!0,isClearable:!0,placeholder:"Select Blockchain",styles:U,onChange:t=>{t?(C(t.value),r({...n,chain:t.value})):(C(""),r({...n,chain:""}))}})}),e.jsx(R,{mt:[5,5,5,0],mx:[3,3,3,0],w:["280px","280px","280px","21%"],children:e.jsx(B,{formatOptionLabel:D,isSearchable:!0,isClearable:!0,options:z,placeholder:"Select Category",styles:h,onChange:t=>{t?(A(t.value),r({...n,category:t.value})):(A(""),r({...n,category:""}))}})}),e.jsx(R,{mt:[5,5,5,0],mx:[3,3,3,0],w:["280px","280px","280px","19%"],children:e.jsx(B,{formatOptionLabel:D,isSearchable:!0,isClearable:!0,options:q.map(t=>({value:t,label:t})),value:c?{value:te(c),label:te(c)}:null,placeholder:"Select Month",styles:h,onChange:t=>{F(t?t.value:"",f)}})}),e.jsx(R,{mt:[5,5,5,0],mx:[3,3,3,0],w:["280px","280px","280px","19%"],children:e.jsx(B,{formatOptionLabel:D,isSearchable:!0,isClearable:!0,options:P,placeholder:"Select Year",styles:h,value:f?{value:f,label:f}:null,onChange:t=>{k(t?t.value:"",c)}})}),e.jsx(R,{mt:[5,5,5,0],mx:[3,3,3,0],w:["280px","280px","280px","14%"],children:e.jsx(B,{formatOptionLabel:D,isSearchable:!0,isClearable:!0,defaultValue:H[0],options:H,placeholder:"Sort By",styles:h,onChange:t=>{t?(x(t.value),r({...n,sort_by:t.value})):(x(""),r({...n,sort_by:""}))}})})]})},Be=({overviewData:s})=>{const n=Q(),r=new URLSearchParams(n.search),l=r.get("month"),x=r.get("year"),W=new Date,j=l?((o,d)=>{const g=q.findIndex(N=>N.toLowerCase()===o.toLowerCase()),b=d||(g<=W.getMonth()?new Date().getFullYear():new Date().getFullYear()-1);return{sd:new Date(b,g,1),ed:new Date(b,g+1,0),year:b}})(l,x?Number(x):void 0):null,E=j?j.sd:x?new Date(Number(x),0,1):null,T=j?j?.ed:x?new Date(Number(x),11,31):null,[u,I]=i.useState(E&&T?{start_date:Y(E,"2-digit","es-CL"),end_date:Y(T,"2-digit","es-CL")}:{}),[C,_]=i.useState("-date"),[A,c]=i.useState(!0),[S,f]=i.useState(),[L,H]=i.useState(!1),[$,z]=i.useState(1),[p,v]=i.useState({pageNo:$,perPageCount:9}),[P,U]=i.useState(""),{data:h,refetch:F}=Re(p,u,C,P),k=()=>{h&&h.page&&(v({...p,totalPages:h.page.total_pages}),f(h.data),c(!1))};i.useEffect(()=>{k()},[h]),i.useEffect(()=>{let o;const d=async()=>{await new Promise(N=>{setTimeout(()=>{c(!0),F().finally(()=>c(!1))},500)})};return(()=>{clearTimeout(o),o=setTimeout(()=>{d()},400)})(),()=>clearTimeout(o)},[P]);const t=o=>{c(!0),z(o),v({...p,pageNo:o}),F()},a=()=>{c(!0),z(1),v({...p,pageNo:1}),F().finally(()=>k())};return e.jsxs(O,{w:["100%","100%","95%","90%"],borderRadius:15,p:5,maxW:"1800px",my:[5,5,5,10],background:" #FAFBFC ",display:"flex",flexDir:"column",alignItems:["center","center","center","flex-start"],justifyContent:"flex-start",children:[e.jsxs(w,{display:["none","none","none","flex"],spacing:0,ml:[4,4,4,0],justify:"center",w:"100%",children:[L?e.jsx(X,{isRequired:!0,placeholder:"Search ....",variant:"brand",size:"lg",px:10,height:50,borderTopRightRadius:[15,15,15,0],borderBottomRightRadius:[15,15,15,0],width:"90%",value:P,onChange:o=>{U(o.target.value)}}):e.jsx(ae,{overviewData:s,filters:u,setFilters:I,sortBy:C,setSortBy:_,refetchHacks:a}),e.jsx(m,{display:"flex",backgroundColor:"#FAFBFC",justifyContent:"center",alignItems:"center",width:"8%",height:"50px",border:"2px s
1olid #EDF2F7",borderRightRadius:15,onClick:()=>H(!L),children:L?e.jsx(V,{id:"ss-seaech-filter",fontSize:"2xl",variant:"unstyled",display:["flex"],children:e.jsx(Z,{as:K,color:"gray.300"})}):e.jsx(de,{color:"#B0B7C3"})})]}),e.jsxs(xe,{display:["flex","flex","flex","none"],alignItems:"center",mb:4,children:[e.jsx(X,{type:"text",variant:"brand",size:"lg"}),e.jsx(ue,{height:"48px",fontSize:"2xl",width:"fit-content",children:e.jsxs(w,{spacing:2,mr:2,children:[e.jsx(pe,{color:"gray.300"})," ",e.jsx(y,{color:"gray.300",children:" |"}),e.jsxs(he,{children:[e.jsx(fe,{children:e.jsx(V,{id:"ss-hack-filter",fontSize:"2xl",variant:"unstyled",display:["flex","flex","flex","flex","none"],children:e.jsx(Z,{as:K,color:"gray.300"})})}),e.jsx(me,{children:e.jsxs(ge,{w:"fit-content",children:[e.jsx(be,{}),e.jsx(je,{}),e.jsxs(Fe,{display:"flex",justifyContent:"flex-start",alignItems:"center",flexDir:"column",w:"fit-content",children:[e.jsx(m,{justify:"flex-start",alignItems:"center",mx:0,mt:7,borderRadius:10,w:"fit-content",height:"fit-content",flexDir:"column",backgroundColor:"#EDF2F7",pb:5,children:e.jsx(ae,{overviewData:s,filters:u,setFilters:I,sortBy:C,setSortBy:_,refetchHacks:a})}),e.jsx(V,{id:"ss-clear-filter",color:"#3300FF",my:5,textDecoration:"underline",variant:"link",display:["flex","flex","flex","flex","none"],children:"Clear Filters"})]})]})})]})]})})]}),S?e.jsxs(m,{w:"100%",mt:5,display:"flex",flexDir:["column","row","row"],alignItems:["flex-start","flex-start","flex-start","center"],justifyContent:"flex-start",flexWrap:["nowrap","wrap","wrap"],position:"relative",children:[S&&S.length?S.map((o,d)=>e.jsx(Le,{hackData:o},d)):e.jsxs(oe,{justifyContent:"center",alignItems:"center",spacing:10,w:"100%",h:"50vh",children:[e.jsx(ke,{size:200}),e.jsx(M,{fontSize:"md",children:"Oops! Seems the web3 hacks are camouflaged! ð¦ð Try different filters to uncover their secrets!"})]}),A&&e.jsx(m,{w:"100%",h:"100%",position:"absolute",top:0,left:0,alignItems:"center",justifyContent:"center",sx:{backdropFilter:"blur(2px)"},children:e.jsx(se,{})})]}):e.jsx(se,{width:"100%",height:"100vh"}),e.jsx(m,{w:"100%",alignItems:"center",justifyContent:"center",mt:10,mb:6,children:p.totalPages&&e.jsx(_e,{currentPage:p.pageNo,totalPages:p.totalPages,onPageChange:t})})]})},Ge=()=>{const{data:s}=ne(),n=Q();return i.useEffect(()=>{const l=new URLSearchParams(n.search).get("ref");l&&(localStorage.setItem("campaign_type",l),localStorage.setItem("campaign_id",l),sessionStorage.setItem("ref",l))},[]),e.jsxs(m,{as:"section",w:"100%",alignItems:"center",p:0,textAlign:["center","center"],flexDir:"column",children:[e.jsx(re,{overviewData:s?.data}),e.jsxs(O,{display:"flex",flexDir:"column",alignItems:"center",justifyContent:"flex-start",w:["90%","90%","90%","70%"],px:[4,4,7,10],mt:"-60px",mb:4,py:[0,0,0,10],borderRadius:20,background:"#FFFFFF",children:[e.jsxs(M,{as:"h1",fontSize:"3xl",my:5,children:["Explore through all the hacks"," ",e.jsx(O,{py:1.5,borderBottom:"3px solid #3300FF",as:"span",color:"#3300FF",children:"since 2011"})]}),e.jsx(y,{color:"subtle",fontSize:["lg","lg","xl"],mb:4,mt:2,children:"Delve into a comprehensive database of blockchain breaches, providing insights into the evolution of cybersecurity challenges and the lessons learned from each incident since 2011."})]}),e.jsx(Be,{overviewData:s?.data})]})};export{Ge as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.