!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="8a8372b3-1ebd-4658-9a46-603e49c29ddf",e._sentryDebugIdIdentifier="sentry-dbid-8a8372b3-1ebd-4658-9a46-603e49c29ddf")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[385],{67115:function(e,t,n){Promise.resolve().then(n.bind(n,67213))},67213:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return I}});var l=n(27573),a=n(90553),r=n(7653),o=n(20524),i=n(6728),s=n(551),u=n(72819),d=n(86580);let c=()=>{let e=(0,r.useMemo)(()=>"relative h-full w-full overflow-hidden rounded-[21px] md:px-4",[]);return(0,l.jsx)("div",{className:e,children:(0,l.jsx)(d.O,{})})};var f=n(52423),h=n(65880),m=n(87659),b=n(67754),v=n(36466),x=n(61055);let p=()=>{let e=(0,b.useRouter)(),{isMobile:t}=(0,i.eI)(),{user:n}=(0,a.SX)(),{updateUser:o}=(0,a.By)(),[s,u]=(0,r.useState)(!1),{receiverAddress:d}=(0,i.Ac)(),c=(0,r.useMemo)(()=>"user:".concat(null==n?void 0:n.userId),[null==n?void 0:n.userId]),{mutation:p}=(0,i.Ij)({query:v.bN,variables:{data:{name:(0,i.PS)(),receiver:d,avatarMetadata:[Math.floor(6*Math.random())+1,Math.floor(10*Math.random())+1,Math.floor(9*Math.random())+1,Math.floor(28*Math.random())+1,1,1]}}}),g=(0,r.useCallback)(()=>{s||(p.mutate(),u(!0))},[s,p]),y=(0,r.useCallback)(async e=>{let t="".concat("https://core-storage.doodles.app","/doodles/screenshots/").concat(e,"/page_").concat(e,".png?").concat(new Date().getTime());await o({metadata:{...null==n?void 0:n.metadata,primaryAvatar:e,pfp:{url:t,type:"image"}}})},[o,null==n?void 0:n.metadata]);(0,f.EM)(c,t=>{if("mintAvatar"===t.data.type){var n;let l=null===(n=t.data.transactionOutput)||void 0===n?void 0:n.tokenId;l&&(y(l),e.push("/avatar/".concat(l,"/faces")))}});let j=(0,r.useMemo)(()=>t?500:622,[t]);return(0,l.jsxs)("div",{className:(0,i.tw)("relative flex h-full w-full items-center justify-center rounded-[21px] bg-[#765cdb]"),children:[(0,l.jsx)(h.default,{src:"".concat("https://core-storage.doodles.app","/stoodio/soul/soulAnimated.gif"),alt:"Doodle Starter",height:j,width:j,className:"aspect-square md:h-[622px]"}),(0,l.jsxs)("div",{className:(0,i.tw)("absolute bottom-4 right-4 flex h-[65px] gap-4","md:bottom-6 md:right-6 md:h-[70px] md:gap-6"),children:[(0,l.jsx)(m.default,{href:"/collection/packs",children:(0,l.jsx)(x.hU,{icon:"collectible2-fill",label:"Collection",fontSize:"small",theme:"secondary"})}),(0,l.jsx)("div",{onClick:g,className:(0,i.tw)(s?"hover:cursor-not-allowed":"hover:cursor-pointer"),children:(0,l.jsx)(x.hU,{icon:"expression",label:"Create",fontSize:"small",theme:"secondary",folder:"v3",isLoading:s})})]})]})};var g=n(81086),y=n(9306),j=n(49253),w=n(47298),k=n(67172);let C=()=>{var e,t;let{isMobile:n}=(0,i.eI)(),{user:o}=(0,a.SX)(),s=(0,g.b9)(j.UH),u=(0,g.Dv)(j.fU);(0,k.N)();let{avatarReady:d,avatarLoading:c}=(0,w.X)(),f=(0,r.useMemo)(()=>(null==o?void 0:o.verifiedCredentials.map(e=>e.address).filter(e=>void 0!==e))||[],[null==o?void 0:o.verifiedCredentials]),{data:h}=(0,y.V3)({addresses:f,collections:["Avatar"],chain:"base",dataSource:"onchain"});(0,r.useEffect)(()=>{h&&s(h.find(e=>e.tokenId===(null==o?void 0:o.metadata).primaryAvatar)||h[0])},[h,s,null==o?void 0:o.metadata]);let b=(0,r.useMemo)(()=>{var e,t,n;return(null==u?void 0:null===(t=u.background)||void 0===t?void 0:null===(e=t.image)||void 0===e?void 0:e.url)?"url(".concat(null==u?void 0:null===(n=u.background)||void 0===n?void 0:n.image.url,")"):"url(".concat("https://core-storage.doodles.app","/stoodio/backgrounds/greyish.svg)")},[null==u?void 0:null===(t=u.background)||void 0===t?void 0:null===(e=t.image)||void 0===e?void 0:e.url]);return u&&!c&&d?(0,l.jsxs)("div",{className:(0,i.tw)("bg-mint-400 relative flex h-full items-start","justify-center overflow-hidden rounded-[21px]","bg-cover bg-center bg-no-repeat"),style:{backgroundImage:b},children:[(0,l.jsx)("div",{className:"h-max w-max",children:(0,l.jsx)(x.qE,{width:n?600:900,height:n?600:700,data:u})}),(0,l.jsx)("div",{className:"absolute bottom-4 right-4 h-max md:bottom-6 md:right-6 md:h-[70px]",children:(0,l.jsxs)("div",{className:"flex flex-col gap-4 md:flex-row",children:[(0,l.jsx)(m.default,{className:"hidden md:block",href:"/collection/packs",children:(0,l.jsx)(x.hU,{label:"Collection",icon:"collectible2-fill",theme:"secondary",fontSize:"small"})}),(0,l.jsx)(m.default,{href:"/avatar/".concat((null==o?void 0:o.metadata).primaryAvatar||(null==h?void 0:h[0].tokenId),"/wearables"),children:(0,l.jsx)(x.hU,{label:"Style",icon:"style",theme:"secondary",folder:"v3"})}),(0,l.jsx)(m.default,{href:"/share/avatar/".concat(u.id),scroll:!1,children:(0,l.jsx)(x.hU,{label:"Share",icon:"share-black",folder:"v3"})})]})}),(0,l.jsx)(m.default,{className:"absolute bottom-4 left-4 block md:hidden",href:"/collection",children:(0,l.jsx)(x.hU,{label:"Collection",icon:"collectible2-fill",theme:"secondary",fontSize:"small"})})]}):null},N=()=>{let{hasAvatar:e,isLoading:t}=(0,u.$)();return(0,r.useMemo)(()=>t?(0,l.jsx)(c,{}):e?(0,l.jsx)(C,{}):(0,l.jsx)(p,{}),[e,t])};function I(){let{user:e}=(0,a.SX)(),{data:t}=(0,i.D9)({queryKey:["home","@slides"],query:o.no,variables:{id:"clwgrxx220ol208lim9z6u4li"},field:"homepage"}),n=(0,r.useMemo)(()=>t.slides,[t.slides]);return(0,l.jsx)("div",{className:(0,i.tw)("relative h-[calc(80vh-80px)] w-full md:mt-4 md:px-4"),children:e?(0,l.jsx)(N,{}):(0,l.jsx)(r.Suspense,{fallback:(0,l.jsx)(c,{}),children:(0,l.jsx)(s.r,{slides:n})})})}},49253:function(e,t,n){"use strict";n.d(t,{$M:function(){return a},Rz:function(){return u},UH:function(){return i},fU:function(){return r},tQ:function(){return s},x_:function(){return o}});var l=n(5565);let a={id:"",skinTone:0,hairColor:0,hairPinch:0,equippedWearables:[],background:{}},r=(0,l.cn)(a),o=(0,l.cn)(a),i=(0,l.cn)(null),s=(0,l.cn)(a),u=(0,l.cn)(null)},551:function(e,t,n){"use strict";n.d(t,{r:function(){return f}});var l=n(27573),a=n(24773),r=n(52414),o=n(65880),i=n(61055),s=n(6728),u=n(90553);let d=e=>{let{item:t}=e,{setShowAuthFlow:n,setShowDynamicUserProfile:a,handleLogOut:r}=(0,u.SX)();return"signOut"===t.buttonAction?(0,l.jsx)(i.zx,{onClick:()=>r(),extraClasses:"max-w-[220px] mx-auto md:mx-0",children:t.buttonText}):"openLogin"===t.buttonAction?(0,l.jsx)(i.zx,{onClick:()=>n(!0),extraClasses:"max-w-[220px] mx-auto md:mx-0",children:t.buttonText}):"openProfile"===t.buttonAction?(0,l.jsx)(i.zx,{onClick:()=>a(!0),extraClasses:"max-w-[220px] mx-auto md:mx-0",children:t.buttonText}):"externalLink"===t.buttonAction?(0,l.jsx)(i.zx,{as:"a",target:"_blank",href:t.buttonUrl,extraClasses:"max-w-[220px] mx-auto md:mx-0",children:t.buttonText}):(0,l.jsx)(i.zx,{as:"nextLink",href:t.buttonUrl,extraClasses:"max-w-[220px] mx-auto md:mx-0",children:t.buttonText})},c=e=>{let{item:t}=e,{isMobile:n}=(0,s.eI)(),{image:a,mobileImage:r,logo:u,title:c,subtitle:f,subtext:h,subtextIcon:m,buttonText:b}=t;return(0,l.jsx)("div",{style:{backgroundImage:"url(".concat(n&&(null==r?void 0:r.url)||a.url)},className:(0,s.tw)("relative h-full max-h-[calc(80vh-80px)] w-full rounded-[21px]","bg-cover bg-[center_top_30%] bg-no-repeat px-8 hover:cursor-grab","md:pl-20 md:pr-0"),children:(0,l.jsxs)("div",{className:(0,s.tw)("flex h-full w-full flex-col items-center justify-center gap-5","text-center text-white","md:w-2/3 md:items-start md:text-left lg:w-1/3"),children:[u?(0,l.jsx)("div",{className:(0,s.tw)(n?"bottomRight"===t.mobileLogoPosition?"absolute bottom-9 right-12":"block":"bottomRight"===t.desktopLogoPosition?"absolute bottom-9 right-12":"block"),children:(0,l.jsx)(o.default,{src:null==u?void 0:u.url,alt:"logo",width:300,height:300,className:"w-[200px]"})}):null,(0,l.jsx)("h2",{className:"text-4xl font-semibold md:text-5xl md:leading-[4rem]",children:c}),(0,l.jsx)("p",{className:"font-kumbh text-base md:text-lg",children:f}),b?(0,l.jsx)(d,{item:t}):null,(0,l.jsxs)("div",{className:(0,s.tw)("font-kumbh flex items-start justify-center gap-2 text-xs md:justify-start"),children:[m?(0,l.jsx)(i.JO,{folder:"v3",name:m,height:15,width:15}):null,(0,l.jsx)("p",{children:h})]})]})})},f=e=>{let{slides:t,delay:n=8e3}=e;return t?(0,l.jsx)("div",{className:"h-[calc(80vh-80px)] w-full",children:(0,l.jsx)(r.Y,{autoplayDelay:n,count:t.length,children:t.map((e,t)=>(0,l.jsx)(a.o5,{className:"h-full w-full",children:(0,l.jsx)(c,{item:e})},t))})}):null}},52414:function(e,t,n){"use strict";n.d(t,{Y:function(){return i}});var l=n(27573),a=n(7653);n(73542),n(26363);var r=n(50938),o=n(24773);let i=e=>{let{children:t,onSlideChange:n,autoplayDelay:i=5e3,count:s}=e,[u,d]=(0,a.useState)(!1);return(0,l.jsxs)(o.tq,{pagination:{clickable:!0,el:"#swiper-pagination",type:"bullets",bulletClass:"bg-white rounded-full h-4 w-4 opacity-60 hover:cursor-pointer",bulletActiveClass:"!bg-white !text-white !opacity-100 shadow-lg",renderBullet:function(e,t){return'<span class="'+t+'"></span>'}},slidesPerView:1,autoplay:{delay:i,disableOnInteraction:!1},modules:[r.tl,r.pt],className:"relative h-full w-full overflow-visible",mousewheel:!0,spaceBetween:30,onInit:e=>{e.pagination.init(),e.pagination.update(),d(!0)},onSlideChange:n,children:[t,u&&s>1?(0,l.jsx)("div",{className:"absolute bottom-4 left-0 z-10 w-full px-8 md:bottom-8",children:(0,l.jsx)("div",{id:"swiper-pagination",className:"flex justify-center gap-5"})}):null]})}},47298:function(e,t,n){"use strict";n.d(t,{X:function(){return c}});var l=n(81086),a=n(67754),r=n(7653),o=n(36466),i=n(20524),s=n(21054),u=n(6728),d=n(49253);let c=()=>{let e=(0,a.usePathname)().includes("/explore"),t=(0,l.Dv)(d.UH),n=(0,l.b9)(e?d.tQ:d.fU),c=(0,l.b9)(d.x_),[f,h]=(0,r.useState)(!1),[m,b]=(0,r.useState)(!0),v=(0,r.useMemo)(()=>s.bZ.find(e=>e.value===(null==t?void 0:t.structuredAttributes.skinTone)),[t]),{data:x,isLoading:p}=(0,u.r8)({queryKey:["wearables",null==t?void 0:t.tokenId,null==t?void 0:t.structuredAttributes.expression],query:o.VW,variables:{where:{name:{equals:null==t?void 0:t.structuredAttributes.expression}}},enabled:!!(null==t?void 0:t.structuredAttributes.expression),field:"getWearables"}),g=(0,r.useMemo)(()=>s.$Z.find(e=>e.value===(null==t?void 0:t.structuredAttributes.hairColor)),[t]),{data:y,isLoading:j}=(0,u.r8)({queryKey:["wearables",null==t?void 0:t.tokenId,null==t?void 0:t.structuredAttributes.hairStyle],query:o.VW,variables:{where:{name:{equals:null==t?void 0:t.structuredAttributes.hairStyle}}},enabled:!!(null==t?void 0:t.structuredAttributes.hairStyle),field:"getWearables"}),{data:w,isLoading:k}=(0,u.FU)({queryKey:["background",null==t?void 0:t.structuredAttributes.background],query:i.ZX,variables:{titleLookup:null==t?void 0:t.structuredAttributes.background},field:"backgroundItem",enabled:!!(null==t?void 0:t.structuredAttributes.background)}),{data:C,isLoading:N}=(0,u.r8)({queryKey:["wearables",null==t?void 0:t.tokenId,null==t?void 0:t.equippedWearables],query:o.UC,variables:{where:{intID:{in:null==t?void 0:t.equippedWearables.map(e=>Number(e.templateId))}}},enabled:!!(null==t?void 0:t.equippedWearables),field:"getWearables"}),I=(0,r.useCallback)((e,t,l,a,r,o,i)=>{var u,d,f,m;let v=o.map(t=>{var n,l;let a=null==e?void 0:null===(l=e.equippedWearables)||void 0===l?void 0:null===(n=l.find(e=>Number(e.templateId)===t.intID))||void 0===n?void 0:n.tokenId;return{...t,tokenId:void 0!==a?a:"",owner:"",equippedAvatarId:e.tokenId}}),x=null==v?void 0:v.some(e=>"HEAD"===e.platformPosition&&(0,s.Ui)(e));n({id:e.tokenId,skinTone:null!==(u=null==a?void 0:a.id)&&void 0!==u?u:0,hairColor:null!==(d=null==r?void 0:r.id)&&void 0!==d?d:0,hairPinch:x?1:0,background:i,equippedWearables:[...v,...t,...l]}),c({id:e.tokenId,skinTone:null!==(f=null==a?void 0:a.id)&&void 0!==f?f:0,hairColor:null!==(m=null==r?void 0:r.id)&&void 0!==m?m:0,hairPinch:x?1:0,background:i,equippedWearables:[...v,...t,...l]}),h(!0),b(!1)},[]);return(0,r.useEffect)(()=>{t&&x&&!p&&!j&&C&&!N&&w&&!k&&I(t,x,null!=y?y:[],v,g,C,w)},[t,x,g,y,p,j,v,I,C,N,w,k]),{avatarReady:f,avatarLoading:m}}},72819:function(e,t,n){"use strict";n.d(t,{$:function(){return r}});var l=n(9306),a=n(86860);let r=()=>{let{addresses:e}=(0,a.a)(),{data:t,loading:n}=(0,l.V3)({addresses:e,collections:["Avatar"],chain:"base",dataSource:"onchain"});return{hasAvatar:t&&(null==t?void 0:t.length)>0,isLoading:n}}},67172:function(e,t,n){"use strict";n.d(t,{N:function(){return o}});var l=n(81086),a=n(7653),r=n(49253);let o=()=>{let e=(0,l.b9)(r.fU);(0,a.useEffect)(()=>()=>{e(r.$M)},[e])}},86860:function(e,t,n){"use strict";n.d(t,{a:function(){return s}});var l=n(90553),a=n(7653),r=n(36466),o=n(6728);let i=(e,t)=>{var n;return e?t?(null===(n=e.verifiedCredentials)||void 0===n?void 0:n.map(e=>e.address).filter(e=>void 0!==e))||[]:e.wallets.ethereum.map(e=>e.address).filter(e=>void 0!==e)||[]:[]},s=function(){let{username:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{user:t}=(0,l.SX)(),n=!e,{data:s,isLoading:u}=(0,o.r8)({queryKey:["user",e],query:r.JA,variables:{where:{username:e}},field:"getUser",enabled:!!e}),d=(0,a.useMemo)(()=>n?null!=t?t:null:null!=s?s:null,[n,t,s]),c=(0,a.useMemo)(()=>d?i(d,n):[],[d,n]);return{user:d,isDynamicUser:n,addresses:c,isLoading:u}}},67754:function(e,t,n){"use strict";var l=n(534);n.o(l,"notFound")&&n.d(t,{notFound:function(){return l.notFound}}),n.o(l,"useParams")&&n.d(t,{useParams:function(){return l.useParams}}),n.o(l,"usePathname")&&n.d(t,{usePathname:function(){return l.usePathname}}),n.o(l,"useRouter")&&n.d(t,{useRouter:function(){return l.useRouter}}),n.o(l,"useSearchParams")&&n.d(t,{useSearchParams:function(){return l.useSearchParams}})},26363:function(){},52423:function(e,t,n){"use strict";let l;n.d(t,{jd:function(){return x},ms:function(){return p},EM:function(){return h}});var a=n(7653);let r=Symbol.for("__ABLY_CONTEXT__"),o="undefined"!=typeof globalThis?globalThis:{},i=((l=o[r])||(l=o[r]=a.createContext({})),l);function s(e="default"){let t=a.useContext(i)[e].client;if(!t)throw Error("Could not find ably client in context. Make sure your ably hooks are called inside an <AblyProvider>");return t}function u(e,t,n){let l=(0,a.useRef)(t);(0,a.useEffect)(()=>{l.current=t},[t]),(0,a.useEffect)(()=>(n?e.on(n,l.current):e.on(t),()=>{n?e.off(n,t):e.off(t)}),[e,n,t])}function d(e,t,n="default"){let l=s("string"==typeof t?t:n),a="function"==typeof t?t:e,r="function"!=typeof e?e:void 0;u(l.connection,a,r)}function c(e="default",t){let n=a.useContext(i)[e]._channelNameToChannelContext[t];if(!n)throw Error(`Could not find a parent ChannelProvider in the component tree for channelName="${t}". Make sure your channel based hooks (usePresence, useChannel, useChannelStateListener) are called inside a <ChannelProvider> component`);return n}function f(e,t,n){let{ablyId:l,channelName:a}="object"==typeof e?e:{channelName:e},{channel:r}=c(l,a);u(r,"function"==typeof n?n:t,"function"!=typeof t?t:void 0)}function h(e,t,n){let l="object"==typeof e?e:{channelName:e},r=s(l.ablyId),{channelName:o,skip:i}=l,{channel:u,derived:h}=c(l.ablyId,o),v=(0,a.useMemo)(()=>{if(!h)return u.publish.bind(u);let e=r.channels.get(o);return e.publish.bind(e)},[r.channels,h,u,o]),x="string"==typeof t?t:null,p="string"==typeof t?n:t,g=(0,a.useRef)(p),{connectionError:y,channelError:j}=function(e){let[t,n]=(0,a.useState)(null),[l,r]=(0,a.useState)(null);return d(["suspended","failed","disconnected"],t=>{var l;t.reason&&(null===(l=e.onConnectionError)||void 0===l||l.call(e,t.reason),n(t.reason))},e.ablyId),d(["connected","closed"],()=>{n(null)},e.ablyId),f(e,["suspended","failed","detached"],t=>{var n;t.reason&&(null===(n=e.onChannelError)||void 0===n||n.call(e,t.reason),r(t.reason))}),f(e,["attached"],()=>{r(null)}),{connectionError:t,channelError:l}}(l);return(0,a.useEffect)(()=>{g.current=p},[p]),(0,a.useEffect)(()=>{let e=g.current?e=>{g.current&&g.current(e)}:null,t=e?null===x?[e]:[x,e]:null;return!i&&t&&m(u,...t),()=>{!i&&t&&b(u,...t)}},[x,u,i]),{channel:u,publish:v,ably:r,connectionError:y,channelError:j}}async function m(e,...t){await e.subscribe(...t)}async function b(e,...t){await e.unsubscribe(...t)}var v=n(27573);let x=({client:e,children:t,ablyId:n="default"})=>{if(!e)throw Error("AblyProvider: the `client` prop is required");let l=a.useContext(i),r=(0,a.useMemo)(()=>Object.assign(Object.assign({},l),{[n]:{client:e,_channelNameToChannelContext:{}}}),[l,e,n]);return(0,v.jsx)(i.Provider,Object.assign({value:r},{children:t}))},p=({ablyId:e="default",channelName:t,options:n,deriveOptions:l,children:r})=>{let o=a.useContext(i),{client:s,_channelNameToChannelContext:u}=o[e];if(u[t])throw Error("You can not use more than one `ChannelProvider` with the same channel name");let d=!!l,c=d?s.channels.getDerived(t,l):s.channels.get(t),f=(0,a.useMemo)(()=>Object.assign(Object.assign({},o),{[e]:{client:s,_channelNameToChannelContext:Object.assign(Object.assign({},u),{[t]:{channel:c,derived:d}})}}),[d,s,c,t,u,e,o]);return(0,a.useLayoutEffect)(()=>{c.setOptions(Object.assign(Object.assign({},n),{params:Object.assign(Object.assign({},null==n?void 0:n.params),{agent:"react-hooks/2.4.1"})}))},[c,n]),(0,v.jsx)(i.Provider,Object.assign({value:f},{children:r}))}}},function(e){e.O(0,[6440,78,471,5752,4310,6705,5658,3317,3166,2792,2499,7798,1086,9033,938,2054,1055,524,5898,1293,9395,1744],function(){return e(e.s=67115)}),_N_E=e.O()}]);