1import{j as e}from"./vendor-dotlottie-CKWLB76h.js";import{a as s,W as X}from"./vendor-react-CCzXVbVA.js";import{A as N}from"./index.esm-C221wYgj.js";import{G as Z,A as w,c as y,d as M,e as J,g as z,M as Q}from"./app-ZGxtfi_0.js";import{F as ee}from"./index.esm-Ds02zZ7m.js";import{A as te}from"./AddEmailModal-DFRV1IeX.js";import{f as L,ab as T,g as R,B as I,M as oe,a as re,b as se,c as ie,d as ae,e as ne,V as P,O as le,k as ce,j as W,T as f,ac as V,ad as de,ae as ue,F as O,af as pe,ag as he,I as me}from"./vendor-chakra-z2eW50qa.js";import"./vendor-analytics-kxESroPO.js";import"./vendor-victory-2uYGyQN6.js";import"./vendor-query-Cq2FYR_1.js";import"./vendor-monaco-CiJro7ev.js";import"./TurnstileComponent-DGwBZ16v.js";function ge(t){return Z({attr:{version:"1.1",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M10.404 5.11l-1.015-1.014-5.075 5.074c-0.841 0.841-0.841 2.204 0 3.044s2.204 0.841 3.045 0l6.090-6.089c1.402-1.401 1.402-3.673 0-5.074s-3.674-1.402-5.075 0l-6.394 6.393c-0.005 0.005-0.010 0.009-0.014 0.013-1.955 1.955-1.955 5.123 0 7.077s5.123 1.954 7.078 0c0.004-0.004 0.008-0.009 0.013-0.014l0.001 0.001 4.365-4.364-1.015-1.014-4.365 4.363c-0.005 0.004-0.009 0.009-0.013 0.013-1.392 1.392-3.656 1.392-5.048 0s-1.392-3.655 0-5.047c0.005-0.005 0.009-0.009 0.014-0.013l-0.001-0.001 6.395-6.393c0.839-0.84 2.205-0.84 3.045 0s0.839 2.205 0 3.044l-6.090 6.089c-0.28 0.28-0.735 0.28-1.015 0s-0.28-0.735 0-1.014l5.075-5.075z"}}]})(t)}const F=5,x={fixedButton:{position:"fixed",top:"200px",right:"-52px",fontSize:"12px",borderRadius:"unset",borderTopEndRadius:"5px",borderTopStartRadius:"5px",transform:"rotate(-90deg)",height:"25px",color:"#3300FF",bg:"#e0d9fe",boxShadow:"md",zIndex:999},modalContent:{position:{base:"relative",md:"absolute"},right:{base:"auto",md:"20px"},top:{base:"auto",md:"-40px"},left:{base:"0%",md:"auto"},transform:{base:"translateX(-50%)",md:"none"},maxWidth:"587px",borderRadius:"15px"},promotionalBanner:{bg:"white",borderRadius:"14px",p:"24px 24px",borderWidth:"1px",borderColor:"gray.200",boxShadow:"sm",bgGradient:"linear(135deg, #020820 0%, #001102 100%)"},inputField:{bg:"gray.50",border:"1px solid",borderColor:"gray.200",borderRadius:"15px",_focus:{borderColor:"blue.500",bg:"white"}},textareaInput:{p:"15px 33px",height:"111px",resize:"vertical"},submitButton:{background:"#F4F1FF",color:"#3E15F4",borderRadius:"8px",maxWidth:"231px",fontSize:"14px",fontWeight:500,marginTop:"30px",width:"full"},fileList:{maxHeight:"106px",overflow:"scroll"},fileItem:{p:"6px 10px",bg:"gray.50",borderRadius:"md",border:"unset",borderColor:"gray.200"}},xe=t=>s.useMemo(()=>{const o={};t.description.trim()||(o.description="Bug description cannot be empty");const i=!o.description&&t.description.trim().length>0;return{errors:o,isValid:i}},[t.description]),fe=async(t,o)=>{try{const{status:i}=await w.put(o,t,{headers:{"Content-Type":t.type}});return i===200}catch(i){return console.error("Error uploading to S3:",i),!1}},be=()=>{const[t,o]=s.useState(!1),i=ce();return{submitForm:s.useCallback(async n=>{o(!0);try{const l=[];for(const m of n.screenshots)try{const g=await J(m.name,m,!0);if(await fe(m,g))l.push(g);else throw new Error(`Failed to upload file: ${m.name}`)}catch(g){throw console.error("Error uploading file:",g),g}const u=window.location.href;if((await w.post(y.API_CREATE_BUG_REPORT_TICKET,{summary:"Bug Report",description:n.description,image_urls:l,current_url:u},{withCredentials:!0})).data.status==="success")return i({title:"Thank you! Report Submitted.",description:"Follow up in your email.",status:"success",duration:5e3,isClosable:!0}),{success:!0};throw new Error("Failed to create support ticket")}catch(l){return console.error("Error submitting bug report:",l),i({title:"Error",description:"Failed to submit bug report. Please try again.",status:"error",duration:5e3,isClosable:!0}),{success:!1}}finally{o(!1)}},[i]),isSubmitting:t}},Ce=()=>e.jsxs(I,{display:"flex",alignItems:"center",sx:x.promotionalBanner,children:[e.jsx(W,{src:`${z()}report/bug_report_card.svg`,alt:"Bug Report",height:"146px",width:"auto",display:{base:"none",md:"block"},mr:4}),e.jsxs(I,{flex:"1",display:"flex",flexDirection:"column",gap:4,children:[e.jsxs(f,{fontWeight:"bold",fontSize:"24px",color:"white",lineHeight:"1.2",children:["Write a Bug Report",e.jsx("br",{}),"and"," ",e.jsx(f,{as:"span",color:"#00FF88",children:"Win LOCs"})]}),e.jsx(f,{fontSize:"12px",color:"rgba(255, 255, 255, 0.8)",maxW:{base
1:"full",md:"400px"},lineHeight:"1.6",children:"Report issues, earn rewards. Help us squash bugs and build a more secure Web3!"}),e.jsx(R,{bg:"rgba(255, 255, 255, 0.1)",color:"white",border:"unset",fontSize:"14px",fontWeight:600,rightIcon:e.jsx(Q,{}),alignSelf:{base:"center",md:"flex-start"},w:"fit-content",onClick:()=>window.open("https://docs.solidityscan.com/bugreport/","_blank"),_hover:{bg:"rgba(255, 255, 255, 0.15)",transform:"translateY(-1px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)"},_active:{transform:"translateY(0)"},transition:"all 0.2s",sx:{height:"fitContent",padding:"6px 30px",borderRadius:"unset"},children:"Know More"})]})]}),Se=({value:t,onChange:o,onBlur:i,error:d,touched:n})=>e.jsxs(V,{isRequired:!0,isInvalid:n&&!!d,children:[e.jsx(de,{fontWeight:"500",fontSize:"14px",children:"Bug Description"}),e.jsx(ue,{placeholder:"Type your description here...",value:t,onChange:l=>o(l.target.value),onBlur:i,rows:6,borderColor:n&&d?"red.500":"gray.200",_focus:{borderColor:n&&d?"red.500":"blue.500",bg:"white"},sx:{...x.inputField,...x.textareaInput}}),n&&d&&e.jsx(f,{color:"red.500",fontSize:"sm",mt:1,ml:1,children:d})]}),we=({screenshots:t,onFilesChange:o,onRemoveFile:i})=>{const d=s.useCallback(u=>{if(u.target.files){const h=Array.from(u.target.files),m=[...t,...h].slice(0,F);o(m)}},[t,o]),n=X.useRef(null),l=s.useCallback(()=>{n.current&&t.length<F&&n.current.click()},[t.length]);return e.jsxs(V,{children:[e.jsxs(O,{align:"center",mb:3,mt:3,cursor:t.length>=F?"not-allowed":"pointer",onClick:l,children:[e.jsx(ge,{color:"#3300FF",style:{marginRight:"6px"}}),e.jsx(f,{fontWeight:"400",fontSize:"14px",color:"#3300FF",children:"Attach Image"}),e.jsx(pe,{ref:n,type:"file",accept:"image/*",multiple:!0,onChange:d,display:"none",disabled:t.length>=F})]}),t.length>0&&e.jsx(P,{mt:4,spacing:3,align:"stretch",sx:x.fileList,children:t.map((u,h)=>e.jsxs(O,{align:"center",sx:x.fileItem,children:[e.jsx(W,{src:`${z()}report/image-icon.svg`,mr:"11px"}),e.jsx(I,{flex:1,children:e.jsx(f,{fontSize:"14px",fontWeight:"500",color:"gray.700",isTruncated:!0,children:u.name})}),e.jsxs(f,{fontSize:"14px",fontWeight:"500",color:"gray.500",children:[Math.round(u.size/1024)," KB"]}),e.jsx(he,{icon:e.jsx(me,{viewBox:"0 0 24 24",boxSize:4,children:e.jsx("path",{fill:"currentColor",d:"M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"})}),size:"sm",variant:"ghost",colorScheme:"red","aria-label":"Remove file",onClick:()=>i(h),zIndex:2})]},`${u.name}-${h}`))})]})},je=()=>{const t=L(),o=L(),i=T("white","gray.800"),d=T("blue.600","blue.400"),[n,l]=s.useState(!1),[u,h]=s.useState(!1),[m,g]=s.useState(!1),[b,v]=s.useState({});s.useEffect(()=>{(async()=>{const c=M.isUserAuthenticated();if(l(c),c)try{const{data:a}=await w.get(y.API_PROFILE);v(a);const p=!!(a.email&&a.email.trim()!=="");h(p);const _=a.email_verified===!0;g(_),localStorage.setItem("email_available",p?"true":"false"),localStorage.setItem("email_verified",_?"true":"false")}catch(a){console.error("Error fetching profile data:",a)}})()},[]);const H=()=>{if(m){t.onOpen();return}b&&Object.keys(b).length>0?o.onOpen():w.get(y.API_PROFILE).then(({data:r})=>{v(r),h(!!(r.email&&r.email.trim()!=="")),o.onOpen()}).catch(r=>{console.error("Error fetching profile data:",r)})},[S,E]=s.useState({description:"",screenshots:[]}),[U,A]=s.useState({description:!1}),{errors:D,isValid:C}=xe(S),{submitForm:k,isSubmitting:$}=be(),B=s.useCallback((r,c)=>{E(a=>({...a,[r]:c}))},[]),G=s.useCallback(r=>{A(c=>({...c,[r]:!0}))},[]),Y=s.useCallback(r=>{E(c=>({...c,screenshots:c.screenshots.filter((a,p)=>p!==r)}))},[]),j=s.useCallback(()=>{E(r=>({...r,description:"",screenshots:[]})),A({description:!1})},[]),K=s.useCallback(async()=>{if(!C)return;(await k(S)).success&&(j(),t.onClose())},[C,k,S,j,t]),q=s.useCallback(()=>{j(),t.onClose()},[j,t]);return s.useEffect(()=>{const r=()=>{const a=localStorage.getItem("email_available")==="true",p=localStorage.getItem("email_verified")==="true";h(a),g(p),p&&o.isOpen&&(o.onClose(),t.onOpen())};let c=null;return o.isOpen&&!m&&(c=setInterval(()=>{w.get(y.API_PROFILE).then(({data:a})=>{const p=!!(a.email&&a.email.trim()!=="");p!==u&&(h(p),localStorage.setItem("email_available",p?"true":"false"),v(a)),a.email_verified&&(g(!0),localStorage.setItem("email_verified","true"),o.onClose(),t.onOpen())}).catch(a=>{console.error("Error checking verification status:",a)})},5e3)),window.addEventListener("storage",r),()=>{window.removeEventListener("storage",r),c&&clearInterval(c)}},[t,o,m,u]),e.jsxs(e.Fragment,{children:[n&&e.jsx(R,{leftIcon:e.jsx(I,{as:N,sx:{"& path:nth-child(2)":{fill:"white",stroke:"white"}}}
1),colorScheme:"blue",color:i,opacity:.5,_hover:{bg:d,boxShadow:"lg",opacity:1},onClick:H,sx:x.fixedButton,children:"| Â Report Bug"}),b&&Object.keys(b).length>0&&e.jsx(te,{isOpen:o.isOpen,onClose:o.onClose,description:"Verify your email to submit bug reports",profileData:b}),e.jsxs(oe,{isOpen:t.isOpen,onClose:q,size:"xl",children:[e.jsx(re,{}),e.jsxs(se,{sx:x.modalContent,children:[e.jsx(ie,{children:"Report a Bug"}),e.jsx(ae,{}),e.jsx(ne,{padding:"0px 20px",children:e.jsxs(P,{spacing:4,align:"stretch",children:[e.jsx(Ce,{}),e.jsx(Se,{value:S.description,onChange:r=>B("description",r),onBlur:()=>G("description"),error:D.description,touched:U.description}),e.jsx(we,{screenshots:S.screenshots,onFilesChange:r=>B("screenshots",r),onRemoveFile:Y})]})}),e.jsx(le,{justifyContent:"flex-start",paddingTop:"unset",children:e.jsx(R,{colorScheme:"blue",onClick:K,isLoading:$,loadingText:"Submitting...",isDisabled:!C,opacity:C?1:.6,cursor:C?"pointer":"not-allowed",_hover:C?{bg:"#E0D9FF",transform:"translateY(-1px)",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)"}:{},leftIcon:e.jsx(ee,{}),sx:x.submitButton,children:"Confirm and Submit"})})]})]})]})},Oe=()=>{const[t,o]=s.useState(!1),[i,d]=s.useState(!1);return s.useEffect(()=>{i||(o(M.isUserAuthenticated()),d(!0));const n=l=>{l.key==="authenticated"&&l.newValue===null&&o(!1)};return window.addEventListener("storage",n),()=>window.removeEventListener("storage",n)},[i]),t?e.jsx(je,{}):null};export{Oe 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.