1"use strict";(self.webpackChunkd4builds=self.webpackChunkd4builds||[]).push([[8468],{2929:function(e,l,t){t.r(l),t.d(l,{default:function(){return h}});var s=t(4506),a=(t(6910),t(6540)),n=t(8058),o=t(6340),r=t(2269),i=t(7797),c=t(5200),u=t(6676),d=t(6080),m=t(899),b=t(3500),f=t(6580);function h(e){var l,t;let h=e.pageContext.buildsData;const p=(0,a.useState)({skills:[],skillsPTR:[],skillTree:[],skillTreePTR:[]}),v=p[0],S=p[1];(0,a.useEffect)(()=>{Promise.all([fetch("/data/skills.json").then(e=>e.text()).then(n.H),fetch("/data/skills-ptr.json").then(e=>e.text()).then(n.H),fetch("/data/skill-trees.json").then(e=>e.text()).then(n.H),fetch("/data/skill-trees-ptr.json").then(e=>e.text()).then(n.H)]).then(e=>{let l=e[0],t=e[1],s=e[2],a=e[3];S({skills:l,skillsPTR:t,skillTree:s,skillTreePTR:a})}).catch(e=>console.error("Failed to load skills/skillTree data",e))},[]);const k=v.skills,w=void 0===k?[]:k,y=v.skillsPTR,_=void 0===y?[]:y,g=v.skillTree,E=void 0===g?[]:g,N=v.skillTreePTR,T=void 0===N?[]:N,C="undefined"!=typeof window&&!0===(null===(l=window.electron)||void 0===l?void 0:l.isElectron);(0,f.u)(C,[{type:"corner_ad_video"},{type:"left_rail"},{type:"right_rail"},{type:"bottom_rail"}],"ROS");(0,b.l)();const L="undefined"!=typeof window?window.location.pathname.split("/")[2]:null,O=(0,i.P8)(),j=O.currentUser,A=O.profileData,I=(0,a.useState)(null),D=I[0],B=I[1],P=(0,a.useState)([]),R=P[0],U=P[1],x=(0,a.useState)([]),H=x[0],F=x[1],J=(0,a.useState)(""),G=J[0],M=J[1],V=(0,a.useState)(()=>{try{return localStorage.getItem("selectedClass")||""}catch(e){return""}}),Y=V[0],q=V[1],z=(0,a.useState)(0),K=z[0],Q=z[1],W=(0,a.useState)(!1),X=W[0],Z=W[1],$=(0,a.useState)(50),ee=$[0],le=$[1],te=(0,a.useState)(!1),se=te[0],ae=te[1],ne=(0,a.useState)("undefined"!=typeof window&&(null===(t=window)||void 0===t?void 0:t.localStorage.getItem("myBuildsSeason"))||"All Seasons"),oe=ne[0],re=ne[1],ie=(0,a.useRef)(!0),ce=()=>{const e=window.pageYOffset;Q(e)};(0,a.useLayoutEffect)(()=>{localStorage.getItem("myBuildsSeason")&&re(localStorage.getItem("myBuildsSeason"))},[]),(0,a.useEffect)(()=>{if(!L)return;(async()=>{try{const e=(0,c.H9)(c.db,"users",L,"profileInfo","socials"),l=await(0,c.x7)(e);l.exists()?B(l.data()):B(null)}catch(e){console.log(e),B(null)}})()},[L]),(0,a.useEffect)(()=>{if(L)Z(!0),(async()=>{const e=(0,c.P)((0,c.rJ)(c.db,"users/"+L+"/builds")),l=await(0,c.GG)(e);let t=[];l.forEach(e=>{let l={};l[e.id]=e.data(),t.push(l)});let s=t.sort((e,l)=>{const t=Object.values(e)[0].lastUpdatedSort||-1/0;return(Object.values(l)[0].lastUpdatedSort||-1/0)-t});U(s),de(s),Z(!1)})();else{let e=[];if(localStorage.getItem("builds"))if(0===JSON.parse(localStorage.getItem("builds")).length);else{let l=JSON.parse(localStorage.getItem("builds"));Object.keys(l).map(t=>{let s=l[t];return e.push({[t]:s}),null})}let l=e.sort((e,l)=>{const t=Object.values(e)[0].lastUpdatedSort||-1/0;return(Object.values(l)[0].lastUpdatedSort||-1/0)-t});U(l),de(l)}return window.addEventListener("scroll",ce,{passive:!0}),()=>{window.removeEventListener("scroll",ce)}},[L]),(0,a.useEffect)(()=>{ie.current?ie.current=!1:de()},[G,Y,oe]),(0,a.useEffect)(()=>{le(50)},[G,Y,oe,L]);const ue=async(e,l)=>{ae(!l&&!se),e&&(localStorage.setItem("myBuildsSeason",e),re(e))},de=e=>{let l=e||R;const t=l.filter(e=>{var l;let t=Object.values(e)[0];const s=t.name+" "+t.class,a=null==t||null===(l=t.skills)||void 0===l?void 0:l.filter(e=>null==e?void 0:e.toLowerCase().includes(G.toLowerCase()));return("All Seasons"===oe||(t.season?t.season===parseInt(oe.replace("Season ",""),10):"Eternal"===oe))&&(!Y||Y===(null==t?void 0:t.class))&&(s.toLowerCase().includes(G.toLowerCase())||(null==a?void 0:a.length))});Y.length||""!==G||"All Seasons"!==oe?F(t):F(l)},me=!!L&&(null==j?void 0:j.uid)===L,be=!!A&&Object.keys(A).length>0,fe=me&&be?A:D,he=(null==fe?void 0:fe.displayName)||"Custom User",pe=L?he+"'s Builds":"My Builds",ve=me&&!(null!=fe&&fe.displayName),Se=!!L&&!!(null!=fe&&fe.displayName||null!=fe&&fe.youtubeLink||null!=fe&&fe.twitchLink),ke=L?Se?a.createElement("div",{className:"builder__socials builder__socials--account-builds"},a.createElement("div",{className:"verified__user"},null!=fe&&fe.youtubeLink?a.createElement("a",{className:"verified__profile yt",target:"_blank",rel:"noopener noreferrer",href:fe.youtubeLink},a.createElement("img",{className:"verified__icon",src:"https://sunderarmor.com/DIABLO4/UI/youtube_icon.svg",alt:"YouTube Logo"})):null,null!=fe&&fe.twitchLink?a.createElement("a",{className:"verified__profile",target:"_blank",rel:"noopener noreferrer",href:fe.twitchLink},a.createElement("img",{className:"verified__icon",src:"https://sunderarmor.com/DIABLO4/UI/twitch_icon.svg",alt:"Twitch Logo"})):null)):a.createElement("div",{className:"builder__socials--account-builds builder__socials--skeleton"}):null,we=H.slice(0,ee),ye=H.length>ee,_e=()=>{le(e=>e+50)};let ge=null;return ge=X?a.createElement(a.Fragment,null,(0,s.A)(Array(14)).map((e,l)=>a.createElement("div",{key:l,className:"build--skeleton"}))):H.length>0?a.createElement(a.Fragment,null,we.map(e=>a.createElement(m.A,{key:Object.keys(e)[0],buildId:Object.keys(e)[0],build:Object.values(e)[0],skills:oe<15?w:_,skillTree:oe<15?E:T,buildName:Object.values(e)[0].name,buildsData:h,id:L||null})),ye&&a.createElement("button",{className:"builds__load-more",onClick:_e},"Load More Builds")):a.createElement("div",{className:"builds__create sm"},a.createElement("div",{className:"builds__create__title"},L?"This account doesn't have any builds yet!":"No Builds Found.")),a.createElement(o.A,{isElectron:C},a.createElement(r.A,{title:"Diablo 4 "+pe,description:L?"All Diablo 4 builds from "+he+".":"All of your D4 builds in one place."}),C?"":a.createElement(u.A,{searchTerm:G,setSearchTerm:M,selectedClass:Y,setSelectedClass:q,placeholder:"Search by Build or Skill...",title:pe,showDropdown:se,setShowDropdown:ue,buttonValue:oe,isElectron:C,showDisplayNameCta:ve}),ke,a.createElement(d.A,{selectedClass:Y,setSelectedClass:q,scrollPosition:K,isElectron:C}),a.createElement("section",{className:"builds"},a.createElement("div",{className:"general__wrapper"},C?a.createElement(u.A,{searchTerm:G,setSearchTerm:M,selectedClass:Y,setSelectedClass:q,placeholder:"Search by Build or Skill...",title:pe,showDropdown:se,setShowDropdown:ue,buttonValue:oe,isElectron:C,showDisplayNameCta:ve}):"",ge)))}}}]);
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.