1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5776],{55135:function(e,t,n){"use strict";var r=n(4730),s=n(85893),i=["children","color","title"];t.Z=function(e){var t=e.children,n=e.color,a=void 0===n?"red":n,l=e.title,o=void 0===l?"Oh no!":l;(0,r.Z)(e,i);return(0,s.jsxs)("div",{className:"bg-".concat(a,"-900 border-l-4 border-").concat(a,"-500 text-").concat(a,"-700 p-4 mt-5"),role:"alert",children:[(0,s.jsx)("p",{className:"font-bold",children:o}),(0,s.jsx)("p",{children:t})]})}},56348:function(e,t,n){"use strict";var r=n(59499),s=n(4730),i=(n(67294),n(86010)),a=n(37437),l=n.n(a),o=n(85893),c=["children","variant","iconOnly","icon","className"];function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){(0,r.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}t.Z=function(e){var t=e.children,n=e.variant,a=void 0===n?"primary":n,d=e.iconOnly,m=void 0!==d&&d,h=e.icon,x=void 0===h?null:h,p=e.className,f=void 0===p?"":p,v=(0,s.Z)(e,c);return(0,o.jsxs)("button",u(u({},v),{},{className:(0,i.Z)(l().button,l()[a],(0,r.Z)({},l().disabled,v.disabled))+" ".concat(f),children:[m?x:null,!m&&t]}))}},84256:function(e,t,n){"use strict";n(67294);var r=n(9008),s=n.n(r),i=n(41336),a=n(78186),l=n(83047),o=n(85893);t.Z=function(e){var t=e.title,n=void 0===t?null:t,r=e.description,c=void 0===r?"Get recognized and validate your skills and achievements with digital badges that work on GitHub, GitLab, and social media platforms. Holopin makes it easy to create, issue, and collect badges for the things you do best.":r,d=e.children,u=e.navbar,m=void 0===u||u,h=e.contentStyle,x=e.contentClassName,p=e.noVerify,f=void 0!==p&&p;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s(),{children:[(0,o.jsx)("title",{children:n?"".concat(n," | Holopin"):"Holopin"}),(0,o.jsx)("meta",{name:"description",content:c}),(0,o.jsx)("meta",{name:"keywords",content:"digital badges, skills, achievements, GitHub, GitLab, social media, recognition, validation, open badges"}),(0,o.jsx)("meta",{name:"author",content:"Holopin"}),(0,o.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),(0,o.jsx)("link",{rel:"canonical",href:"https://www.holopin.io"}),(0,o.jsx)("link",{rel:"icon",href:"/favicon.ico"})]}),(0,o.jsxs)("div",{className:"relative flex flex-col items-stretch min-h-screen bg-neutral-850",style:{zIndex:0,background:"transparent"},children:[m&&(0,o.jsx)(a.Z,{}),!f&&(0,o.jsx)(l.Z,{}),(0,o.jsx)("div",{style:h,className:"".concat(x||""," w-full min-h-screen p-5 mx-auto mt-20 lg:py-20 md:px-10 lg:px-40 max-w-screen-2xl"),children:d})]}),(0,o.jsx)("div",{className:"w-full mt-60",children:(0,o.jsx)(i.Z,{})})]})}},96916:function(e,t,n){"use strict";var r=n(9008),s=n.n(r),i=n(85893);t.Z=function(e){var t=e.meta;return(0,i.jsxs)(s(),{children:[(0,i.jsx)("meta",{name:"twitter:card",content:"summary"},"twitter:card"),(0,i.jsx)("meta",{name:"twitter:site",content:"@holopin_"},"twitter:site"),(0,i.jsx)("meta",{name:"twitter:title",content:null===t||void 0===t?void 0:t.title},"twitter:title"),(0,i.jsx)("meta",{name:"twitter:description",content:null===t||void 0===t?void 0:t.description},"twitter:description"),(0,i.jsx)("meta",{name:"twitter:image",content:null===t||void 0===t?void 0:t.imageUrl},"twitter:image"),(0,i.jsx)("meta",{property:"og:site_name",content:"Holopin"},"og:site_name"),(0,i.jsx)("meta",{property:"og:title",content:null===t||void 0===t?void 0:t.title},"og:title"),(0,i.jsx)("meta",{property:"og:url",content:null===t||void 0===t?void 0:t.url},"og:url"),(0,i.jsx)("meta",{property:"og:image",content:null===t||void 0===t?void 0:t.imageUrl},"og:image"),(0,i.jsx)("meta",{property:"og:description",content:null===t||void 0===t?void 0:t.description},"og:description"),(0,i.jsx)("meta",{property:"og:type",content:"sticker"},"og:type")]})}},83047:function(e,t,n){"use strict";var r=n(50029),s=n(87794),i=n.n(s),a=n(67294),l=n(33299),o=n(11163),c=n(85893);t.Z=function(){var e,t=(0,o.useRouter)(),n=(0,l.useSession)(),s=n.data,d=(n.status,(0,a.useState)("init")),u=d[0],m=d[1];if(t.query.verified)return(0,c.jsx)("div",{className:"w-full h-12 px-2 mt-16 text-center bg-blue-300 sm:h-8",children:(0,c.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,c.jsx)("p",{className:"text-xs font-semibold text-black sm:text-sm",children:"Thanks! Your email has been verified."})})});var h=null===s||void 0===s||null===(e=s.user)||void 0===e?void 0:e.emailVerified,x=function(){var e=(0,r.Z)(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return m("loading"),e.next=3,fetch("/api/auth/verify",{method:"POST"});case 3:if(200!==e.sent.status){e.next=7;break}return m("success"),e.abrupt("return");case 7:m("error");case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,c.jsx)(c.Fragment,{children:!1===h&&(null===s||void 0===s?void 0:s.user)&&(0,c.jsx)("div",{className:"w-full h-12 px-2 mt-16 text-center bg-blue-300 sm:h-8",children:(0,c.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,c.jsxs)("p",{className:"text-xs font-semibold text-black sm:text-sm",children:["Please verify your email address."," ","init"==u&&(0,c.jsx)("a",{className:"underline cursor-pointer",onClick:x,children:"Re-send verification email"}),"loading"==u&&(0,c.jsx)("span",{className:"text-xs font-semibold text-black sm:text-sm",children:"Sending..."}),"success"==u&&(0,c.jsx)("span",{className:"text-xs font-semibold text-black sm:text-sm",children:"Verification email sent!"}),"error"==u&&(0,c.jsx)("span",{className:"text-xs font-semibold text-black sm:text-sm",children:"Error sending verification email. Please try again."})]})})})})}},10148:function(e,t,n){"use strict";n.d(t,{R:function(){return s}});var r=n(34155),s=function(){return r.env.NEXT_PUBLIC_SITE_URL?r.env.NEXT_PUBLIC_SITE_URL:"https://".concat("www.holopin.io")}},17175:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return ve},default:function(){return be}});var r=n(67294),s=n(84256),i=n(50029),a=n(87794),l=n.n(a),o=n(49808),c=n(33299),d=n(41664),u=n.n(d),m=n(52091),h=n(59499),x=n(27812),p=n(25675),f=n.n(p),v=n(11358),b=n.n(v),g=n(85893);function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
1t%2?j(Object(n),!0).forEach((function(t){(0,h.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var y=function(e){var t=e.stickers,n=void 0===t?[]:t,s=e.className,i=void 0===s?"":s,a=e.evolvingStickers,l=void 0===a?[]:a,o=e.showPagination,c=void 0===o||o,d=(0,r.useState)(0),m=d[0],h=d[1],p=(0,r.useState)(12)[0],v=[].concat((0,x.Z)(n.map((function(e){return w(w({},e),{},{type:"sticker"})}))),(0,x.Z)(l.map((function(e){return w(w({},e),{},{type:"evolving"})})))),j=function(e){var t,n;switch(e.type){case"sticker":return null===(t=e.UserSticker)||void 0===t?void 0:t[0];case"evolving":return null===(n=e.UserEvolvingSticker)||void 0===n?void 0:n[0]}},y=function(e,t){switch(e){case"sticker":return"/userbadge/".concat(t);case"evolving":return"/holobytebadge/".concat(t)}},N=function(e,t){switch(e){case"sticker":return"/sticker/".concat(t);case"evolving":return"/sticker/evolving/".concat(t)}};return(0,g.jsxs)(g.Fragment,{children:[v&&v.length>0&&(0,g.jsx)("div",{className:" ".concat(i||"grid grid-cols-1 gap-y-10 sm:grid-cols-2 gap-x-6 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8"),children:v.slice(m*p,m*p+p).map((function(e){var t,n,r,s,i;return(0,g.jsxs)("div",{role:"group",children:[(0,g.jsx)("div",{className:"evolving"===e.type?"w-full p-3 rounded-md aspect-w-1 aspect-h-1 xl:aspect-w-7 xl:aspect-h-8 bg-gradient-to-br from-blue-400 to-green-400":"w-full p-3 rounded-md aspect-w-1 aspect-h-1 xl:aspect-w-7 xl:aspect-h-8 bg-neutral-800",children:null!=(null===(t=j(e))||void 0===t?void 0:t.id)?(0,g.jsx)(u(),{href:y(e.type,"[badge]"),as:y(e.type,null===(n=j(e))||void 0===n?void 0:n.id),children:(0,g.jsx)("a",{children:(0,g.jsx)("div",{className:"transition-transform ease-in-out hover:scale-105 hover:cursor-pointer",children:(0,g.jsx)(f(),{src:(null===(r=j(e))||void 0===r?void 0:r.image)||e.image,width:"90%",height:"90%",layout:"responsive",objectFit:"contain",alt:e.name})})})}):(0,g.jsx)(u(),{href:N(e.type,"[id]"),as:N(e.type,e.id),children:(0,g.jsx)("a",{children:(0,g.jsx)("div",{className:"transition-transform ease-in-out hover:scale-105 hover:cursor-pointer",children:(0,g.jsx)(f(),{src:e.image,width:"90%",height:"90%",layout:"responsive",objectFit:"contain",alt:e.name})})})})}),(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)("div",{className:"mt-2 font-bold text-white sticker-name",children:e.name}),(0,g.jsx)("div",{className:"inline mt-2 text-sm text-neutral-400",children:null!==(s=null===(i=e.organization)||void 0===i?void 0:i.name)&&void 0!==s?s:""}),(0,g.jsxs)("div",{className:"flex flex-wrap gap-x-1",children:["undefined"!==typeof e.listed&&!1===e.listed&&(0,g.jsx)("div",{className:"px-2 mt-1 text-xs border rounded-lg text-neutral-400 border-neutral-400 tag w-fit",children:"Unlisted"}),"evolving"===e.type?(0,g.jsx)("div",{className:"px-2 mt-1 text-xs text-blue-400 border border-blue-400 rounded-lg tag w-fit",children:"Evolving"}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"px-2 mt-1 text-xs text-pink-400 border border-pink-400 rounded-lg tag w-fit",children:"Limited"}),(0,g.jsx)("div",{className:"px-2 mt-1 text-xs text-green-300 border border-green-300 rounded-lg tag w-fit",children:"New"})]})]})]})]},e.id)}))}),c&&(0,g.jsx)("div",{className:"flex justify-center mt-5",children:(0,g.jsx)(b(),{previousLabel:"<",nextLabel:">",pageLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-transparent border border-neutral-700 text-white hover:text-black hover:bg-neutral-400 hover:border-neutral-400",previousLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-green-300 text-black hover:text-green-300 hover:bg-neutral-700",nextLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-green-300 text-black hover:text-green-300 hover:bg-neutral-700",breakLabel:"...",breakClassName:"font-semibold text-sm py-1 px-4 roun
1ded-md",marginPagesDisplayed:1,pageRangeDisplayed:1,activeLinkClassName:"text-black font-semibold bg-white",className:"h-auto grid grid-flow-col gap-x-2",onPageChange:function(e){var t=e.selected;h(t)},pageCount:Math.ceil(v.length/p),renderOnZeroPageCount:null})})]})},N=function(e){var t=e.organization,n=(0,c.useSession)(),s=(n.data,n.status,(0,r.useState)(!0)),a=(s[0],s[1]),d=(0,r.useState)([]),h=d[0],x=d[1],p=(0,r.useState)([]),f=p[0],v=p[1];return(0,r.useEffect)((function(){var e=!0===t.self?new URL("/api/auth/organization/stickers",window.location.origin):new URL("/api/stickers",window.location.origin);e.searchParams.set("organization",null===t||void 0===t?void 0:t.username);var n=!0===t.self?new URL("/api/auth/organization/evolvingstickers",window.location.origin):new URL("/api/evolvingstickers",window.location.origin);n.searchParams.set("organization",null===t||void 0===t?void 0:t.username);var r=function(){var e=(0,i.Z)(l().mark((function e(t){var n,r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(!0),e.next=3,fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=e.sent,e.next=6,n.json();case 6:r=e.sent,x(r.data.stickers),a(!1);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),s=function(){var e=(0,i.Z)(l().mark((function e(t){var n,r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a(!0),e.next=3,fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=e.sent,e.next=6,n.json();case 6:r=e.sent,v(r.data.stickers),a(!1);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();r(e),s(n)}),[t]),(0,g.jsxs)(o.O.Group,{defaultIndex:0,children:[(0,g.jsxs)(o.O.List,{className:"my-8 text-lg text-gray-600 border-b-2 border-b-black",children:[(0,g.jsx)(o.O,{className:function(e){return e.selected?"text-white text-left w-1/3 md:w-1/6 border-b border-b-green-300 mr-3 pb-2":"text-left w-1/3 md:w-1/6 mr-3 pb-2"},children:"Badges"}),(0,g.jsxs)(o.O,{className:function(e){return e.selected?"text-white text-left w-1/3 md:w-1/6 border-b border-b-green-300 mr-3 pb-2":"text-left w-1/3 md:w-1/6 mr-3 pb-2"},children:["Series"," ",(0,g.jsx)("span",{className:"inline px-1 ml-1 text-xs text-green-500 border border-green-700 py-0.2 rounded-md",children:"New"})]}),(0,g.jsx)(o.O,{className:function(e){return e.selected?"text-white text-left w-1/3 md:w-1/6 border-b border-b-green-300 mr-3":"text-left w-1/3 md:w-1/6 mr-3"},children:"Collections"})]}),(0,g.jsxs)(o.O.Panels,{children:[(0,g.jsx)(o.O.Panel,{children:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"flex items-center justify-center mb-2 text-sm",children:(0,g.jsxs)("div",{className:"max-w-2xl px-6 py-2 text-center shadow-lg bg-neutral-800 rounded-md",children:[(0,g.jsx)(m.iih,{className:"inline mr-1 text-yellow-200"}),(0,g.jsxs)("span",{className:"inline text-neutral-300",children:["Holopin badges are unique, embeddable badges issued for rewards and achievements."," ",(0,g.jsx)(u(),{href:"/features",children:(0,g.jsx)("a",{className:"font-semibold text-green-300 hover:text-yellow-200",children:"Learn more"})})]})]})}),(0,g.jsx)(y,{stickers:h})]})}),(0,g.jsx)(o.O.Panel,{children:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"flex items-center justify-center mb-2 text-sm",children:(0,g.jsxs)("div",{className:"max-w-2xl px-6 py-2 text-center shadow-lg bg-neutral-800 rounded-md",children:[(0,g.jsx)(m.iih,{className:"inline mr-1 text-yellow-200"}),(0,g.jsxs)("span",{className:"inline text-neutral-300",children:["Evolving badges/series are badges that evolve over time based on Holobytes earned."," ",(0,g.jsx)(u(),{href:"/features",children:(0,g.jsx)("a",{className:"font-semibold text-green-300 hover:text-yellow-200",children:"Learn more"})})]})]})}),(0,g.jsx)(y,{evolvingStickers:f})]})}),(0,g.jsx)(o.O.Panel,{children:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"pt-4 my-4 text-2xl font-semibold",children:["Certifications",(0,g.jsx)("span",{className:"ml-1 text-neutral-600",children:"(".concat(h.filter((function(e){return"Certifications"===(null===e||void 0===e?void 0:e.collectionName)||"Certifications"===(null===e||void 0===e?void 0:e.collectionName)})).length,")")})]}),(0,g.jsx)(y,{stickers:h.filter((function(e){return"Certifications"===(null===e||void 0===e?void 0:e.collectionName)||"certifications"===(null===e||void 0===e?void 0:e.collectionName)})),showPagination:!1}),(0,g.jsxs)("div",{className:"pt-4 my-4 text-2xl font-semibold",children:["Courses",(0,g.jsx)("span",{className:"ml-1 text-neutral-600",children:"(".concat(h.filter((function(e){return"Courses"===(null===e||void 0===e?void 0:e.collectionName)})).length,")")})]}),(0,g.jsx)(y,{stickers:h.filter((function(e){return"Courses"===(null===e||void 0===e?void 0:e.collectionName)})),showPagination:!1}),(0,g.jsxs)("div",{className:"pt-4 my-4 text-2xl font-semibold",children:["Events",(0,g.jsx)("span",{className:"ml-1 text-neutral-600",children:"(".concat(h.filter((function(e){return"Events"===(null===e||void 0===e?void 0:e.collectionName)})).length,")")})]}),(0,g.jsx)(y,{stickers:h.filter((function(e){return"Events"===(null===e||void 0===e?void 0:e.collectionName)})),showPagination:!1})]})})]})]})},k=n(11163),S=n(56348),O=n(4730),Z=n(85479),C=n(82580),_=n(74231),P=n(542),E=n(48764).Buffer,R=["isOpen","setIsOpen","onChange"],A=_.Ry().shape({name:_.Z_().max(30,"Must not be longer than 30 characters").nullable(),website:_.Z_().url("Must be a valid URL").nullable(),description:_.Z_().max(350,"Must not be longer than 350 characters").nullable(),twitter:_.Z_().max(30,"Must not be longer than 30 characters").nullable(),location:_.Z_().max(30,"Must not be longer than 30 characters").nullable()}),F=function(e){var t,n,s,a,o,c,d,u=e.isOpen,m=e.setIsOpen,h=e.onChange,x=(0,O.Z)(e,R),p=(0,r.useState)(null!==(t=x.website)&&void 0!==t?t:null),v=p[0],b=(p[1],(0,r.useState)(null!==(n=x.description)&&void 0!==n?n:null)),j=b[0],w=(b[1],(0,r.useState)(null!==(s=x.name)&&void 0!==s?s:null)),y=w[0],N=(w[1],(0,r.useState)(null!==(a=x.twitter)&&void 0!==a?a:null)),_=N[0],F=(N[1],(0,r.useState)(null!==(o=x.location)&&void 0!==o?o:null)),L=F[0],T=(F[
11],(0,r.useState)(null!==(c=x.image)&&void 0!==c?c:P.Z)),D=T[0],I=T[1],B=(0,r.useState)(null!==(d=x.imageId)&&void 0!==d?d:null),z=B[0],H=B[1],U=(0,r.useState)(null),M=U[0],G=U[1],V=(0,r.useState)(!1),J=V[0],W=V[1],X=(0,r.useState)(null),Y=X[0],q=X[1],K=(0,r.useState)(null),Q=K[0],$=K[1],ee=(0,r.useState)(null),te=ee[0],ne=ee[1],re=((0,k.useRouter)(),function(){m(!1),q(null)});function se(e){var t=e.target.files;if(ne(null),t&&0!==t.length){if(t){var n=t[0];if(n.size>3145728)return ne("File must be under 2MB"),void G(null);if("image/png"!==n.type&&"image/svg+xml"!==n.type&&"image/jpeg"!==n.type)return ne("File must be PNG, JPEG or SVG"),void G(null);if(n){G(n);var r=new FileReader;r.onload=function(e){I(e.target.result)},r.readAsDataURL(n)}}}else G(null)}var ie=function(){var e=(0,i.Z)(l().mark((function e(t,n){var r,s,i,a,o,c,d,u,m,p,f,v,b,g;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n(!0),!M){e.next=23;break}return e.t0=fetch,e.t1={"Content-Type":"application/json"},e.t2=JSON,e.t3=E,e.next=8,M.arrayBuffer();case 8:return e.t4=e.sent,e.t5=e.t3.from.call(e.t3,e.t4).toString("base64"),e.t6={image:e.t5},e.t7=e.t2.stringify.call(e.t2,e.t6),e.t8={method:"POST",headers:e.t1,body:e.t7},e.next=15,(0,e.t0)("/api/assets",e.t8);case 15:return b=e.sent,e.next=18,b.json();case 18:if(v=e.sent,200==b.status){e.next=23;break}return $("Error uploading image: "+((null===(g=v)||void 0===g?void 0:g.message)||b.statusText)),n(!1),e.abrupt("return");case 23:return H(null!==(r=null===(s=v)||void 0===s||null===(i=s.data)||void 0===i?void 0:i.id)&&void 0!==r?r:z),e.next=26,fetch("/api/auth/organization?id=".concat(x.id),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:null!==(a=t.name)&&void 0!==a?a:null,website:null!==(o=t.website)&&void 0!==o?o:null,description:null!==(c=t.description)&&void 0!==c?c:null,twitter:null!==(d=t.twitter)&&void 0!==d?d:null,location:null!==(u=t.location)&&void 0!==u?u:null,imageId:null!==(m=null===(p=v)||void 0===p||null===(f=p.data)||void 0===f?void 0:f.id)&&void 0!==m?m:void 0})});case 26:200!=e.sent.status?($("Error updating profile"),n(!1)):(q("Profile updated"),n(!1),h(t.description,t.website,t.name,D,z,t.twitter,t.location),re());case 28:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();return(0,g.jsxs)(Z.V,{open:u,onClose:re,as:"div",className:"fixed inset-0 z-10 flex items-center justify-center",children:[(0,g.jsx)(Z.V.Overlay,{className:"fixed inset-0 bg-black opacity-50"}),(0,g.jsx)("div",{className:"fixed w-full h-full max-h-screen px-5 py-5 overflow-y-auto text-sm bg-neutral-800 rounded-md space-y-10 md:w-1/2 md:h-fit lg:w-1/3 lg:h-fit xl:w-1/4 xl:h-fit hap",children:(0,g.jsx)(C.J9,{initialValues:{name:y,website:v,description:j,twitter:_,location:L},validationSchema:A,onSubmit:function(){var e=(0,i.Z)(l().mark((function e(t){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:q(null),ne(null),$(null),W(!0),ie(t,W);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),children:function(e){var t=e.errors,n=e.touched;return(0,g.jsxs)(C.l0,{onChange:function(){q(null),$(null)},children:[(0,g.jsxs)("label",{htmlFor:"image",className:"mb-3 form-label",children:["Image",(0,g.jsx)("div",{className:"flex flex-col justify-start py-5 sm:flex-row",children:(0,g.jsxs)("div",{className:"relative z-1",children:[(0,g.jsx)(C.gN,{type:"file",name:"image",className:"hidden opacity-0",id:"image",onChange:se}),(0,g.jsx)("div",{className:"p-0.5 w-36 rounded-md bg-neutral-900 aspect-w-1 aspect-h-1 xl:aspect-w-7 xl:aspect-h-8",children:(0,g.jsx)("div",{className:"transition-transform ease-in-out hover:scale-105 hover:cursor-pointer",children:(0,g.jsx)(f(),{src:D,width:"90%",height:"90%",layout:"responsive",objectFit:D===P.Z?"fill":"cover",alt:"user image",className:"rounded-md"})})}),(0,g.jsx)("div",{className:"absolute top-0 w-full h-full bg-black opacity-0 z-3 rounded-md hover:opacity-90"})]})}),te?(0,g.jsx)("div",{className:"text-xs text-red-500",children:te}):null]}),(0,g.jsx)("label",{className:"font-semibold",htmlFor:"name",children:"Display name"}),(0,g.jsx)(C.gN,{name:"name",type:"text",placeholder:"optional",className:"block w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.name&&n.name?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.name}):null,(0,g.jsx)("label",{className:"font-semibold",htmlFor:"location",children:"Location"}),(0,g.jsx)(C.gN,{name:"location",type:"text",placeholder:"optional",className:"block w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.location&&n.location?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.location}):null,(0,g.jsx)("label",{className:"font-semibold",htmlFor:"website",children:"Website"}),(0,g.jsx)(C.gN,{name:"website",type:"text",placeholder:"optional",className:"block w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.website&&n.website?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.website}):null,(0,g.jsx)("label",{className:"font-semibold",htmlFor:"twitter",children:"Twitter handle"}),(0,g.jsxs)("div",{className:"flex block",children:[(0,g.jsx)("div",{className:"inline w-10 mt-2 mb-5 text-sm text-center text-white py-2.5",children:"@"}),(0,g.jsx)(C.gN,{name:"twitter",type:"text",placeholder:"optional",className:"inline w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.twitter&&n.twitter?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.twitter}):null]}),(0,g.jsx)("label",{className:"font-semibold",htmlFor:"description",children:"Description"}),(0,g.jsx)(C.gN,{as:"textarea",rows:"7",type:"text",name:"description",placeholder:"optional",className:"block w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.description&&n.description?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.description}):null,J?null:(0,g.jsx)("div",{className:"mt-3 text-sm text-green-300",children:Y}),J?null:(0,g.jsx)("div",{className:"mt-3 text-sm text-red-300",children:Q}),(0,g.jsx)(S.Z,{type:"button",variant:"close",onClick:re,children:"Close"}),(0,g.jsx)("div",{className:"float-right",children:(0,g.jsx)(S.Z,{type:"submit",disabled:J,children:J?"Saving...":"Save"})})]})}})})]})},L=function(e){var t,n,s,i,a,l,o,d=e.organization,u=(0,c.useSession)(),h=u.data,x=(u.status,(0,r.useState)(!1)),p=x[0],v=x[1],b=(0,r.useState)(null!==(t=d.description)&&void 0!==t?t:""),j=b[0],w=b[1],y=(0,r.useState)(null!==(n=d.image)&&void 0!==n?n:P.Z),N=y[0],O=y[1],Z=(0,r.useState)(null!==(s=d.imageId)&&void 0!==s?s:""),C=Z[0],_=Z[1],E=(0,r.useState)(null!==(i=d.name)&&void 0!==i?i:""),R=E[0],A=E[1],L=(0,r.useState)(null!==(a=d.twitter)&&void 0!==a?a:""),T=L[0],D=L[1],I=(0,r.useState)(null!==(l=d.website)&&void 0!==l?l:""),B=I[0],z=I[1],H=(0,r.useState)(null!==(o=d.location)&&void 0!==o?o:""),U=H[0],M=H[1],G=(0,k.useRouter)();return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"flex",children:[(0,g.jsx)("div",{className:"",children:(0,g.jsx)("div",{className:"p-0.5 w-36 rounded-md aspect-square bg-neutral-800",children:(0,g.jsx)(f(),{src:N,alt:R,width:"90%",height:"90%",layout:"responsive",objectFit:N===P.Z?"fill":"cover",className:"rounded-md"})})}),(0,g.jsx)("div",{className:"",children:(0,g.jsxs)("div",{className:"mx-5",children:[(0,g.jsxs)("div",{className:"flex",children:[(0,g.jsx)("span",{className:"text-3xl font-bold",children:R}),(0,g.jsx)("span",{className:"flex mt-1 h-fit",children:!0===d.verified?(0,g.jsx)("span",{className:"px-2 py-1 ml-2 text-xs font-light text-green-500 border border-green-700 rounded-md",children:"Verified"}):(0,g.jsx)("span",{className:"px-2 py-1 ml-2 text-xs font-light text-red-500 border border-red-700 rounded-md",children:"Unverified"})})]}),U&&""!==U&&(0,g.jsx)("div",{className:"mr-3 text-sm",children:U}),(0,g.jsxs)("div",{className:"text-sm space-x-2",children:[(0,g.jsxs)("span",{className:"",children:["@",d.username]}),T&&(0,g.jsxs)("span",{children:[(0,g.jsx)(m.fWC,{className:"inline text-blue-400 mr-0.5 mb-0.5"}),(0,g.jsx)("a",{href:"https://twitter.com/".concat(T),target:"_blank",rel:"noopener noreferrer",className:"hover:underline",children:(0,g.jsx)("span",{children:T})})]}),B&&""!==B&&(0,g.jsx)("span",{className:"text-green-200 hover:underline",children:(0,g.jsx)("a",{href:B,target:"_blank",rel:"noopener noreferrer",children:B.startsWith("https://")?B.slice(8):B.startsWith("http://")?B.slice(7):B})})]}),(0,g.jsx)("div",{className:"mt-1 text-sm text-white",children:j})]})})]}),(0,g.jsx)("div",{className:"flex-col sm:float-right",children:(null===h||void 0===h?void 0:h.user)&&!0===d.self&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"flex flex-col mt-2",children:(0,g.jsx)(S.Z,{onClick:function(){return G.push("/organizations/manage/".concat(d.username))},children:"Settings"})}),(0,g.jsx)(F,{isOpen:p,setIsOpen:v,name:R,description:j,twitter:T,website:B,location:U,image:N,imageId:C,onChange:function(e,t,n,r,s,i,a){w(e),z(t),A(n),O(r),_(s),D(i),M(a)},id:d.id})]})})]})},T=n(96916),D=n(85518),I=n(72076),B=n(96402),z=n(11355),H=function(e){var t=e.open,n=e.setOpen;return(0,g.jsx)(z.u,{appear:!0,show:t,as:r.Fragment,children:(0,g.jsxs)(Z.V,{as:"div",className:"fixed inset-0 z-10 overflow-y-auto",onClose:function(){return n(!1)},children:[(0,g.jsx)(z.u.Child,{as:r.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,g.jsx)("div",{className:"fixed inset-0 bg-black bg-opacity-70"})}),(0,g.jsx)("div",{className:"fixed inset-0 overflow-y-auto",children:(0,g.jsx)("div",{className:"flex items-center justify-center min-h-full p-4 text-center",children:(0,g.jsx)(z.u.Child,{as:r.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-95",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-95",children:(0,g.jsxs)(Z.V.Panel,{className:"w-full max-w-md p-6 overflow-hidden text-center align-middle shadow-xl bg-neutral-900 transform rounded-2xl transition-all",children:[(0,g.jsx)(Z.V.Title,{as:"h3",className:"text-xl font-semibold text-white leading-6",children:"Congratulations!"}),(0,g.jsx)("div",{className:"mt-2",children:(0,g.jsx)("p",{className:"text-sm text-neutral-400",children:"You've got a new holobyte!"})}),(0,g.jsx)("div",{className:"mt-4",children:(0,g.jsx)(S.Z,{type:"button",variant:"primary",onClick:function(){return n(!1)},children:"Got it, thanks!"})})]})})})})]})})},U=n(55135),M=n(38945),G=n(76763),V=n(86010),J=n(64055),W=function(e){var t=e.id,n=e.left,s=e.top,i=e.width,a=e.height,l=e.scale,o=e.rotation,c=e.dragThreshold,d=e.allowDragging,u=e.allowResizing,m=e.allowRotating,h=e.className,x=e.children,p=e.canDrop,f=e.getRelativeCoordinates,v=e.onDrop,b=(0,r.useState)(!1),j=b[0],w=b[1],y=(0,r.useState)(!1),N=y[0],k=y[1],S=(0,r.useState)(!1),O
1=S[0],Z=S[1],C=(0,r.useState)({x:0,y:0}),_=C[0],P=C[1],E=(0,r.useState)({x:0,y:0}),R=E[0],A=E[1],F=(0,r.useState)(n),L=F[0],T=F[1],D=(0,r.useState)(s),I=D[0],B=D[1],z=(0,r.useState)(1),H=z[0],U=z[1],M=(0,r.useState)(0),G=M[0],V=M[1],J=(0,r.useState)(!1),W=J[0],X=J[1],Y=(0,r.useRef)(null);(0,r.useEffect)((function(){window.addEventListener("mousemove",$),window.addEventListener("mouseup",ee);var e=Y.current;return e&&(e.addEventListener("touchstart",q,{passive:!1}),e.addEventListener("touchmove",K,{passive:!1}),e.addEventListener("touchend",Q,{passive:!1})),function(){window.removeEventListener("mousemove",$),window.removeEventListener("mouseup",ee),e&&(e.removeEventListener("touchstart",q),e.removeEventListener("touchmove",K),e.removeEventListener("touchend",Q))}}));var q=function(e){e.stopPropagation(),e.preventDefault();var t=Y.current;if(t){X(!0);var r=t.getBoundingClientRect(),i=r.left+n,a=r.top+s,c={x:i,y:a};P(c);var d=e.touches[0],u=d.clientX,m=d.clientY,h={x:u-i,y:m-a};A(h);var x=m-c.y-h.y;T(u-c.x-h.x),B(x),U(l),V(o)}},K=function(e){var t=e.touches[0],n=t.clientX,r=t.clientY;if(j||N||O)e.stopPropagation(),e.preventDefault(),ne(n,r);else{if(!W)return;var s=_.x,i=_.y,a=n-s+R.x,l=r-i+R.y;(Math.abs(a)>(c||5)||Math.abs(l)>(c||5))&&te(void 0)}},Q=function(e){X(!1),(j||N||O)&&(e.stopPropagation(),e.preventDefault(),re())},$=function(e){var t=e.clientX,n=e.clientY;if(j||N||O)e.stopPropagation(),e.preventDefault(),ne(t,n);else{if(!W)return;var r=_.x,s=_.y,i=t-r+R.x,a=n-s+R.y;(Math.abs(i)>(c||5)||Math.abs(a)>(c||5))&&te(e)}},ee=function(e){X(!1),(j||N||O)&&(e.stopPropagation(),e.preventDefault(),re())},te=function(e){if(null!==e&&void 0!==e&&e.shiftKey){if(!u)return;k(!0)}else if(null!==e&&void 0!==e&&e.ctrlKey||null!==e&&void 0!==e&&e.metaKey){if(!m)return;Z(!0)}else{if(!d)return;w(!0)}},ne=function(e,t){var n=_.x,r=_.y,s=e-n-R.x,a=t-r-R.y;if(N){var l=1+Math.sqrt(s*s+a*a)/i*(s<0&&a<0?-1:1);l<.1&&(l=.1),U(l)}if(O){var o=Math.atan2(a,s)*(180/Math.PI);V(o)}j&&(T(s),B(a))},re=function(){var e=j,n=N;w(!1),k(!1),Z(!1);var r=L+_.x,s=I+_.y;if(e||n){var l=i*H,o=a*H;if(!p(t,r-l/2+i/2,s-o/2+a/2,l,o))return}var c=f(r,s);if(c){var d=c.left,u=c.top;v(t,i,a,d,u,H,G)}};return(0,g.jsx)("div",{className:"relative",children:(0,g.jsxs)("div",{className:h,style:{position:"absolute",width:0,height:0},ref:Y,children:[(j||N||O)&&(0,g.jsx)("div",{style:{border:"1px dashed #444",position:"absolute",width:"".concat(i,"px"),height:"".concat(a,"px"),transform:["translate(".concat(n+L,"px, ").concat(s+I,"px)"),"scale(".concat(H,")"),"rotate(".concat(G,"deg)")].join(" "),transformOrigin:"center",transition:"0s",zIndex:1},children:x}),!N&&!O&&(0,g.jsx)("div",{style:{width:"".concat(i,"px"),height:"".concat(a,"px"),transform:"translate(".concat(n,"px, ").concat(s,"px) scale(").concat(l,") rotate(").concat(o,"deg)"),transformOrigin:"center",opacity:j?.5:1},onMouseDown:function(e){if(e.stopPropagation(),e.preventDefault(),0===e.button){var t=Y.current;if(t){X(!0);var r=t.getBoundingClientRect(),i=r.left+n,a=r.top+s,c={x:i,y:a};P(c);var d=e.clientX,u=e.clientY,m={x:d-i,y:u-a};A(m);var h=u-c.y-m.y;T(d-c.x-m.x),B(h),U(l),V(o)}}},children:x})]})})},X=n(67098),Y=n.n(X),q=function(e){var t=e.username,n=e.className,s=e.isOpen,i=e.canDrop,a=e.stickerDropped,l=e.getRelativeCoordinates,o=e.stickers,c=e.evolvingStickers,d=e.personalStickers,u=e.pageStickers,m=e.isSmallScreen,h=e.isSidebarOpen,p=e.setIsSidebarOpen,v=e.onDeleteSticker,b=e.onAddSticker,j=e.onRefreshStickers,w=(0,r.useState)(!1),y=w[0],N=w[1],k=(0,r.useState)(1),O=k[0],Z=k[1],C=(0,r.useState)(!1),_=C[0],P=C[1],E=(0,r.useRef)(),R=(0,r.useState)([]),A=R[0],F=R[1],L=function(e,t){var n;P((null===t||void 0===t?void 0:t.length)<(null===e||void 0===e||null===(n=e.data)||void 0===n?void 0:n.count)),N(!1)};(0,r.useEffect)((function(){Z(0);var e=new URL("/api/stickers",window.location.origin);e.searchParams.set("username",t),j(e,!1,L)}),[t]),(0,r.useEffect)((function(){var e=[].concat((0,x.Z)(o.map((function(e){return{id:e.id,image:e.image,name:e.name,type:"sticker"}}))),(0,x.Z)(c.map((function(e){return{id:e.id,image:e.image,name:e.name,type:"evolving"}}))),(0,x.Z)(d.map((function(e){return{id:e.id,image:e.image,name:e.name,type:"personal"}}))));F(e)}),[o,c]);return(0,g.jsx)(r.Fragment,{children:(0,g.jsxs)("div",{className:"".concat((0,V.Z)(Y().transition)," ").concat(s?"h-fit md:w-5/12 xl:w-4/12":"h-0 md:w-0"," z-10 fixed bg-black h-fit w-full bottom-0 left-0 md:top-16 md:h-full duration=500 ").concat(n),children:[(0,g.jsx)("div",{className:"flex flex-row justify-end my-2 mr-4",children:(0,g.jsx)(S.Z,{variant:"close",onClick:function(){p(!h)},children:"Close"})}),(0,g.jsxs)("div",{className:(0,V.Z)("pr-4",Y().scrollbar,"".concat(y?"pointer-events-none":"","\n ").concat(m?"overflow-y-hidden overflow-x-auto w-full h-fit":"overflow-x-hidden overflow-y-auto pb-20 md:pb-40 w-full h-full")),ref:E,onScroll:function(){if(E.current){var e=E.current,n=e.scrollTop,r
1=e.scrollHeight,s=e.clientHeight,i=e.scrollLeft,a=e.scrollWidth,l=e.clientWidth;if((n+s===r&&!m||i+l===a&&m)&&_){N(!0);var o=O+1;Z(o);var c=new URL("/api/stickers",window.location.origin);c.searchParams.set("username",t),c.searchParams.set("page",o.toString()),j(c,!0,L)}}},children:[(0,g.jsx)("div",{className:"".concat(y?"":"hidden"," absolute h-full w-full bg-black z-10 opacity-70")}),(0,g.jsx)(J.Z,{color:"white",loading:y,size:100,cssOverride:{position:"absolute",margin:"50% 30%"}}),(0,g.jsx)("div",{className:(0,V.Z)(Y().sidebarContainer),children:A.length>0?A&&A.map((function(e){var t=!(null===u||void 0===u||!u.find((function(t){var n;return(null===t||void 0===t||null===(n=t.sticker)||void 0===n?void 0:n.id)===(null===e||void 0===e?void 0:e.id)})));return(0,g.jsxs)("div",{className:"evolving"===e.type?"w-full p-3 rounded-md aspect-w-1 aspect-h-1 xl:aspect-w-7 xl:aspect-h-8 bg-gradient-to-br from-blue-400 to-green-400":"w-full p-3 rounded-md aspect-w-1 aspect-h-1 xl:aspect-w-7 xl:aspect-h-8 bg-neutral-800",style:{width:m?"140px":"240px",height:m?"140px":"240px"},children:[(0,g.jsx)(W,{id:null===e||void 0===e?void 0:e.id,left:0,top:0,width:m?120:220,height:m?120:220,scale:1,rotation:0,onDrop:a,canDrop:i,getRelativeCoordinates:l,dragThreshold:5,allowDragging:!1,allowResizing:!1,allowRotating:!1,children:(0,g.jsx)(f(),{src:e.image,width:440,height:440,layout:"responsive",objectFit:"contain",alt:e.name})}),t?(0,g.jsx)(S.Z,{className:(0,V.Z)(Y().removeButton),onClick:function(){return v(e)},iconOnly:m,icon:(0,g.jsx)(M.Z,{className:"block w-6 h-6","aria-hidden":"true"}),children:"Remove"}):(0,g.jsx)(S.Z,{className:(0,V.Z)(Y().removeButton),onClick:function(){return b(e)},iconOnly:m,icon:(0,g.jsx)(G.Z,{className:"block w-6 h-6","aria-hidden":"true"}),children:"Add"})]},null===e||void 0===e?void 0:e.id)})):(0,g.jsx)("div",{className:"flex text-sm text-center",children:"You don't have any badges yet"})})]})]})})},K="/_next/static/media/boardbg.865143a4.png",Q=n(50846);function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function ee(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){(0,h.Z)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var te=function(e){var t,n=e.height,s=e.width,a=e.stickers,o=e.evolvingStickers,d=e.personalStickers,u=e.userId,m=e.username,h=e.isSidebarOpen,p=e.setIsSidebarOpen,v=e.onRefreshStickers,b=(0,c.useSession)(),j=b.data,w=(b.status,(0,r.useState)(void 0)),y=w[0],N=w[1],k=(0,r.useState)(!1),O=k[0],Z=k[1],C=(0,r.useState)(1),_=C[0],P=C[1],E=(0,r.useState)(""),R=E[0],A=E[1],F=(0,r.useRef)(null),L=(0,r.useRef)(null),T=function(){var e=(0,i.Z)(l().mark((function e(){var t,n,r,s,i,a,o;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("/api/auth/user/page?username=".concat(m));case 2:if(!(t=e.sent).ok){e.next=14;break}return e.next=6,t.json();case 6:r=e.sent,s=r.page,i=r.stickers,a=null===s||void 0===s||null===(n=s.positions)||void 0===n?void 0:n.map((function(e){var t=i.find((function(t){return t.id===e.id}));return t?ee(ee({},e),{},{sticker:t}):null})),o=null===a||void 0===a?void 0:a.filter((function(e){return null!==e})),N(o),e.next=15;break;case 14:N([]);case 15:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,r.useEffect)((function(){Z(window.innerWidth<=767),V()}),[]),(0,r.useEffect)((function(){return window.addEventListener("resize",G),T(),function(){window.removeEventListener("resize",G)}}),[a,u]),(0,r.useEffect)((function(){var e=function(e){return new Promise((function(t,n){var r=new window.Image;r.crossOrigin="anonymous",r.onload=function(){t(r)},r.src=e}))},t=function(){var t=(0,i.Z)(l().mark((function t(){var n,r,s,i,a,o,c,d,u,m,h,x,p,f,v;return l().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(y){t.next=2;break}return t.abrupt("return");case 2:if(n=L.current){t.next=5;break}return t.abrupt("return");case 5:if(r=F.current){t.next=8;break}return t.abrupt("return");case 8:if(s=r.clientWidth,i=r.clientHeight,n.width===s&&n.height===i||(n.setAttribute("width",""+s),n.setAttribute("height",""+i)),a=n.getContext("2d")){t.next=14;break}return t.abrupt("return");case 14:a.imageSmoothingEnabled=!0,o=0;case 16:if(!(o<y.length)){t.next=30;break}return c=y[o],d=c.sticker,u=c.left,m=c.top,h=c.width,x=c.height,p=c.scale,f=c.rotation,t.next=20,e(d.image);case 20:v=t.sent,a.resetTransform(),a.translate(s/2,i/2),a.translate(u+h/2,m+x/2),a.scale(p,p),f&&a.rotate(f*Math.PI/180),a.drawImage(v,-h/2,-x/2,h,x);case 27:o++,t.next=16;break;case 30:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();t()}),[y]);var D=function(e){var t=new Set;return null===e||void 0===e?void 0:e.filter((function(e){var n=null===t||void 0===t?void 0:t.has(null===e||void 0===e?void 0:e.id);return null===t||void 0===t||t.add(null===e||void 0===e?void 0:e.id),!n}))},I=function(){var e=(0,i.Z)(l().mark((function e(t){var n;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return N(t),n=t.map((function(e){return{id:e.sticker.id,left
1:e.left,top:e.top,width:e.width,height:e.height,scale:e.scale,rotation:e.rotation}})),e.next=4,fetch("/api/auth/user/page",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({positions:D(n)})}).then(function(){var e=(0,i.Z)(l().mark((function e(t){var n;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.json();case 2:200!=(null===(n=e.sent)||void 0===n?void 0:n.statusCode)?A(n.message):A("");case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()).catch((function(e){A("Request failed.")}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),B=function(e,t,n,r,s,i,l){var c=a.find((function(t){return t.id===e})),u=o.find((function(t){return t.id===e})),m=d.find((function(t){return t.id===e})),h=c||u||m,p=[].concat((0,x.Z)(y),[{id:h.id,sticker:h,left:r,top:s,width:t,height:n,scale:i,rotation:l}]);I(p)},z=function(e,t,n,r,s){var i,a=null===F||void 0===F||null===(i=F.current)||void 0===i?void 0:i.getBoundingClientRect();return!!a&&!!(t<=a.right&&t+r>=a.left&&n<=a.bottom&&n+s>=a.top)},H=function(e,t){var n,r=null===F||void 0===F||null===(n=F.current)||void 0===n?void 0:n.getBoundingClientRect();if(r)return{left:e-r.left-r.width/2,top:t-r.top-r.height/2}},M=u===(null===j||void 0===j||null===(t=j.user)||void 0===t?void 0:t.id),G=function(){Z(window.innerWidth<=767),V()},V=function(){var e=document.getElementById("page-editor-wrapper");if(e){var t=Number((e.clientWidth/s).toFixed(2));P(t)}};return(0,g.jsxs)(r.Fragment,{children:[(0,g.jsx)("div",{className:"mb-2 text-right sm:mb-5",children:(0,g.jsx)(S.Z,{variant:h?"hold":"primary",className:"w-full sm:w-fit",type:"button",onClick:function(){return p(!h)},children:"Show Inventory"})}),(0,g.jsx)("div",{className:"absolute z-10 flex",children:(0,g.jsx)(q,{username:m,isOpen:h,canDrop:z,stickerDropped:B,getRelativeCoordinates:H,isSmallScreen:O,stickers:a,evolvingStickers:o,personalStickers:d,pageStickers:y,isSidebarOpen:h,setIsSidebarOpen:p,onDeleteSticker:function(e){var t=(0,x.Z)(y),n=null===t||void 0===t?void 0:t.find((function(t){var n;return(null===t||void 0===t||null===(n=t.sticker)||void 0===n?void 0:n.id)===(null===e||void 0===e?void 0:e.id)})),r=t.indexOf(n);t.splice(r,1),I(t)},onAddSticker:function(e){B(e.id,220,220,-100,-100,1,0)},onRefreshStickers:v})}),(0,g.jsxs)("div",{className:"relative w-auto h-full flex justify-start items-center rounded-md overflow-hidden shadow-lg shadow-neutral-950 border border-neutral-900",style:{aspectRatio:"".concat(s,"/").concat(n)},children:[(0,g.jsx)("div",{className:"hidden",children:(0,g.jsx)("canvas",{id:"canvas",ref:L})}),a.length<=0&&o.length<=0&&d.length<=0?(0,g.jsx)("div",{className:"absolute flex items-center justify-center w-full h-full z-[1]",children:"There are no badges to display"}):null,(0,g.jsxs)("div",{id:"sticker-page-area",ref:F,className:"relative overflow-hidden w-full h-full page",style:{backgroundImage:"url(".concat(K,")"),backgroundSize:"cover",backgroundPosition:"center"},children:[M&&a&&y&&y.length>0&&y.map((function(e,t){var n,r,s,i=e.sticker;return(0,g.jsx)("div",{className:"absolute w-0 h-0 top-1/2 left-1/2",children:(0,g.jsx)(W,{id:i.id,left:e.left*_,top:e.top*_,width:e.width*_,height:e.height*_,scale:e.scale,rotation:e.rotation,canDrop:z,getRelativeCoordinates:H,dragThreshold:0,allowDragging:u===(null===j||void 0===j||null===(n=j.user)||void 0===n?void 0:n.id),allowResizing:u===(null===j||void 0===j||null===(r=j.user)||void 0===r?void 0:r.id),allowRotating:u===(null===j||void 0===j||null===(s=j.user)||void 0===s?void 0:s.id),onDrop:function(e,n,r,s,a,l,o){if(i.id===e){var c=(0,x.Z)(y);c.splice(t,1),c.push({sticker:i,left:s/_,top:a/_,width:n/_,height:r/_,scale:l,rotation:o}),I(c)}else console.error("Attempt to move badge that is not in the page")},children:(0,g.jsx)(f(),{src:i.image,width:220*_,height:220*_,layout:"responsive",objectFit:"contain",alt:i.name})})},t)})),(0,g.jsxs)("div",{className:"absolute bottom-0 right-0 flex items-center m-3 bg-black rounded p-1.5",children:[(0,g.jsx)(f(),{src:Q.Z,height:O?10:20,width:O?10:20}),(0,g.jsxs)("span",{className:"pl-1 text-[8px] text-neutral-400 md:text-base",children:["holopin.io/@",m]})]})]})]}),R&&(0,g.jsx)("div",{className:"pb-3",children:(0,g.jsxs)(U.Z,{color:"red",children:["There was an error updating your badge board: ",R]})})]})},ne=function(e){var t=e.username,n=e.className,s=(0,r.useState)([]),i=s[0],a=s[1],l=(0,r.useState)(0),o=l[0],c=l[1],d=(0,r.useState)(12),m=d[0],h=(d[1],(0,r.useState)(0)),x=h[
10],p=h[1],v=(0,r.useState)(!1),j=(v[0],v[1]);(0,r.useEffect)((function(){j(!0),fetch("/api/personalstickers?username=".concat(t,"&page=").concat(o,"&limit=").concat(m)).then((function(e){return e.json()})).then((function(e){a(e.data.stickers),p(e.total),j(!1)})).catch((function(e){j(!1)}))}),[t,o,m]);return(0,g.jsx)(g.Fragment,{children:i&&i.length>0&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:" ".concat(n||"grid grid-cols-1 gap-y-10 sm:grid-cols-2 gap-x-6 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8"),children:i.map((function(e){return(0,g.jsxs)("div",{children:[(0,g.jsx)("div",{className:"w-full p-3 rounded-md bg-neutral-800 aspect-w-1 aspect-h-1 xl:aspect-w-7 xl:aspect-h-8",children:(0,g.jsx)(u(),{href:"/userbadge/personal/".concat(e.userPersonalStickerId),children:(0,g.jsx)("a",{children:(0,g.jsx)("div",{className:"transition-transform ease-in-out hover:scale-105 hover:cursor-pointer",children:(0,g.jsx)(f(),{src:e.image,width:"90%",height:"90%",layout:"responsive",objectFit:"contain",alt:e.name})})})})}),(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsx)("div",{className:"mt-2 font-bold text-white sticker-name",children:e.name}),(0,g.jsxs)("div",{className:"inline mt-2 text-sm text-neutral-400",children:["from @",e.username," ",(0,g.jsx)("span",{className:"px-2 py-1 ml-1 text-xs text-blue-300 border border-blue-400 rounded-md",children:"Hobby"})]})]})]},e.userPersonalStickerId)}))}),(0,g.jsx)("div",{className:"flex justify-center mt-5",children:(0,g.jsx)(b(),{previousLabel:"<",nextLabel:">",pageLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-transparent border border-neutral-700 text-white hover:text-black hover:bg-neutral-400 hover:border-neutral-400",previousLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-green-300 text-black hover:text-green-300 hover:bg-neutral-700",nextLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-green-300 text-black hover:text-green-300 hover:bg-neutral-700",breakLabel:"...",breakClassName:"font-semibold text-sm py-1 px-4 rounded-md",marginPagesDisplayed:1,pageRangeDisplayed:1,activeLinkClassName:"text-black font-semibold bg-white",className:"h-auto grid grid-flow-col gap-x-2",onPageChange:function(e){c(e.selected+1)},pageCount:Math.ceil(x/m),renderOnZeroPageCount:null})})]})})},re=n(22e3),se=n(19612),ie=n(63878),ae=n(29126),le=n(70410),oe={avocado:re.Z,cherry:se.Z,coffee:ie.Z,lemon:ae.Z,starfruit:le.Z},ce=function(e){var t,n=e.user,s=e.isSidebarOpen,a=e.setIsSidebarOpen,d=e.holobytes,h=e.receivedPersonalStickers,p=(0,c.useSession)(),v=p.data,j=(p.status,(0,r.useState)(!0)),w=(j[0],j[1]),N=(0,r.useState)([]),O=N[0],Z=N[1],C=(0,r.useState)([]),_=C[0],P=C[1],E=(0,r.useState)([]),R=E[0],A=E[1],F=(0,r.useState)(0),L=(F[0],F[1],(0,r.useState)([])),T=(L[0],L[1],(0,r.useState)(null!==(t=n.username)&&void 0!==t?t:n.email)),z=T[0],U=(T[1],(0,r.useState)(0)),M=U[0],G=U[1],V=(0,r.useState)(!1),J=V[0],W=V[1],X=[{index:0,name:"Board",href:"#",current:!0},{index:1,name:"Badges",href:"#badges",current:!1},{index:2,name:"Holobytes",href:"#holobytes",current:!1},{index:3,name:"Hobby",href:"#personalstickers",current:!1}];function Y(e){G(e),q&&q.push("#"===X[e].href?"#":X[e].href)}var q=(0,k.useRouter)(),K=function(){var e=(0,i.Z)(l().mark((function e(t,n,r){var s,i,a,o,c;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(!0),e.next=3,fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return i=e.sent,e.next=6,i.json();case 6:a=e.sent,o=(null===a||void 0===a||null===(s=a.data)||void 0===s?void 0:s.stickers)||[],c=[].concat((0,x.Z)(O),(0,x.Z)(o)),n?(w(!1),Z(c),r&&r(a,c)):(w(!1),Z(o),r&&r(a,o));case 10:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),Q=function(){var e=(0,i.Z)(l().mark((function e(t,n,r){var s,i,a,o,c;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(!0),e.next=3,fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return i=e.sent,e.next=6,i.json();case 6:a=e.sent,o=(null===a||void 0===a||null===(s=a.data)||void 0===s?void 0:s.stickers)||[],c=[].concat((0,x.Z)(_),(0,x.Z)(o)),n?(w(!1),P(c),r&&r(a,c)):(w(!1),P(o),r&&r(a,o));case 10:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}(),$=function(){var e=(0,i.Z)(l().mark((function e(t){var n,r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return w(!0),e.next=3,fetch(t,{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=e.sent,e.next=6,n.json();case 6:r=e.sent,A(r.data.stickers),w(!1);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,r.useEffect)((function(){if(q.isReady){var e=new URL("/api/stickers",window.location.origin),t=new URL("/api/evolvingstickers",window.location.origin),r=new
1URL("/api/personalstickers",window.location.origin);e.searchParams.set("username",null===n||void 0===n?void 0:n.username),t.searchParams.set("username",null===n||void 0===n?void 0:n.username),r.searchParams.set("username",null===n||void 0===n?void 0:n.username),K(e),Q(t),$(r),Y(q.asPath.includes("#badges")?1:q.asPath.includes("#holobytes")?2:0),q.query.newHolobyteFromCollect&&(ce(),W(!0))}}),[q.isReady,null===n||void 0===n?void 0:n.username]);var ee=(0,r.useState)(0),re=ee[0],se=ee[1],ie=(0,r.useState)(6)[0],le=(0,I.w5)("balloonsReward","balloons",{lifetime:1e3,elementSize:40,elementCount:200,spread:180,startVelocity:7}),ce=le.reward;le.isAnimating;return(0,g.jsxs)(g.Fragment,{children:[(null===v||void 0===v?void 0:v.user)&&v.user.username===z&&!0===n.self&&(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(H,{open:J,setOpen:W}),(0,g.jsx)("div",{className:"absolute inset-x-0 text-center",children:(0,g.jsx)("span",{id:"balloonsReward"})})]}),(0,g.jsxs)(o.O.Group,{defaultIndex:0,selectedIndex:M,onChange:Y,children:[(0,g.jsxs)(o.O.List,{className:"mt-8 mb-4 text-gray-600 border-b-2 2xl:text-lg border-b-black",children:[(0,g.jsx)(o.O,{"aria-hidden":"true",className:function(e){return e.selected?"text-white text-left w-1/5 md:w-1/6 border-b border-b-green-300 mr-1 sm:mr-3 pb-2":"text-left w-1/5 md:w-1/6 mr-1 sm:mr-3 pb-2"},children:"Board"}),(0,g.jsx)(o.O,{className:function(e){return e.selected?"text-white text-left w-1/4 md:w-1/6 border-b border-b-green-300 mr-1 sm:mr-3 pb-2":"text-left w-1/4 md:w-1/6 mr-1 sm:mr-3 pb-2"},children:"Badges"}),(0,g.jsx)(o.O,{className:function(e){return e.selected?"text-white text-left w-1/3 md:w-1/6 border-b border-b-green-300 ml-2 sm:ml-0 pb-2":"text-left w-1/3 md:w-1/6 pb-2"},children:"Holobytes"}),h&&n.self&&(0,g.jsx)(o.O,{className:function(e){return e.selected?"text-white text-left w-1/3 md:w-1/6 border-b border-b-green-300 ml-2 sm:ml-0 pb-2":"text-left w-1/3 md:w-1/6 pb-2"},children:(0,g.jsxs)("span",{className:"inline-flex items-center",children:["Hobby"," ",(0,g.jsx)("span",{className:"inline px-1 ml-1 text-xs border text-neutral-500 border-neutral-700 py-0.2 rounded-md",children:"Private"})]})})]}),(0,g.jsxs)(o.O.Panels,{children:[(0,g.jsx)(o.O.Panel,{"aria-hidden":"true",children:(0,g.jsx)(g.Fragment,{children:null!==v&&void 0!==v&&v.user&&v.user.username===z&&!0===n.self?(0,g.jsxs)("div",{id:"page-editor-wrapper",children:[(0,g.jsx)(te,{height:382,width:1214,stickers:O,evolvingStickers:_,personalStickers:R,userId:n.id,username:n.username,isSidebarOpen:s,setIsSidebarOpen:a,onRefreshStickers:K}),(0,g.jsxs)("div",{className:"mt-3 text-sm text-neutral-400",children:[!D.tq&&(0,g.jsxs)("p",{className:"mb-2",children:["To adjust the badges, hold ",(0,g.jsx)("code",{children:"Shift+click"})," to change size, ",(0,g.jsx)("code",{children:"Command+click"})," to rotate."]}),(0,g.jsx)("p",{children:"Embed this board on your GitHub or GitLab profile by adding the following to your README.md:"}),(0,g.jsx)("div",{className:"px-3 py-4 mt-2 bg-neutral-800 rounded-md",children:(0,g.jsx)("code",{className:"text-sm break-all mono text-neutral-400",children:"[.concat(n.username,")](https://holopin.io/@").concat(n.username,")")})})]})]}):(0,g.jsx)("div",{className:"mt-4",children:(0,g.jsx)(f(),{src:"https://boards.holopin.io/".concat(n.username),alt:"Here's a space for the board.",layout:"responsive",width:1214,height:382})})})}),(0,g.jsx)(o.O.Panel,{children:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"flex items-center justify-center mb-2 text-sm",children:(0,g.jsxs)("div",{className:"max-w-2xl px-6 py-2 text-center shadow-lg bg-neutral-800 rounded-md",children:[(0,g.jsx)(m.iih,{className:"inline mr-1 text-yellow-200"}),(0,g.jsx)("span",{className:"inline text-neutral-300",children:"Holopin badges & Evolving badges are unique, stickable badges that are issued by organizations."})]})}),null!==v&&void 0!==v&&v.user&&v.user.username===z&&!0===n.self?(0,g.jsx)(y,{stickers:O.map((function(e){return e.listed=e.UserSticker[0].listed,e})),evolvingStickers:_.map((function(e){return e.listed=e.UserEvolvingSticker[0].listed,e}))}):(0,g.jsx)(y,{stickers:O.filter((function(e){return!0===e.UserSticker[0].listed})),evolvingStickers:_.filter((function(e){return!0===e.UserEvolvingSticker[0].listed}))})]})}),(0,g.jsx)(o.O.Panel,{children:(0,g.jsxs)("div",{className:"flex flex-col items-center justify-center w-full h-full",children:[(0,g.jsx)("div",{className:"flex items-center justify-center mb-2 text-sm",children:(0,g.jsxs)("div",{className:"max-w-2xl px-6 py-2 text-center shadow-lg bg-neutral-800 rounded-md",children:[(0,g.jsx)(m.iih,{className:"inline mr-1 text-yellow-200"}),(0,g.jsxs)("span",{className:"inline text-neutral-300",children:["Holobytes are micro-rewards for c
1ompleting small tasks."," ",(0,g.jsx)(u(),{href:"/features",children:(0,g.jsx)("a",{className:"font-semibold text-green-300 hover:text-yellow-200",children:"Learn more"})})]})]})}),d&&0===d.length?(0,g.jsx)("div",{className:"mt-3 text-sm text-neutral-400",children:"No holobytes yet."}):d?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("table",{className:"w-full pt-10 mt-10 text-sm table-auto h-96",children:(0,g.jsxs)("tbody",{children:[d.slice(re*ie,re*ie+ie).map((function(e){return(0,g.jsxs)("tr",{className:"text-xs border-b h-[4.5rem] border-neutral-800 sm:text-sm",children:[(0,g.jsx)("td",{className:"p-2",children:(0,g.jsx)(f(),{src:e.icon?oe[e.icon]:ae.Z,width:"30",height:"30",layout:"fixed",objectFit:"contain",className:"rounded-sm",alt:"holobyte"})}),(0,g.jsxs)("td",{className:"py-2",children:["@",n.username," earned a holobyte from"," ",e.fromAlias&&e.fromAliasUrl?(0,g.jsx)(u(),{href:e.fromAliasUrl,passHref:!0,children:(0,g.jsx)("span",{className:"font-semibold text-green-300 cursor-pointer hover:text-white",children:e.fromAlias})}):(0,g.jsx)(u(),{href:"/@".concat(e.organization.username),passHref:!0,children:(0,g.jsx)("span",{className:"font-bold text-green-300 cursor-pointer hover:text-white",children:e.organization.name})}),e.description?" for ".concat(e.description):"",e.url&&e.urlAlias&&(0,g.jsxs)("span",{children:[" ","in"," ",(0,g.jsx)(u(),{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"font-semibold text-green-300 hover:text-white",passHref:!0,children:(0,g.jsx)("span",{className:"font-bold text-green-300 cursor-pointer hover:text-white",children:e.urlAlias})})]})]}),(0,g.jsx)("td",{className:"py-2 text-xs text-neutral-600",children:(0,g.jsx)(B.Z,{date:e.createdAt})}),(0,g.jsx)("td",{className:"py-2",children:e.userEvolvingSticker?(0,g.jsx)(u(),{href:"/holobytebadge/".concat(e.userEvolvingSticker.id),children:(0,g.jsx)("a",{children:(0,g.jsx)(f(),{src:e.userEvolvingSticker.image,width:"48",height:"48",objectFit:"contain",className:"rounded-sm cursor-pointer bg-gradient-to-t from-green-400 to-blue-500 hover:from-green-500 hover:to-blue-600 transition-all hover:scale-105 duration-300",alt:"holobyte"})})}):e.evolvingSticker&&n.self?(0,g.jsx)(u(),{href:"/holobyte/".concat(e.id),className:"py-2",children:(0,g.jsx)("a",{children:(0,g.jsxs)(S.Z,{type:"button",variant:"secondary",children:[(0,g.jsx)("span",{className:"hidden sm:inline-block",children:"Claim reward"}),(0,g.jsx)("span",{className:"inline-block sm:hidden",children:"Claim"})]})})}):null})]},e.id)})),Array.from({length:ie-d.slice(re*ie,re*ie+ie).length},(function(e,t){return(0,g.jsx)("tr",{className:"h-[4.5rem]"},"empty-row-".concat(t))}))]})}),(0,g.jsx)("div",{className:"flex justify-center mt-5",children:(0,g.jsx)(b(),{previousLabel:"<",nextLabel:">",pageLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-transparent border border-neutral-700 text-white hover:text-black hover:bg-neutral-400 hover:border-neutral-400",previousLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-green-300 text-black hover:text-green-300 hover:bg-neutral-700",nextLinkClassName:"font-semibold text-sm py-1.5 px-2 rounded-md border border-solid border-transparent transition-colors duration-300 ease-in-out bg-green-300 text-black hover:text-green-300 hover:bg-neutral-700",breakLabel:"...",breakClassName:"font-semibold text-sm py-1 px-4 rounded-md",marginPagesDisplayed:1,pageRangeDisplayed:1,activeLinkClassName:"text-black font-semibold bg-white",className:"h-auto grid grid-flow-col gap-x-2",onPageChange:function(e){var t=e.selected;se(t)},pageCount:Math.ceil(d.length/ie),renderOnZeroPageCount:null})})]}):null]})}),h&&n.self&&(0,g.jsx)(o.O.Panel,{children:(0,g.jsx)(g.Fragment,{children:(0,g.jsx)(ne,{username:n.username})})})]})]})]})},de=n(35079),ue=n(48764).Buffer,me=["isOpen","setIsOpen","onChange"],he=_.Ry().shape({name:_.Z_().max(30,"Must not be longer than 30 characters").nullable(),website:_.Z_().url("Must be a valid URL").nullable(),bio:_.Z_().max(150,"Must not be longer than 150 characters").nullable(),pronouns:_.Z_().nullable(),twitter:_.Z_().nullable(),github:_.Z_().nullable(),discord:_.Z_().nullable()}),xe=function(e){var t,n,s,a,o,c,d,u,h,x=e.isOpen,p=e.setIsOpen,v=e.onChange,b=(0,O.Z)(e,me),j=(0,r.useState)(null!==(t=b.website)&&void 0!==t?t:null),w=j[0],y=j[1],N=(0,r.useState)(null!==(n=b.bio)&&void 0!==n?n:null),_=N[0],E=N[1],R=(0,r.useState)(null!==(s=b.pronouns)&&void 0!==s?s:null),A=R[0],F=R[1],L=(0,r.useState)(null!==(a=b.name)&&void 0!==a?a:null),T=L[0],D=L[1],I=(0,r.useState)(null!==(o=b.t
1witter)&&void 0!==o?o:null),B=I[0],H=I[1],U=(0,r.useState)(null!==(c=b.github)&&void 0!==c?c:null),M=U[0],G=U[1],V=(0,r.useState)(null!==(d=b.discord)&&void 0!==d?d:null),J=V[0],W=V[1],X=["none","she/her","he/him","they/them","she/they","he/they"],Y=(0,r.useState)(null!==(u=b.image)&&void 0!==u?u:P.Z),q=Y[0],K=Y[1],Q=(0,r.useState)(null!==(h=b.imageId)&&void 0!==h?h:null),$=Q[0],ee=Q[1],te=(0,r.useState)(null),ne=te[0],re=te[1],se=(0,r.useState)(!1),ie=se[0],ae=se[1],le=(0,r.useState)(null),oe=le[0],ce=le[1],xe=(0,r.useState)(null),pe=xe[0],fe=xe[1],ve=(0,r.useState)(null),be=ve[0],ge=ve[1],je=((0,k.useRouter)(),function(){p(!1),ce(null)}),we=function(){var e=new Event("visibilitychange");document.dispatchEvent(e)},ye=function(){var e=(0,i.Z)(l().mark((function e(t,n){var r,s,i,a,o,c,d,u,m;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n(!0),!ne){e.next=23;break}return e.t0=fetch,e.t1={"Content-Type":"application/json"},e.t2=JSON,e.t3=ue,e.next=8,ne.arrayBuffer();case 8:return e.t4=e.sent,e.t5=e.t3.from.call(e.t3,e.t4).toString("base64"),e.t6={image:e.t5},e.t7=e.t2.stringify.call(e.t2,e.t6),e.t8={method:"POST",headers:e.t1,body:e.t7},e.next=15,(0,e.t0)("/api/assets",e.t8);case 15:return u=e.sent,e.next=18,u.json();case 18:if(d=e.sent,200==u.status){e.next=23;break}return fe("Error uploading image: "+((null===(m=d)||void 0===m?void 0:m.message)||u.statusText)),n(!1),e.abrupt("return");case 23:return ee(null!==(r=null===(s=d)||void 0===s||null===(i=s.data)||void 0===i?void 0:i.id)&&void 0!==r?r:$),e.next=26,fetch("/api/auth/user",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:t.name,website:t.website,bio:t.bio,pronouns:A,twitter:t.twitter,github:t.github,discord:t.discord,imageId:null!==(a=null===(o=d)||void 0===o||null===(c=o.data)||void 0===c?void 0:c.id)&&void 0!==a?a:void 0})});case 26:200!=e.sent.status?(fe("Error updating profile"),n(!1)):(ce("Profile updated"),n(!1),E(t.bio),y(t.website),D(t.name),H(t.twitter),G(t.github),W(t.discord),v(t.bio,t.website,A,t.name,q,$,t.twitter,t.github,t.discord),we(),je());case 28:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();function Ne(e){var t=e.target.files;if(ge(null),t&&0!==t.length){if(t){var n=t[0];if(n.size>3145728)return ge("File must be under 2MB"),void re(null);if("image/png"!==n.type&&"image/svg+xml"!==n.type&&"image/jpeg"!==n.type)return ge("File must be PNG, JPEG or SVG"),void re(null);if(n){re(n);var r=new FileReader;r.onload=function(e){K(e.target.result)},r.readAsDataURL(n)}}}else re(null)}return(0,g.jsxs)(Z.V,{open:x,onClose:je,as:"div",className:"fixed inset-0 z-10 flex items-center justify-center",children:[(0,g.jsx)(Z.V.Overlay,{className:"fixed inset-0 bg-black opacity-50"}),(0,g.jsx)("div",{className:"fixed w-full h-full max-h-screen px-5 py-5 overflow-y-auto text-sm bg-neutral-800 rounded-md space-y-10 md:w-1/2 md:h-fit lg:w-1/3 lg:h-fit xl:w-1/4 xl:h-fit hap",children:(0,g.jsx)(C.J9,{initialValues:{name:T,website:w,bio:_,twitter:B,pronouns:A,github:M,discord:J},validationSchema:he,onSubmit:function(){var e=(0,i.Z)(l().mark((function e(t){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ce(null),fe(null),ae(!0),ye(t,ae);case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),children:function(e){var t=e.errors,n=e.touched;return(0,g.jsxs)(C.l0,{onChange:function(){ce(null),fe(null)},children:[(0,g.jsxs)("label",{htmlFor:"image",className:"mb-3 form-label",children:["Image",(0,g.jsx)("div",{className:"flex flex-col justify-start py-5 sm:flex-row",children:(0,g.jsxs)("div",{className:"relative z-1",children:[(0,g.jsx)(C.gN,{type:"file",name:"image",className:"hidden opacity-0",id:"image",onChange:Ne}),(0,g.jsx)("div",{className:"p-0.5 w-36 rounded-md bg-neutral-900 aspect-w-1 aspect-h-1 xl:aspect-w-7 xl:aspect-h-8",children:(0,g.jsx)("div",{className:"transition-transform ease-in-out hover:scale-105 hover:cursor-pointer",children:(0,g.jsx)(f(),{src:q,width:"90%",height:"90%",layout:"responsive",objectFit:q===P.Z?"fill":"cover",alt:"user image",className:"rounded-md"})})}),(0,g.jsx)("div",{className:"absolute top-0 w-full h-full bg-black opacity-0 z-3 rounded-md hover:opacity-90"})]})}),be?(0,g.jsx)("div",{className:"text-xs text-red-500",children:be}):null]}),(0,g.jsx)("label",{className:"font-semibold",htmlFor:"name",children:"Display name"}),(0,g.jsx)(C.gN,{name:"name",type:"text",placeholder:"optional",className:"block w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.name&&n.name?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.name}):null,(0,g.jsx)("label",{className:"font-semibold",htmlFor:"pronouns",children:"Pronouns"}),(0,g.jsx)(de.R,{value:A,onChange:F,children:(0,g.jsxs)("div",{className:"relative",children:[(0,g.jsxs)(de.R.Button,{className:"relative block w-full mt-2 mb-5 text-sm text-left text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5",children:[(0,g.jsx)("span",{className:"block truncate",children:A&&""!==A?(0,g.jsx)("span",{children:A}):(0,g.jsx)("span",{children:"none"})}),(0,g.jsx)("span",{className:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none",children:(0,g.jsx)(m.RiI,{className:"w-3 h-3 text-white"})})]}),(0,g.jsx)(z.u,{as:r.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,g.jsx)(de.R.Options,{className:"absolute w-full mt-1 overflow-auto text-base shadow-lg bg-neutral-300 rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",children:X.map((function(e,t){return(0,g.jsx)(de.R.Option,{className:function(e){var t=e.active;return"".concat(t?"text-white bg-neutral-400":"text-neutral-900","\n cursor-default select-none relative py-2 pl-10 pr-4")},value:e,children:function(t){var n=t.selected,r=t.active;return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"".concat(n?"font-medium":"font-normal"," block truncate"),children:e}),n?(0,g.jsx)("span",{className:"".concat(r?"text-white":"text-neutral-900","\n absolute inset-y-0 left-0 flex items-center pl-3")}):null]})}},t)}))})})]})}),(0,g.jsx)("label",{className:"font-semibold",htmlFor:"website",children:"Website"}),(0,g.jsx)(C.gN,{name:"website",type:"text",placeholder:"optional",className:"block w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.website&&n.website?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.website}):null,(0,g.jsx)("label",{className:"font-semibold",htmlFor:"twitter",children:"Twitter handle"}),(0,g.jsxs)("div",{className:"flex block",children:[(0,g.jsx)("div",{className:"inline w-10 mt-2 mb-5 text-sm text-center text-white py-2.5",children:"@"}),(0,g.jsx)(C.gN,{name:"twitter",type:"text",placeholder:"optional",className:"inline w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.twitter&&n.twitter?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.twitter}):null]}),(0,g.jsx)("label",{className:"font-semibold",htmlFor:"github",children:"GitHub username"}),(0,g.jsx)(C.gN,{name:"github",type:"text",placeholder:"optional",className:"inline w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.github&&n.github?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.github}):null,(0,g.jsx)("label",{className:"font-semibold",htmlFor:"discord",children:"Discord ID"}),(0,g.jsx)(C.gN,{name:"discord",type:"text",placeholder:"optional",className:"inline w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.discord&&n.discord?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.discord}):null,(0,g.jsx)("label",{className:"font-semibold",htmlFor:"bio",children:"Bio"}),(0,g.jsx)(C.gN,{as:"textarea",type:"text",name:"bio",placeholder:"optional",className:"block w-full mt-2 mb-5 text-sm text-white bg-black border border-black rounded-md focus:ring-neutral-500 focus:border-neutral-500 p-2.5"}),t.bio&&n.bio?(0,g.jsx)("div",{className:"text-xs text-red-500",children:t.bio}):null,ie?null:(0,g.jsx)("div",{className:"mt-3 text-sm text-green-300",children:oe}),ie?null:(0,g.jsx)("div",{className:"mt-3 text-sm text-red-300",children:pe}),(0,g.jsx)(S.Z,{type:"button",variant:"close",onClick:je,children:"Close"}),(0,g.jsx)("div",{className:"float-right",children:(0,g.jsx)(S.Z,{type:"submit",disabled:ie,children:ie?"Saving...":"Save"})})]})}})})]})},pe=function(e){var t,n,s,i,a,l,o,d,u,h,x,p,v,b,j,w=e.user,y=(0,c.useSession)(),N=y.data,k=(y.status,(0,r.useState)(!1)),O=k[0],Z=k[1],C=(0,r.useState)(null!==(t=w.username)&&void 0!==t?t:w.email),_=C[0],E=(C[1],(0,r.useState)(null!==(n=null===(s=w.bio)||void 0===s?void 0:s.trim())&&void 0!==n?n:"")),R=E[0],A=E[1],F=(0,r.useState)(null!==(i=null===(a=w.website)||void 0===a?void 0:a.trim())&&void 0!==i?i:""),L=F[0],T=F[1],D=(0,r.useState)(null!==(l=null===(o=w.twitter)||void 0===o?void 0:o.trim())&&void 0!==l?l:""),I=D[0],B=D[1],z=(0,r.useState)(null!==(d=null===(u=w.github)||void 0===u?void 0:u.trim())&&void 0!==d?d:""),H=z[0],U=z[1],M=(0,r.useState)(null!==(h=null===(x=w.discord)||void 0===x?void 0:x.trim())&&void 0!==h?h:""),G=M[0],V=M[1],J=(0,r.useState)(null!==(p=w.image)&&void 0!==p?p:P.Z),W=J[0],X=J[1],Y=(0,r.useState)(null!==(v=w.imageId)&&void 0!==v?v:""),q=Y[0],K=Y[1],Q=(0,r.useState)(null!==(b=w.name)&&void 0!==b?b:""),$=Q[0],ee=Q[1],te=(0,r.useState)(null!==(j=w.pronouns)&&void 0!==j?j:""),ne=te[0],re=te[1];return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"relative flex",children:[(0,g.jsx)("div",{className:"",children:(0,g.jsx)("div",{className:"p-0.5 w-36 rounded-md aspect-square bg-neutral-800",children:(0,g.jsx)(f(),{src:W,alt:_,width:"90%",height:"90%",layout:"responsive",objectFit:W===P.Z?"fill":"cover",className:"rounded-md"})})}),(0,g.jsx)("div",{className:"",children:(0,g.jsxs)("div",{className:"ml-5",children:[(0,g.jsxs)("div",{className:"flex flex-col",children:[(0,g.jsx)("span",{className:"text-3xl font-bold",children:"@".concat(_)}),$&&(0,g.jsx)("span",{className:"mt-1 mb-2 text-lg font-semibold text-neutral-600",children:"(".concat($,")")})]}),ne&&""!==ne&&"none"!==ne&&(0,g.jsx)("div",{className:"mr-3 text-sm",children:ne}),(0,g.jsxs)("div",{className:"flex flex-col mt-1 text-sm sm:flex-row sm:space-x-2",children:[H&&(0,g.jsxs)("span",{className:"text-neutral-200 hover:underline",children:[(0,g.jsx)(m.hJX,{className:"inline mr-1 text-white mb-0.5"}),(0,g.jsx)("a",{href:"https://github.com/".concat(H),target:"_blank",rel:"noopener noreferrer",children:H})]}),I&&(0,g.jsxs)("span",{className:"text-neutral-200 hover:underline",children:[(0,g.jsx)(m.fWC,{className:"inline text-blue-400 mr-0.5 mb-0.5"}
1),(0,g.jsx)("a",{href:"https://twitter.com/".concat(I),target:"_blank",rel:"noopener noreferrer",children:I})]}),G&&(0,g.jsxs)("span",{className:"text-neutral-200",children:[(0,g.jsx)(m.j2d,{className:"inline text-base text-indigo-400 text-md mr-0.5 mb-0.5"}),G]}),L&&""!==L&&(0,g.jsx)("span",{className:"text-green-200 hover:underline",children:(0,g.jsx)("a",{href:L,target:"_blank",rel:"noopener noreferrer",children:L.startsWith("https://")?L.slice(8):L.startsWith("http://")?L.slice(7):L})})]}),(0,g.jsx)("div",{className:"mt-1 text-sm text-white",children:R})]})})]}),(0,g.jsx)("div",{className:"flex-col sm:float-right",children:(null===N||void 0===N?void 0:N.user)&&N.user.username===_&&!0===w.self&&(0,g.jsxs)("div",{className:"flex flex-col mt-2",children:[(0,g.jsx)(S.Z,{onClick:function(){return Z(!O)},children:"Edit Profile"}),(0,g.jsx)(xe,{isOpen:O,setIsOpen:Z,username:_,bio:R,website:L,twitter:I,github:H,discord:G,name:$,image:W,imageId:q,pronouns:ne,onChange:function(e,t,n,r,s,i,a,l,o){A(e),T(t),re(n),ee(r),X(s),K(i),B(a),U(l),V(o)}})]})})]})},fe=n(10148),ve=!0,be=function(e){var t=e.user,n=e.organization,i=e.holobytes,a=e.receivedPersonalStickers,l=(0,r.useState)(!1),o=l[0],c=l[1];return t?(0,g.jsxs)(s.Z,{title:t.username,children:[(0,g.jsx)(T.Z,{meta:{title:"".concat(t.username," on Holopin"),description:"".concat(t.name," is collecting badges with Holopin."),imageUrl:"".concat(t.image||P.Z.src),url:"".concat((0,fe.R)(),"/@").concat(t.username)}}),(0,g.jsx)(pe,{user:t},t.username),(0,g.jsx)(ce,{user:t,isSidebarOpen:o,setIsSidebarOpen:c,holobytes:i,receivedPersonalStickers:a})]}):n?(0,g.jsxs)(s.Z,{title:n.name,children:[(0,g.jsx)(T.Z,{meta:{title:"".concat(n.username," on Holopin"),description:"".concat(n.name," is issuing recognising achievement with Holopins."),imageUrl:"".concat(n.image||P.Z.src),url:"".concat((0,fe.R)(),"/@").concat(n.username)}}),(0,g.jsx)(L,{organization:n},n.username),(0,g.jsx)(N,{organization:n})]}):(0,g.jsx)(s.Z,{children:(0,g.jsx)("div",{className:"text-white",children:"Not found"})})}},98648:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/profiles/[username]",function(){return n(17175)}])},22e3:function(e,t){"use strict";t.Z={src:"/_next/static/media/avocado.2c2e1d96.svg",height:100,width:100}},19612:function(e,t){"use strict";t.Z={src:"/_next/static/media/cherry.96a72595.svg",height:100,width:100}},63878:function(e,t){"use strict";t.Z={src:"/_next/static/media/coffee.50983c8a.svg",height:100,width:100}},29126:function(e,t){"use strict";t.Z={src:"/_next/static/media/lemon.024045b6.svg",height:100,width:100}},70410:function(e,t){"use strict";t.Z={src:"/_next/static/media/starfruit.ca04de9d.svg",height:100,width:100}},50846:function(e,t){"use strict";t.Z={src:"/_next/static/media/logo.17c858c3.png",height:256,width:256,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAMAAADz0U65AAAAZlBMVEVMaXGCp3l/pHeUv49oh2LJ+7yTvIorNy5acV49Tzl4mIqm1JuSvIg3RzSVvY1/oXiFrH5wkWBjf2KTtc2Jsn6nze9mfZNddHh9mqucwdZMXmgfJiqTtcXA9bSq2p+kzsrC8P+36KzLdtYHAAAAHXRSTlMAzHrpYf7UBD00bOyfGL82vFHl8+LyTIPc8VQN1BOwN5UAAAAJcEhZcwAACxMAAAsTAQCanBgAAABCSURBVHicBcGFAYAwAMCwzhV32YD/nyTB5SSJ54U337wdu8eXOk7v7dC1lmdZIQhjihocRGVT7jUE69uOBoJ2QsIPiBMDJsY0KsAAAAAASUVORK5CYII=",blurWidth:8,blurHeight:8}},542:function(e,t){"use strict";t.Z={src:"/_next/static/media/unknown.bc53212f.svg",height:256,width:224}},37437:function(e){e.exports={button:"Button_button__PjVhE",secondary:"Button_secondary__2SNo1",primary:"Button_primary___XGO6",close:"Button_close__pPp_W",disabled:"Button_disabled__063Xs",hold:"Button_hold__WeACw",social:"Button_social__EF7MJ",ghost:"Button_ghost__CPfYf",subtle:"Button_subtle__3cV3v",outline:"Button_outline__EsWgH",danger:"Button_danger__gw1OL",purple:"Button_purple__dIsBv",marketing:"Button_marketing__BSg_s",marketing2:"Button_marketing2__Y2Q_0","no-border":"Button_no-border__dojA4"}},67098:function(e){e.exports={sidebarContainer:"StickerSidebar_sidebarContainer__bcEY8",scrollbar:"StickerSidebar_scrollbar__65bDm",transition:"StickerSidebar_transition__Q1Rvr",removeButton:"StickerSidebar_removeButton__K233x"}}},function(e){e.O(0,[3365,56,2422,9925,4231,2580,8274,8978,3775,9774,2888,179],(function(){return t=98648,e
1(e.s=t);var t}));var t=e.O();_N_E=t}]);
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.