(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3858],{66181:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(93828),o=n(52023);function s(e){return(0,o.Z)(1,arguments),(0,r.Z)(e).getFullYear()}},53438:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/users/[username]/collections/[collectionSlug]",function(){return n(40711)}])},54431:function(e,t,n){"use strict";var r=n(10972),o=n(52379),s=n.n(o),a=n(74058),l=n.n(a),i=n(57851),c=n(33085);t.Z=function(e){var t=e.crumbs;return(0,r.jsx)("div",{className:"flex max-w-full flex-row flex-wrap items-center gap-2",children:t.map((function(e,n){return(0,r.jsxs)("div",{className:"flex max-w-full flex-row items-center gap-2",children:[(0,r.jsx)("div",{className:"flex max-w-full shrink-0 flex-row items-center justify-start overflow-hidden sm:max-w-xs",children:null!==e.path?(0,r.jsx)(l(),{href:e.path,passHref:!0,shallow:!0,children:(0,r.jsx)("a",{className:(0,i.m)("w-full truncate text-eyebrows underline",n===t.length-1&&"font-bold no-underline"),children:e.title})},e.title):(0,r.jsx)("p",{className:(0,i.m)("w-full truncate text-eyebrows",n===t.length-1&&"font-bold"),children:e.title})}),n<t.length-1&&(0,r.jsx)("div",{className:"relative h-4 w-4 shrink-0",children:(0,r.jsx)(s(),{src:c.gl,layout:"fill",className:"-scale-x-100"},n)})]},n)}))})}},59377:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(10972),o=(n(97176),n(82336)),s=function(){return(0,r.jsx)("div",{role:"status",className:"w-full p-8 flex-center",children:(0,r.jsxs)("div",{className:"rounded-sm bg-black/5 p-6 text-center flex-center",children:[(0,r.jsx)("div",{className:"scale-150",children:(0,r.jsx)(o.T,{className:"mx-auto fill-redorange text-black/15"})}),(0,r.jsx)("p",{className:"mt-4 text-eyebrows",children:"Loading more..."})]})})}},40711:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return he},default:function(){return me}});var r,o=n(47568),s=n(14924),a=n(26042),l=n(828),i=n(36305),c=n(72655),d=n.n(c),u=n(10972),h=n(49815),m=n(55442),f=n(31955),x=n(52379),p=n.n(x),v=n(32010),g=n(97176),b=n(6891),w=n(42708),j=n(57851),C=n(22503),y=n(7517),N=n(54431),k=n(81333),S=n(12578),I=n(59377),Z=n(25177),O=n(23989),E=n(56849),P=n(53263),M=n(70569),F=n(49676),T=n(7775),B=n(17031),U=n(61251),R=n(33085),L=n(29381),A=n(12941),D=n(99826),z=n(54281),_=n(35235),H=n(34479),W=function(e){var t=e.collection,n=e.isOpen,r=e.setIsOpen,s=e.onPickFeaturedImageClick,i=e.featuredProduct,c=e.setFeaturedProduct,h=(0,v.useRouter)(),m=(0,C.Eu)().user,f=(0,g.useContext)(T.E),x=f.showMessage,b=f.showError,w=(0,g.useState)(t.name),j=w[0],y=w[1],N=(0,g.useState)(t.description),k=N[0],S=N[1],I=(0,g.useState)(t.visibility),Z=I[0],P=I[1],M=(0,g.useState)(t.giftable),F=M[0],B=M[1],A=(0,g.useState)(!1),W=A[0],Q=A[1],q=(0,l.Z)((0,D.hAu)({notifyOnNetworkStatusChange:!0}),2),Y=q[0],G=q[1].loading,V=(0,l.Z)((0,D.JoQ)({notifyOnNetworkStatusChange:!0}),2),J=V[0],K=V[1].loading,X=function(){var e=(0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return H.ZP.trackEvent("[EDIT COLLECTION MODAL] delete collection clicked",void 0),e.next=3,J({variables:{where:{id:t.id}},onCompleted:function(){Q(!1),window.location.href=window.location.origin+t.user.path},update:function(e,n){var r=n.data;((null===r||void 0===r?void 0:r.deleteOneCollection)||void 0)&&m&&U.h.deleteOneCollection(t.id)}});case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),$=function(){var e=(0,o.Z)(d().mark((function e(n){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.preventDefault(),H.ZP.trackEvent("[EDIT COLLECTION MODAL] update collection clicked",{hasDescription:!!k,isPublic:Z===D.u2U.Public,isGiftable:F}),e.next=4,Y({variables:{where:{id:t.id},data:(0,a.Z)({name:{set:j},description:{set:k},visibility:{set:Z},giftable:{set:F}},i?{previewProducts:{set:[{id:i.id}]}}:{})},onCompleted:function(e){x("Successfully saved changes to ".concat(t.name)),h.replace({pathname:e.updateOneCollection.path})},onError:b,update:function(e,n){var r=n.data,o=(null===r||void 0===r?void 0:r.updateOneCollection)||void 0;o&&m&&(U.h.updateAfterEditCollection(t,m.id),i&&U.h.updateAfterFeaturedImageChanged(o,i.id))}});case 4:c(null),r(!1);case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();return(0,u.jsxs)(_.Z,{isOpen:n,setIsOpen:r,title:"Edit Collection",children:[(0,u.jsxs)("form",{className:"space-y-6",onSubmit:$,children:[(0,u.jsx)(z.Z,{type:"text",label:"What would you like to name the collection?",value:j,onChangeText:y}),(0,u.jsx)(z.K,{label:"Add a short description",value:k,rows:4,onChangeText:S}),(0,u.jsxs)("button",{className:"group flex flex-row items-center gap-4",onClick:function(e){e.preventDefault(),H.ZP.trackEvent("[EDIT COLLECTION MODAL] change featured image clicked",void 0),s()},type:"button",children:[(0,u.jsxs)("div",{className:"relative h-12 w-12 overflow-hidden rounded-xxs border",children:[i||t.previewProducts.length>0?(0,u.jsx)(p(),{src:i?(0,L.Kc)(i):(0,L.Kc)(t.previewProducts[0]),unoptimized:!0,width:48,height:48,className:"object-cover"}):(0,u.jsx)("div",{className:"h-12 w-12 bg-light-grey"}),(0,u.jsx)("div",{className:"absolute inset-0 bg-black/[0.6] opacity-0 transition-opacity flex-center group-hover:opacity-100",children:(0,u.jsx)("div",{className:"relative h-6 w-6",children:(0,u.jsx)(p(),{src:R.dY,alt:"edit icon",className:"invert",layout:"fill"})})})]}),(0,u.jsxs)("div",{className:"flex flex-col items-start",children:[(0,u.jsxs)("div",{className:"text-body-sm",children:[i||t.previewProducts.length>0?"Change":"Choose"," ","featured image"]}),(0,u.jsxs)("div",{className:"text-left text-eyebrows",children:["Give your collection some style with a hand picked",(0,u.jsx)("br",{}),"cover image"]})]})]}),(0,u.jsxs)("div",{className:"flex",children:[(0,u.jsx)("input",{id:"visibilityCheckbox",type:"checkbox",checked:Z===D.u2U.Private,onChange:function(e){P(e.target.checked?D.u2U.Private:D.u2U.Public)}}),(0,u.jsxs)("label",{className:"ml-2",htmlFor:"visibilityCheckbox",children:[(0,u.jsx)("div",{className:"text-body-sm",children:"Set as a private collection"}),(0,u.jsx)("div",{className:"text-eyebrows",children:"So only you and people you share it with can see it"})]})]}),(0,u.jsxs)("div",{className:"flex",children:[(0,u.jsx)("input",{id:"giftableCheckbox",type:"checkbox",checked:F,onChange:function(e){B(e.target.checked)}}),(0,u.jsxs)("label",{className:"ml-2",htmlFor:"giftableCheckbox",children:[(0,u.jsx)("div",{className:"text-body-sm",children:"Set as a giftable collection"}),(0,u.jsx)("div",{className:"text-eyebrows",children:"Anyone you share a giftable collection with will be able to mark items in your collection as purchased"})]})]}),t.currentUserIsCreator&&(0,u.jsx)("button",{type:"button",className:"text-buttons-sm underline",onClick:function(){Q(!0)},children:"Delete Collection"}),(0,u.jsx)(E.Z,{solid:!0,size:"lg",type:"submit",loading:G,disabled:G,children:"Update Collection"})]}),(0,u.jsx)(O.Z,{isOpen:W,setIsOpen:Q,title:"Are you sure you want to delete this collection?",message:"Deleted collections will be permanently removed from your profile!",confirmText:"Delete",onConfirm:X,onCancel:function(){H.ZP.trackEvent("[DELETE COLLECTION MODAL] cancel clicked",void 0),Q(!1)},dismissOnButtonPress:!1,loading:K})]})},Q=function(e){var t=e.collection,n=e.isOpen,r=e.setIsOpen,s=e.collaboratorInviteCode,a=(0,v.useRouter)(),i=(0,l.Z)((0,D.TtA)(),1)[0],c=(0,D.Rd6)().data,h=(0,g.useContext)(y._).showSignupModal,m=function(){var e=(0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===c||void 0===c?void 0:c.authorizedUser){e.next=3;break}return h("Register",(0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f();case 2:case"end":return e.stop()}}),e)})))),e.abrupt("return");case 3:return e.next=5,f();case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),f=function(){var e=(0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i({variables:{where:{id:t.id},collaboratorInviteCode:s}});case 2:a.replace({pathname:t.path},void 0,{scroll:!1}),r(!1);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,u.jsx)(_.Z,{isOpen:n,setIsOpen:function(e){r(e),e||t.visibility===D.u2U.Private&&a.replace({pathname:t.path})},noInset:!0,className:"overflow-hidden",children:(0,u.jsxs)("div",{className:"max-w-md",children:[(0,u.jsx)("div",{className:"bg-flow-gradient bg-cover px-18 py-16",children:(0,u.jsxs)("div",{className:"text-center text-h4",children:["Collaborate on ",(0,u.jsx)("span",{className:"font-bold",children:t.name})]})}),(0,u.jsxs)("div",{className:"flex flex-col gap-4 p-6",children:[(0,u.jsxs)("p",{className:"mb-6 px-6 text-center text-body-lg",children:["You've been invited to collaborate on the collection"," ",(0,u.jsx)("span",{className:"font-bold",children:t.name}),"!"]}),(0,u.jsx)(E.Z,{solid:!0,size:"lg",onClick:m,children:"Join Collection"})]})]})})},q=n(93072),Y=n(69396),G=n(1100),V=n(56443),J=n(34044),K=n.n(J),X=n(31146),$=function(e){var t=e.collection,n=ee(),r=(0,g.useContext)(T.E),s=r.showMessage,a=r.showError,c=(0,g.useState)(!1),h=c[0],m=c[1],f=(0,g.useState)(""),x=f[0],p=f[1],v=(0,g.useState)(new Set),b=v[0],w=v[1],j=t.collaboratorInvitePath,y=(0,g.useContext)(C.Vo).user,N=(0,g.useRef)(new Set),k=(0,l.Z)((0,D.URD)(),2),S=k[0],I=k[1].loading,Z=(0,D.gJZ)({variables:{queries:[x],take:16},skip:!x}),O=Z.data,P=Z.loading,M=j?(0,L.s3)((0,L.P6)(j),y):"",F=(0,g.useCallback)((0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.clipboard.writeText(M);case 3:m(!0),setTimeout((function(){return m(!1)}),1e3),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),a(new Error("There was a problem copying the link to your clipboard."));case 10:case"end":return e.stop()}}),e,null,[[0,7]])}))),[M,a]),B=(0,g.useCallback)((function(e){N.current.add(e.id),S({variables:{collection:{id:t.id},user:{id:e.id}},onCompleted:function(){N.current.delete(e.id),w(new Set((0,i.Z)(b).concat([e.id]))),p(""),s("Invited ".concat(e.name," to collaborate on ").concat(t.name,"!"))},onError:function(t){N.current.delete(e.id),a(t)}})}),[t,b,S,a,s]);return(0,u.jsxs)("div",{children:[(0,u.jsx)("h2",{className:n.infoText,children:"Collaborators have the ability to edit, add, and delete products."}),(0,u.jsx)("div",{className:n.label,children:"Search for friends to invite"}),(0,u.jsx)(V.h,{as:"div",value:x,onChange:function(e){p(e)},children:(0,u.jsxs)("div",{className:n.searchContainer,children:[(0,u.jsx)(V.h.Input,{as:z.Z,className:n.searchInput,onChange:function(e){return p(e.target.value)}}),(0,u.jsx)(V.h.Options,{className:K()(n.hidden,x.length?n.block:void 0),children:(0,u.jsx)("div",{className:n.searchResults,children:(null===O||void 0===O?void 0:O.searchUsers.length)?O.searchUsers.map((function(e){return(0,u.jsxs)("div",{className:n.searchResult,children:[(0,u.jsx)(G.Z,{name:e.name,media:e.media,size:"sm",link:!1}),(0,u.jsxs)("div",{className:n.userInfo,children:[(0,u.jsx)("div",{className:n.userName,children:e.name}),(0,u.jsx)("div",{className:n.userUsername,children:(0,u.jsx)(X.Z,{user:e})})]}),(0,u.jsx)("div",{className:n.spacer}),(0,u.jsx)("div",{children:(0,u.jsx)(E.Z,{solid:!0,onClick:function(){B(e)},loading:I&&N.current.has(e.id),disabled:b.has(e.id)||I,children:b.has(e.id)?"Invited":"Invite"})})]},e.id)})):P?(0,u.jsx)("div",{className:n.muted,children:"Loading..."}):(0,u.jsx)("div",{className:n.muted,children:"No results found"})})})]})}),(0,u.jsx)("div",{className:n.label,children:"Invite with link"}),(0,u.jsxs)("div",{className:n.copyContainer,children:[(0,u.jsx)("button",{onClick:F,className:n.copyButton,children:h?"Copied!":"Copy Link"}),(0,u.jsx)(z.Z,{disabled:!0,className:n.copyInput,value:M})]})]})},ee=(0,b.QM)({infoText:{fontSize:"0.875rem",lineHeight:"1.25rem",fontWeight:400,textAlign:"center"},label:{marginTop:"1.25rem",fontSize:"0.875rem",lineHeight:"1.25rem",fontWeight:400},spacer:{flex:1},muted:{color:"rgb(91, 91, 91)"},hidden:{display:"none"},block:{display:"block"},searchContainer:{position:"relative",marginTop:"0.5rem"},searchInput:{fontSize:"0.75rem",lineHeight:"1.25rem",letterSpacing:"0.03em",fontWeight:400},searchResults:{position:"absolute",zIndex:10,marginTop:"0.5rem",width:"100%",maxHeight:"14rem",overflowY:"auto",borderRadius:"0.75rem",borderWidth:"1px",borderColor:"black",backgroundColor:"white",padding:"0.5rem 1rem"},searchResult:{display:"flex",alignItems:"center",padding:"0.5rem 0"},userInfo:{marginLeft:"1rem"},userName:{fontSize:"0.875rem",lineHeight:"1.25rem",fontWeight:400},userUsername:{fontSize:"0.75rem",lineHeight:"1.25rem",letterSpacing:"0.03em",fontWeight:400},copyContainer:{position:"relative",marginTop:"0.5rem"},copyButton:{position:"absolute",backgroundColor:"rgb(255 255 255 / 0.9)",inset:0,opacity:0,borderRadius:"0.75rem","&:hover":{opacity:1}},copyInput:{fontSize:"0.75rem",lineHeight:"1.25rem",letterSpacing:"0.03em",fontWeight:400,padding:"0.5rem 1rem",backgroundColor:"white",borderColor:"black",borderWidth:"1px",borderRadius:"0.75rem",textOverflow:"ellipsis",whiteSpace:"nowrap"}}),te=n(74058),ne=n.n(te),re=function(e){var t=e.collection,n=(0,v.useRouter)(),r=(0,g.useState)(!1),s=r[0],a=r[1],i=(0,l.Z)((0,D.qCu)(),2),c=i[0],h=i[1].loading,m=(0,C.Eu)().user,f=(0,g.useContext)(T.E),x=f.showMessage,p=f.showError,b=(0,g.useCallback)((function(){a(!0)}),[]),w=(0,g.useCallback)((0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,c({variables:{where:{id:t.id}},update:function(e,n){var r=n.data;(null===r||void 0===r?void 0:r.leaveCollection)&&m&&U.h.updateAfterLeaveCollection(t,m.id)},onCompleted:function(){var e;x("Successfully left collection ".concat(t.name)),n.push(null!==(e=null===m||void 0===m?void 0:m.path)&&void 0!==e?e:"/")},onError:p});case 2:case"end":return e.stop()}}),e)}))),[m,t,c,n,p,x]);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(E.Z,{solid:!0,onClick:b,children:"Leave"}),(0,u.jsx)(O.Z,{isOpen:s,title:"Leave ".concat(t.name,"?"),message:"Are you sure you want to leave the collection? This action cannot be undone!",confirmText:"Leave",onConfirm:w,onCancel:function(){a(!1)},setIsOpen:a,dismissOnButtonPress:!1,loading:h})]})},oe=function(e){var t=e.collection,n=e.collaborator,r=(0,v.useRouter)(),s=(0,g.useState)(!1),a=s[0],i=s[1],c=(0,l.Z)((0,D.hld)(),2),h=c[0],m=c[1].loading,f=(0,g.useContext)(T.E),x=f.showMessage,p=f.showError,b=(0,g.useCallback)((function(){i(!0)}),[]),w=(0,g.useCallback)((0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h({variables:{collectionId:t.id,userId:n.id},update:function(e,o){var s=o.data;if(null===s||void 0===s?void 0:s.removeCollaborator){var a=r.query.shareCode||null,l=r.query.collaboratorInviteCode,i={slugs:{user:t.user.username,collection:t.slug},shareCode:a,collaboratorInviteCode:l};U.h.removeCollaboratorFromCollection(t,n.id,i)}},onCompleted:function(){x("Successfully removed ".concat(n.name)),i(!1)},onError:p});case 2:case"end":return e.stop()}}),e)}))),[t,n,r,h,p,x]);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(E.Z,{solid:!0,onClick:b,children:"Remove"}),(0,u.jsx)(O.Z,{isOpen:a,title:"Remove ".concat(n.name," from ").concat(t.name,"?"),message:"Are you sure you want to remove this collaborator? This action cannot be undone!",confirmText:"Remove",onConfirm:w,onCancel:function(){i(!1)},setIsOpen:i,dismissOnButtonPress:!1,loading:m})]})},se=function(e){var t=e.collection,n=ae(),r=(0,C.Eu)().user,o=t.collaborators,s=t.currentUserIsCollaborator,l=t.currentUserIsCreator,c=[t.user].concat((0,i.Z)(o));return(0,u.jsxs)("div",{className:n.container,children:[(0,u.jsx)("div",{className:n.title,children:"Collaborators"}),(0,u.jsx)("div",{className:n.rowContainer,children:c.map((function(e){var o=s&&e.id===(null===r||void 0===r?void 0:r.id)&&!l,i=e.id===t.user.id,c=l&&!i;return(0,u.jsxs)("div",{className:n.row,children:[(0,u.jsx)(G.Z,(0,Y.Z)((0,a.Z)({},e),{size:"sm",className:n.profileImage})),(0,u.jsxs)("div",{children:[(0,u.jsx)(ne(),{href:e.path,children:e.name}),(0,u.jsx)("div",{className:n.username,children:(0,u.jsx)(X.Z,{user:e})})]}),(0,u.jsx)("div",{className:n.spacer}),(0,u.jsxs)("div",{children:[i&&(0,u.jsx)("span",{className:n.creatorText,children:"Creator"}),o&&(0,u.jsx)(re,{collection:t}),c&&(0,u.jsx)(oe,{collection:t,collaborator:e})]})]},e.id)}))})]})},ae=(0,b.QM)({container:{marginTop:"1rem"},title:{fontSize:"1.25rem",lineHeight:"1.625rem",fontWeight:400,padding:"0.5rem 0"},rowContainer:{overflowY:"auto",minWidth:"20rem",maxHeight:"24rem"},row:{padding:"0.5rem 0",gap:"1rem",alignItems:"center",flexDirection:"row",width:"100%",display:"flex"},profileImage:{width:"2rem",height:"2rem"},username:{fontSize:"0.875rem",lineHeight:"1.25rem",fontWeight:400,color:"rgb(91 91 91)"},spacer:{flex:1},creatorText:{fontStyle:"italic",fontSize:"1rem",lineHeight:"1.5rem",fontWeight:400}}),le=function(e){var t=e.collection,n=e.isOpen,r=e.setIsOpen,o=ie(),s=t.currentUserIsCreator||t.currentUserIsCollaborator;return(0,u.jsxs)(_.Z,{isOpen:n,setIsOpen:r,title:"Collaborators",className:o.modal,children:[s&&(0,u.jsx)($,{collection:t}),(0,u.jsx)(se,{collection:t})]})},ie=(0,b.QM)({modal:(0,s.Z)({width:"100%"},A.Z.tabletSmall,{width:"32rem"})}),ce=function(e){var t=e.collection,n=(0,g.useState)(!1),r=n[0],o=n[1],s=t.collaborators,l=t.collaboratorCount,c=t.currentUserIsCreator,d=t.currentUserIsCollaborator,h=t.user,m=c||d,f=(0,g.useCallback)((function(){o(!0)}),[]);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("h2",{className:"mt-4 text-eyebrows",children:l?"Collaborators":"Curator"}),(0,u.jsx)("button",{onClick:f,children:(0,u.jsxs)("div",{className:"mt-2 flex items-center -space-x-4",children:[[h].concat((0,i.Z)(s)).map((function(e){return(0,u.jsx)(G.Z,(0,Y.Z)((0,a.Z)({showTooltip:!0,link:!1},e),{outerClassName:"bg-none bg-white"}),e.id)})),m&&(0,u.jsx)("div",{className:"z-10 h-10 w-10 rounded-full flex-center",children:(0,u.jsx)("div",{className:"h-8 w-8 rounded-full bg-white flex-center",children:(0,u.jsx)("div",{className:"h-7 w-7 rounded-full border border-dashed border-light-grey bg-white flex-center",children:(0,u.jsx)(p(),{src:R.pO,width:12,height:12})})})})]})}),(0,u.jsx)(le,{isOpen:r,setIsOpen:o,collection:t})]})};!function(e){e[e.Normal=0]="Normal",e[e.SelectionMode=1]="SelectionMode"}(r||(r={}));var de=(0,b.QM)({icon:{height:"1.25rem",margin:"0px 4px",position:"relative",width:"1.25rem","&:after":{border:"7px solid #333",borderColor:"#333 transparent transparent transparent",content:'""',display:"none",left:"2px",position:"relative",top:"-7px",transform:"translateY(-50%)"},"&:before":{borderRadius:"15px",background:"#333",color:"#fff",content:"attr(data-text)",display:"none",left:"-90px",padding:"5px",position:"absolute",textAlign:"center",top:"-27px",transform:"translateY(-50%)",width:"190px"},"&:hover:after":{display:"inline-block"},"&:hover:before":{display:"block"}},iconsContainer:{display:"flex",flexShrink:"0",justifyContent:"space-between"},title:(0,s.Z)({fontSize:"1.5rem",marginLeft:"8px"},A.Z.tablet,{fontSize:"2rem"}),titleContainer:{alignItems:"center",display:"flex"}}),ue=function(e){var t=e.collection,n=e.isPickingFeaturedProduct,s=e.setIsPickingFeaturedProduct,a=e.featuredProduct,i=e.setFeaturedProduct,c=e.pageState,m=e.setPageState,x=e.selectedProductIds,v=e.brands,b=e.brandsQuery,w=e.setBrandsQuery,j=e.selectedBrands,N=e.setSelectedBrands,k=e.canLoadMoreBrands,I=e.handleLoadMoreBrands,Z=e.loadingMoreBrands,P=de(),F=(0,C.Eu)().user,B=(0,g.useContext)(y._).showSignupModal,A=(0,g.useContext)(T.E),z=A.showMessage,_=A.showError,H=(0,g.useState)(!1),Q=H[0],Y=H[1],G=(0,g.useState)(!1),V=G[0],J=G[1],K=(0,l.Z)((0,D.UdB)({notifyOnNetworkStatusChange:!0}),2),X=K[0],$=K[1].loading,ee=(0,l.Z)((0,D.s2B)(),2),te=ee[0],ne=ee[1].loading,re=(0,l.Z)((0,D.MTS)(),2),oe=re[0],se=re[1].loading,ae=(0,l.Z)((0,D.Ejf)(),2),le=ae[0],ie=ae[1],ue=ie.data,he=ie.fetchMore,me=ie.networkStatus,fe=(0,g.useMemo)((function(){return(null===ue||void 0===ue?void 0:ue.collectionFollowers)||[]}),[null===ue||void 0===ue?void 0:ue.collectionFollowers]),xe=1===x.length?"Delete 1 product":"Delete ".concat(x.length," products"),pe=function(){var e=(0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,X({variables:{productIds:x},update:function(e,n){var r=n.data;(null===r||void 0===r?void 0:r.deleteManySavedProducts)&&F&&U.h.updateAfterDeleteProducts(t,x,F.id)},onCompleted:function(e){z("Successfully deleted ".concat(e.deleteManySavedProducts.length," products")),m(r.Normal),J(!1)},onError:_});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ve=function(){var e=(0,o.Z)(d().mark((function e(){var n;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=function(){var e=(0,o.Z)(d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.currentUserIsFollowing){e.next=5;break}return e.next=3,oe({variables:{collectionId:t.id},onCompleted:function(){z("Successfully unfollowed collection ".concat(t.name))},onError:_});case 3:e.next=7;break;case 5:return e.next=7,te({variables:{collectionId:t.id},onCompleted:function(){z("Successfully followed collection ".concat(t.name))},onError:_});case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),F){e.next=6;break}return B(void 0,(function(){n()})),e.abrupt("return");case 6:return e.next=8,n();case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ge=(0,g.useMemo)((function(){return t.currentUserIsCreator||t.currentUserIsCollaborator}),[t]),be=(0,g.useMemo)((function(){return!(null===ue||void 0===ue?void 0:ue.collectionFollowers)||[h.I.loading,h.I.setVariables,h.I.refetch].includes(me)}),[ue,me]),we=t.name,je=t.visibility,Ce=t.giftable,ye=t.currentUserIsCollaborator,Ne=t.currentUserIsCreator,ke=t.description,Se=(0,g.useState)(!1),Ie=Se[0],Ze=Se[1],Oe=(0,g.useCallback)((function(){(Ne||ye)&&Ze(!0),f.Z.set("hasSeenSendHintCTA","true",{expires:365})}),[ye,Ne]);return(0,g.useEffect)((function(){"true"===f.Z.get("hasSeenSendHintCTA")&&Ze(!0)}),[]),(0,u.jsxs)(u.Fragment,{children:[n?(0,u.jsx)("div",{className:"flex flex-col items-center justify-center",children:(0,u.jsx)("h4",{className:"flex items-center space-x-2 px-4 text-center text-h4 md:px-10 lg:px-16",children:"Select an image to use as your featured image"})}):(0,u.jsxs)("div",{className:"flex flex-col items-center justify-center",children:[(0,u.jsxs)("div",{className:P.titleContainer,children:[(je===D.u2U.Private||Ce)&&(0,u.jsxs)("div",{className:P.iconsContainer,children:[je===D.u2U.Private&&(0,u.jsx)("div",{className:P.icon,"data-text":"This collection is private",children:(0,u.jsx)(p(),{alt:"private",src:R.mB,layout:"fill"})}),Ce&&(0,u.jsx)("div",{className:P.icon,"data-text":"This collection is giftable",children:(0,u.jsx)(p(),{alt:"giftable",src:R.Og,layout:"fill"})})]}),(0,u.jsx)("h1",{className:P.title,children:we})]}),!t.currentUserIsCreator&&(0,u.jsx)("p",{className:"mt-1 text-ellipsis whitespace-pre-wrap text-center text-body-sm text-light-grey",children:"Last updated ".concat((0,L.VG)(t.updatedAt)," ago")}),(0,u.jsx)(ce,{collection:t}),ke&&ke.length&&(0,u.jsx)("h2",{className:"mt-6 max-h-20 max-w-md overflow-hidden text-ellipsis whitespace-pre-wrap text-center text-body-sm",children:ke}),ge&&t.followerCount>0&&(0,u.jsx)(S.Z,{buttonClassName:"mt-4",type:"collectionFollowers",users:fe,count:t.followerCount,isCurrentUser:ge,isLoading:be,onInfiniteScroll:function(){var e=fe[fe.length-1];he({variables:{collectionId:t.id,cursor:{collectionId_userId:{collectionId:t.id,userId:e.id}},take:25,skip:1}})},onClick:function(){ue||le({variables:{collectionId:t.id,take:25,skip:0}})}}),(0,u.jsxs)("div",{className:"mt-4 flex flex-row gap-2",children:[(t.visibility!==D.u2U.Private&&F||ye||Ne)&&(0,u.jsx)(M.Z,{onClick:function(){m(r.Normal),Ie||!ye&&!Ne||Oe()},sharable:t,size:"lg",showCTA:!Ie&&(Ne||ye),ctaPosition:"bottom",onCTAClicked:Oe}),!ye&&!Ne&&t.visibility!==D.u2U.Private&&(0,u.jsx)(E.Z,{solid:!t.currentUserIsFollowing,onClick:ve,className:"min-w-20",loading:ne||se,children:t.currentUserIsFollowing?"Unfollow Collection":"Follow Collection"}),(ye||Ne)&&(0,u.jsx)(u.Fragment,{children:(0,u.jsx)(E.Z,{onClick:function(){Y(!0),m(r.Normal)},children:"Edit"})})]}),(0,u.jsxs)("div",{className:"mt-8 flex w-full flex-col justify-start gap-2 px-0 sm:flex-row sm:items-center sm:px-6 md:px-12",children:[(t.currentUserIsCreator||t.currentUserIsCollaborator)&&(0,u.jsxs)("div",{className:"m-0 flex flex-row justify-start gap-2 p-0",children:[(0,u.jsx)(E.Z,{onClick:function(){return m(c!==r.SelectionMode?r.SelectionMode:r.Normal)},solid:c!==r.SelectionMode,children:c===r.SelectionMode?"Cancel":"Select"}),c===r.SelectionMode&&(0,u.jsx)(E.Z,{className:"bg-redorange text-grey",disabled:!x.length,onClick:function(){J(!0)},children:xe})]}),(0,u.jsx)("div",{className:"flex flex-1"}),(0,u.jsx)("div",{className:"m-0 flex flex-row justify-start gap-2 p-0",children:(0,u.jsx)(q.Z,{brands:v,selectedBrands:j,onBrandsSelected:function(e){N(e)},searchQuery:b,onSearchQueryChanged:function(e){w(e)},canLoadMore:k,onReachedEnd:I,loadingMore:Z})})]})]}),(0,u.jsx)(W,{isOpen:Q&&!n,setIsOpen:Y,collection:t,onPickFeaturedImageClick:function(){s(!0)},featuredProduct:a,setFeaturedProduct:i}),(0,u.jsx)(O.Z,{isOpen:V,setIsOpen:J,title:"".concat(xe),message:"Deleted products will be permanently removed from your collection and profile!",confirmText:"Delete",onConfirm:pe,onCancel:function(){J(!1)},dismissOnButtonPress:!1,loading:$})]})},he=!0,me=function(e){var t=e.error,n=(0,v.useRouter)(),s=(0,g.useContext)(T.E).showError,l=(0,g.useState)(r.Normal),c=l[0],f=l[1],x=(0,g.useState)([]),b=x[0],C=x[1],y=(0,g.useState)(!0),S=y[0],O=y[1],E=n.query.username,M=n.query.collectionSlug,U=n.query.collaboratorInviteCode,L=n.query.shareCode||null,A=(0,g.useState)(!1),z=A[0],_=A[1],H=(0,g.useState)(!1),W=H[0],q=H[1],Y=(0,g.useState)(null),G=Y[0],V=Y[1],J=(0,D.khb)({variables:{where:{},userSlug:E},skip:!E}),K=J.data,X=J.loading;(0,g.useEffect)((function(){t&&s(new Error(t))}),[t,s]);var $=(0,D.aG9)({variables:{slugs:{user:E,collection:M},shareCode:L,collaboratorInviteCode:U},notifyOnNetworkStatusChange:!0,skip:X||!K,onError:function(e){if("No Collection found"===e.message){var t=(0,a.Z)({},n.query);delete t.username,delete t.collectionSlug,delete t.shareCode,delete t.collaboratorInviteCode,n.replace({pathname:"/users/".concat(E),query:t},void 0,{scroll:!1,shallow:!0})}}}).data,ee=(0,g.useState)(""),te=ee[0],ne=ee[1],re=(0,D.Szh)({skip:!(null===$||void 0===$?void 0:$.collectionFromSlug.id),variables:{collectionId:(null===$||void 0===$?void 0:$.collectionFromSlug.id)||"",term:te,take:25,skip:0},notifyOnNetworkStatusChange:!0}),oe=re.data,se=re.loading,ae=re.fetchMore,le=re.networkStatus,ie=(0,B.Z)({data:null===oe||void 0===oe?void 0:oe.merchantsSavedByCollection,networkStatus:le,loading:se}),ce=ie.fetchingMore,de=ie.isLoading,he=ie.hasReachedEnd,me=(0,g.useMemo)((function(){return(null===oe||void 0===oe?void 0:oe.merchantsSavedByCollection.filter((function(e,t){return!e.merchant||oe.merchantsSavedByCollection.findIndex((function(t){var n,r;return(null===(n=t.merchant)||void 0===n?void 0:n.id)===(null===(r=e.merchant)||void 0===r?void 0:r.id)}))===t})))||[]}),[null===oe||void 0===oe?void 0:oe.merchantsSavedByCollection]),fe=(0,g.useState)([]),xe=fe[0],pe=fe[1],ve=(0,g.useMemo)((function(){return xe.flatMap((function(e){return e.merchant?e.merchant.domains:[e.domain]}))}),[xe]);(0,g.useEffect)((function(){c!==r.SelectionMode&&C([])}),[c]);var ge=(0,D.gaN)({skip:!(null===$||void 0===$?void 0:$.collectionFromSlug.id),variables:{collectionId:(null===$||void 0===$?void 0:$.collectionFromSlug.id)||"",shareCode:L||void 0,orderBy:[{createdAt:D.Asd.Desc},{id:D.Asd.Asc}],take:25,skip:0,filters:{domains:ve}},notifyOnNetworkStatusChange:!0,onCompleted:function(){S&&O(!1)},onError:s}),be=ge.data,we=ge.fetchMore,je=ge.networkStatus,Ce=ge.loading,ye=(0,B.Z)({data:(null===be||void 0===be?void 0:be.collectionSavedProducts)||[],networkStatus:je,loading:Ce}),Ne=ye.hasReachedEnd,ke=ye.isLoading,Se=ye.fetchingMore,Ie=(0,g.useMemo)((function(){return Ce||S||[h.I.loading,h.I.refetch].includes(je)}),[Ce,S,je]),Ze=(0,g.useCallback)((function(){if(me.length){var e=me.length;ae({variables:{skip:e}})}}),[me.length,ae]),Oe=$?[{title:$.collectionFromSlug.user.name,path:$.collectionFromSlug.user.path},{title:"Collections",path:$.collectionFromSlug.user.path+"/collections"},{title:$.collectionFromSlug.name,path:$.collectionFromSlug.path}]:[];(0,g.useEffect)((function(){_("string"===typeof U&&!(null===$||void 0===$?void 0:$.collectionFromSlug.currentUserIsCollaborator))}),[U,$]);var Ee=(0,g.useMemo)((function(){return be?be.collectionSavedProducts:[]}),[be]),Pe={isPickingFeaturedProduct:W,setIsPickingFeaturedProduct:q,featuredProduct:G,setFeaturedProduct:V,pageState:c,setPageState:f,selectedProductIds:b,brands:me,brandsQuery:te,setBrandsQuery:ne,selectedBrands:xe,setSelectedBrands:pe,canLoadMoreBrands:!he&&!de&&!ce&&me.length>0,handleLoadMoreBrands:Ze,loadingMoreBrands:ce};return(0,u.jsxs)(Z.Z,{children:[$&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)("div",{className:"p-4 sm:px-10 md:px-16 md:py-8",children:(0,u.jsx)(N.Z,{crumbs:Oe})}),(0,u.jsx)("div",{className:"flex flex-col justify-between bg-cover p-4",children:(0,u.jsx)(ue,(0,a.Z)({collection:$.collectionFromSlug},Pe))}),Ee.length?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(P.Z,{children:Ee.map((function(e){return(0,u.jsxs)("div",{className:"relative",children:[(0,u.jsxs)("div",{className:(0,j.m)(W&&"pointer-events-none"),children:[(0,u.jsx)(k.Z,{product:e,isInCollectionView:!0,pageName:"collection"}),c===r.SelectionMode&&(0,u.jsx)(m.r,{checked:b.includes(e.id),onChange:function(t){var n=(0,i.Z)(b);if(t)n.push(e.id);else{var r=n.indexOf(e.id);r>-1&&n.splice(r,1)}C(n)},as:g.Fragment,children:function(t){var n=t.checked;return(0,u.jsxs)("button",{className:"absolute inset-0",children:[n&&(0,u.jsx)("div",{className:"absolute inset-0 bottom-auto w-full rounded-md backdrop-contrast-50 backdrop-saturate-50 md:rounded-lg",style:{aspectRatio:"".concat(e.media.width,"/").concat(e.media.height)}}),(0,u.jsx)("div",{className:(0,j.m)("absolute right-4 top-4 h-8 w-8 rounded-sm border border-light-grey bg-cream/80 flex-center",n&&"border-none bg-redorange"),children:n&&(0,u.jsx)("div",{className:"relative h-5 w-5",children:(0,u.jsx)(p(),{src:R.nQ,className:"invert",layout:"fill"})})})]})}})]}),W&&(0,u.jsx)("button",{className:"absolute inset-0 bottom-1 rounded-lg hover:border-6 hover:border-lightblue hover:bg-lightblue/40 hover:shadow-xl",onClick:function(){V(e),q(!1)}})]},e.id)}))}),Ee.length>0&&!Ne&&!Se&&!ke&&(0,u.jsx)(w.df,{className:"-translate-y-96",onChange:function(){var e=(0,o.Z)(d().mark((function e(t){var n;return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Ee[Ee.length-1],!t){e.next=4;break}return e.next=4,we({variables:{skip:1,cursor:{id_createdAt:{id:n.id,createdAt:n.createdAt}}}});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()}),Se?(0,u.jsx)(I.Z,{}):null]}):Ie?(0,u.jsxs)(P.Z,{children:[(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.2"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.5"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.3"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.6"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.1"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.5"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.3"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.6"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.1"}}),(0,u.jsx)(F.O.Box,{className:"w-full",style:{aspectRatio:"1/1.5"}})]}):null]}),!!$&&(0,u.jsx)(Q,{isOpen:z,setIsOpen:_,collection:$.collectionFromSlug,collaboratorInviteCode:U})]})}}},function(e){e.O(0,[5177,1333,3738,9774,2888,179],(function(){return t=53438,e(e.s=t);var t}));var t=e.O();_N_E=t}]);