(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1503],{91285:function(e,t,n){"use strict";var r,i,s=n(94746);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}t.Z=function(e){return s.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:16,height:17,fill:"none",viewBox:"0 0 16 17"},e),r||(r=s.createElement("path",{fill:"#FAFEAE",fillRule:"evenodd",d:"M2.364 16.092H1.182V14.91H0v-1.182h1.182v-1.182h1.182v1.182h12.454v1.182H2.364zM16 13.728h-1.182V9H16z",clipRule:"evenodd"})),i||(i=s.createElement("path",{fill:"#fff",fillRule:"evenodd",d:"M14.818 0h-1.182v1.182H1.182v1.181h12.454v1.182h1.182V2.363H16V1.182h-1.182zM1.182 2.364H0v4.728h1.182zM8.727 4H7.545v3.545H4v1.182h3.545v3.546h1.182V8.727h3.546V7.545H8.727zM2.364 16.092H1.182V14.91H0v-1.182h1.182v-1.182h1.182v1.182h12.454v1.182H2.364zM16 13.728h-1.182V9H16z",clipRule:"evenodd"})))}},17493:function(e,t,n){"use strict";var r,i,s=n(94746);function a(){return(a=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}t.Z=function(e){return s.createElement("svg",a({xmlns:"http://www.w3.org/2000/svg",width:18,height:18,fill:"none",viewBox:"0 0 18 18"},e),r||(r=s.createElement("path",{fill:"#fff",d:"M10.5 3.273v1.636H9V3.273zM13.5 1.636v1.637H12V1.636zM16.5 1.636v1.637H15V1.636zM16.5 4.91v1.635H15V4.91zM13.5 4.91v1.635H12V4.91zM16.126 11.455v1.636h-1.5v-1.636zM16.126 14.727v1.637h-1.5v-1.637zM16.5 0v1.636H12V0zM18 6.545h-1.5V1.636H18zM12 6.545h-1.5V1.636H12zM9.001 11.455v3.272H7.5v-3.272zM16.126 18h-4.5v-1.636h4.5zM17.626 11.455v4.909h-1.5v-4.91zM11.626 9.818h4.5v1.637h-4.5zM10.126 11.455h3v1.636h-3zM10.126 14.727h3v1.637h-3z"})),i||(i=s.createElement("path",{fill:"#fff",d:"M9.001 13.09h2.625v1.637H9.001zM9 3.273v3.272H7.5V3.273zM3 6.545v1.637H1.5V6.545zM6 6.545v1.637H4.5V6.545zM6 9.818v1.637H4.5V9.818zM3 9.818v1.637H1.5V9.818zM6 11.455v1.636H1.5v-1.636zM6 4.91v1.635H1.5V4.91zM7.5 11.455H6v-4.91h1.5zM1.5 11.455H0v-4.91h1.5zM12 6.545h4.5v1.637H12z"})))}},43952:function(e,t,n){Promise.resolve().then(n.bind(n,39253)),Promise.resolve().then(n.bind(n,11709))},39253:function(e,t,n){"use strict";n.d(t,{default:function(){return v}});var r=n(57437),i=n(68304),s=n(14036),a=n(9383),o=n(49598),c=n(91401),l=n(99616),u=n(99376),d=n(2265),h=n(1263),f=n.n(h),m=n(11709);function v(e){let{project:t}=e,{mutate:n}=(0,i.Yo)(),{requireSignIn:h,isSignedIn:v}=(0,c.Eu)(),{open:p,setOpen:g,setContent:_}=(0,l.R)(),x=(0,d.useRef)(!1),j=(0,d.useRef)(null),b=(0,u.useSearchParams)();return(0,d.useEffect)(()=>{t.id&&!x.current&&(n({project:t.id}),x.current=!0)},[n,t.id]),(0,d.useEffect)(()=>{let e=setInterval(()=>{let e=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{children:"Please note that your game progress will not be saved unless you are signed in.\n\nSign in to save progress on this device."}),(0,r.jsx)(o.S,{onClick:()=>h(),variant:"elevated",children:"Sign In"})]});v||p||(g(!0),_({title:"Important",body:e}))},3e5);return v&&(clearInterval(e),g(!1)),()=>{clearInterval(e)}},[v,_,p,g,h]),(0,r.jsx)("div",{className:f().FillScreenContainer,children:(0,r.jsx)(a.Z,{activeCode:t.published_code,projectId:t.id,canvasType:function(e){if(e==s.AR.BABYLON)return"babylon";if(e==s.AR.PHASER)return"phaser";if(e==s.AR.VOXEL)return"noa";if(e==s.AR.THREEJS)return"threejs";throw Error("Project mode not supported!")}(t.mode),ref:j,onScriptsLoaded:function(){!v&&j&&j.current&&j.current.contentWindow&&j.current.contentWindow.postMessage({action:"clearGameDataAndReset"},"*")},isPermanentFullScreen:"true"===b.get(m.Q)})})}},11709:function(e,t,n){"use strict";n.d(t,{Q:function(){return V},default:function(){return y}});var r=n(57437),i=n(68304),s=n(14036),a=n(55241),o=n(91285),c=n(17493),l=n(9383),u=n(33106),d=n.n(u),h=n(50019),f=n.n(h),m=n(89403),v=n(49598),p=n(91401),g=n(29006),_=n(61312),x=n(53974),j=n(61994),b=n(99376),w=n(2265),P=n(16672),M=n(31363),R=n.n(M);let S=e=>{let{project:t}=e,[n,i]=(0,w.useState)(!1),s=()=>{i(e=>!e)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(v.S,{onClick:s,className:R().GameInformationButton,variant:"elevated",children:"i"}),(0,r.jsx)(P.Z,{open:n,onOpenChange:s,children:(0,r.jsxs)("div",{className:R().InnerContainer,children:[(0,r.jsxs)("div",{className:R().InfoSection,children:[(0,r.jsx)("h1",{children:"Title"}),(0,r.jsx)("h2",{children:t.name})]}),t.source_project&&(0,r.jsxs)("div",{className:R().InfoSection,children:[(0,r.jsx)("h1",{children:"Remixed From"}),(0,r.jsx)("a",{href:"#",className:R().ClickableText,onClick:function(){var e;window.open("/games/".concat(null===(e=t.source_project)||void 0===e?void 0:e.id),"_blank")},children:t.source_project.name})]}),(0,r.jsxs)("div",{className:R().InfoSection,children:[(0,r.jsx)("h1",{children:"Created By"}),(0,r.jsx)("h2",{children:t.creator_username})]})]})})]})};var H=n(10577),O=n.n(H);let V="force-full-screen";function y(e){let{project:t}=e,{requireSignIn:n}=(0,p.Eu)(),[,u]=(0,x.m9)(),[h,P]=(0,w.useState)(!1),{mutate:M}=(0,i.Yo)(),R=(0,w.useRef)(!1),H=(0,w.useRef)(null),y=(0,w.useRef)(null),A=(0,i.by)(),C=(0,b.useSearchParams)(),I=(0,w.useRef)(null),[E,G]=(0,w.useState)(!1);(0,w.useEffect)(()=>{t.id&&!R.current&&(M({project:t.id}),R.current=!0)},[M,t.id]);let z=(0,r.jsx)(_.zt,{children:(0,r.jsxs)(_.fC,{delayDuration:500,children:[(0,r.jsx)(_.xz,{asChild:!0,children:(0,r.jsxs)(m.K,{onClick:()=>{n(()=>{(0,g.I)(t.id,A)})},variant:"elevated",children:[(0,r.jsx)(o.Z,{})," Remix"]})}),(0,r.jsx)(_.h_,{children:(0,r.jsxs)(_.VY,{className:f().Tooltip,sideOffset:5,side:"bottom",children:[(0,r.jsx)("p",{children:"Remix your own project"}),(0,r.jsx)(_.Eh,{className:f().TooltipArrow})]})})]})}),N=(0,r.jsxs)(m.K,{onClick:()=>{u("".concat(window.location.origin,"/games/").concat(t.id)),P(!0),setTimeout(()=>{P(!1)},2e3)},variant:"elevated",children:[(0,r.jsx)(c.Z,{})," ",h?"Url copied!":"Share"]}),k=(0,r.jsxs)(v.S,{className:O().ReadmoreButton,onClick:()=>{E?!y.current||(y.current.scrollIntoView({block:"start",inline:"nearest",behavior:"smooth"}),G(!1)):I.current&&(I.current.scrollIntoView({behavior:"smooth"}),G(!0))},variant:"elevated",children:[(0,r.jsx)(a.Z,{className:(0,j.Z)(E&&O().RotateArrowUp)}),E?"Back":"More"]});return(0,r.jsxs)("article",{className:O().PublishedGameViewContainer,children:[(0,r.jsxs)("header",{className:d().lgDown,children:[(0,r.jsxs)("div",{className:O().GameInformationContainer,children:[(0,r.jsx)("h1",{children:t.name}),(0,r.jsx)(S,{project:t})]}),(0,r.jsxs)("div",{className:O().GameHeaderActionsContainer,children:[z,N]})]}),(0,r.jsxs)("article",{className:O().GameFrame,children:[(0,r.jsx)("div",{ref:y,className:O().GameBody,children:(0,r.jsx)(l.Z,{activeCode:t.published_code,projectId:t.id,canvasType:function(e){if(e==s.AR.BABYLON)return"babylon";if(e==s.AR.PHASER)return"phaser";if(e==s.AR.VOXEL)return"noa";if(e==s.AR.THREEJS)return"threejs";throw Error("Project mode not supported!")}(t.mode),ref:H,isPermanentFullScreen:"true"===C.get(V),onScriptsLoaded:e=>{let t=null==e?void 0:e.aspectRatio;t&&y.current&&(y.current.style.aspectRatio=t.toString())}})}),(0,r.jsxs)("footer",{className:d().lgUp,children:[z,N,k]})]}),(0,r.jsxs)("div",{className:O().AsideContainer,children:[(0,r.jsx)("aside",{className:d().lgDown,children:(0,r.jsxs)("section",{children:[(0,r.jsx)("h2",{children:"Description"}),(0,r.jsx)("p",{children:t.description})]})}),(0,r.jsxs)("aside",{ref:I,className:d().lgUp,children:[(0,r.jsx)("section",{children:(0,r.jsx)("h1",{className:O().ProjectTitle,children:t.name})}),(0,r.jsxs)("section",{children:[(0,r.jsx)("h2",{children:"Created By"}),(0,r.jsx)("p",{children:t.creator_username})]}),(0,r.jsx)("section",{children:t.source_project&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h2",{children:"Remixed from"}),(0,r.jsx)("a",{href:"#",onClick:function(){var e;window.open("/games/".concat(null===(e=t.source_project)||void 0===e?void 0:e.id),"_blank")},children:t.source_project.name})]})}),(0,r.jsxs)("section",{children:[(0,r.jsx)("h2",{children:"Description"}),(0,r.jsx)("p",{children:t.description})]})]})]})]})}},29006:function(e,t,n){"use strict";async function r(e,t){let n=window.open(),r=await t.mutateAsync(e);(null==r?void 0:r.id)&&n?n.location="/projects/".concat(r.id):null==n||n.close()}n.d(t,{I:function(){return r}})},1263:function(e){e.exports={FillScreenContainer:"ActivationGameView_FillScreenContainer__88bIT",fadeAndScaleIn:"ActivationGameView_fadeAndScaleIn__eEqTF",fadeAndScaleOut:"ActivationGameView_fadeAndScaleOut__dCeGd"}},31363:function(e){e.exports={GameInformationButton:"InfoButton_GameInformationButton__QTdbx",InfoSection:"InfoButton_InfoSection__lCHjo",InnerContainer:"InfoButton_InnerContainer__Q_iW1",fadeAndScaleIn:"InfoButton_fadeAndScaleIn__QpkPu",fadeAndScaleOut:"InfoButton_fadeAndScaleOut__E7j1D"}},10577:function(e){e.exports={PublishedGameViewContainer:"PublishedGameView_PublishedGameViewContainer__UU_EG",GameInformationContainer:"PublishedGameView_GameInformationContainer__lH3sl",GameHeaderActionsContainer:"PublishedGameView_GameHeaderActionsContainer__XIcOl",GameFrame:"PublishedGameView_GameFrame__TxPtJ",GameBody:"PublishedGameView_GameBody__Ad6om",AsideContainer:"PublishedGameView_AsideContainer__oQFUi",ReadmoreButton:"PublishedGameView_ReadmoreButton__3jYEf",RotateArrowUp:"PublishedGameView_RotateArrowUp__PZM0Y",LoadingMessage:"PublishedGameView_LoadingMessage__O_ULf",fadeAndScaleIn:"PublishedGameView_fadeAndScaleIn___o0Mc",fadeAndScaleOut:"PublishedGameView_fadeAndScaleOut__EqP9K"}},33106:function(e){e.exports={lgUp:"Hidden_lgUp__qWWrr",lgDown:"Hidden_lgDown__Tsh_s",fadeAndScaleIn:"Hidden_fadeAndScaleIn__7sEIU",fadeAndScaleOut:"Hidden_fadeAndScaleOut__k2Zea"}},21636:function(e,t,n){"use strict";n.d(t,{Gm:function(){return i},Qy:function(){return o},ZF:function(){return c}});var r=n(45345);function i(e){return{onFetch:(t,n)=>{let i=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,c=t.state.data?.pages||[],l=t.state.data?.pageParams||[],u={pages:[],pageParams:[]},d=0,h=async()=>{let n=!1,h=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener("abort",()=>{n=!0}),t.signal)})},f=(0,r.cG)(t.options,t.fetchOptions),m=async(e,i,s)=>{if(n)return Promise.reject();if(null==i&&e.pages.length)return Promise.resolve(e);let a={queryKey:t.queryKey,pageParam:i,direction:s?"backward":"forward",meta:t.options.meta};h(a);let o=await f(a),{maxPages:c}=t.options,l=s?r.Ht:r.VX;return{pages:l(e.pages,o,c),pageParams:l(e.pageParams,i,c)}};if(o&&c.length){let e="backward"===o,t={pages:c,pageParams:l},n=(e?a:s)(i,t);u=await m(t,n,e)}else{let t=e??c.length;do{let e=0===d?l[0]??i.initialPageParam:s(i,u);if(d>0&&null==e)break;u=await m(u,e),d++}while(d<t)}return u};t.options.persister?t.fetchFn=()=>t.options.persister?.(h,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=h}}}function s(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function a(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function o(e,t){return!!t&&null!=s(e,t)}function c(e,t){return!!t&&!!e.getPreviousPageParam&&null!=a(e,t)}},58962:function(e,t,n){"use strict";n.d(t,{N:function(){return o}});var r=n(86900),i=n(21636),s=class extends r.z{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e,t){super.setOptions({...e,behavior:(0,i.Gm)()},t)}getOptimisticResult(e){return e.behavior=(0,i.Gm)(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:s,isRefetching:a,isError:o,isRefetchError:c}=r,l=n.fetchMeta?.fetchMore?.direction,u=o&&"forward"===l,d=s&&"forward"===l,h=o&&"backward"===l,f=s&&"backward"===l;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:(0,i.Qy)(t,n.data),hasPreviousPage:(0,i.ZF)(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:h,isFetchingPreviousPage:f,isRefetchError:c&&!u&&!h,isRefetching:a&&!d&&!f}}},a=n(85034);function o(e,t){return(0,a.r)(e,s,t)}},21770:function(e,t,n){"use strict";n.d(t,{D:function(){return d}});var r=n(2265),i=n(2894),s=n(18238),a=n(24112),o=n(45345),c=class extends a.l{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,o.VS)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,o.Ym)(t.mutationKey)!==(0,o.Ym)(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#s(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#s()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??(0,i.R)();this.#t={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#s(e){s.V.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context;e?.type==="success"?(this.#r.onSuccess?.(e.data,t,n),this.#r.onSettled?.(e.data,null,t,n)):e?.type==="error"&&(this.#r.onError?.(e.error,t,n),this.#r.onSettled?.(void 0,e.error,t,n))}this.listeners.forEach(e=>{e(this.#t)})})}},l=n(29827),u=n(51172);function d(e,t){let n=(0,l.NL)(t),[i]=r.useState(()=>new c(n,e));r.useEffect(()=>{i.setOptions(e)},[i,e]);let a=r.useSyncExternalStore(r.useCallback(e=>i.subscribe(s.V.batchCalls(e)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=r.useCallback((e,t)=>{i.mutate(e,t).catch(u.Z)},[i]);if(a.error&&(0,u.L)(i.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}},43577:function(e,t,n){"use strict";n.d(t,{IZ:function(){return d}});let{Axios:r,AxiosError:i,CanceledError:s,isCancel:a,CancelToken:o,VERSION:c,all:l,Cancel:u,isAxiosError:d,spread:h,toFormData:f,AxiosHeaders:m,HttpStatusCode:v,formToJSON:p,getAdapter:g,mergeConfig:_}=n(83464).default}},function(e){e.O(0,[8882,3839,2941,6514,4533,6182,8423,2610,3974,1401,5434,2971,2117,1744],function(){return e(e.s=43952)}),_N_E=e.O()}]);