(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5434],{55241:function(e,t,n){"use strict";var a,r=n(94746);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(null,arguments)}t.Z=function(e){return r.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 16 16"},e),a||(a=r.createElement("path",{d:"M13 6.625V5.167h-1.429v1.458h-1.428v1.458H8.714v1.459H7.286V8.083H5.857V6.625H4.43V5.167H3v1.458h1.429v1.458h1.428v1.459h1.429V11h1.428V9.542h1.429V8.083h1.428V6.625z"})))}},16948:function(e,t,n){"use strict";var a,r,o=n(94746);function l(){return(l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(null,arguments)}t.Z=function(e){return o.createElement("svg",l({xmlns:"http://www.w3.org/2000/svg",width:16,height:16,fill:"currentColor",viewBox:"0 0 16 16"},e),a||(a=o.createElement("path",{d:"M2.5 2.5h1.571v1.571H2.5zm3.143 3.143H4.07V4.07h1.572zm1.571 1.571H5.643V5.643h1.571zm1.572 0H7.214v1.572H5.643v1.571H4.07v1.572H2.5V13.5h1.571v-1.571h1.572v-1.572h1.571V8.786h1.572v1.571h1.571v1.572h1.572V13.5H13.5v-1.571h-1.571v-1.572h-1.572V8.786H8.786zm1.571-1.571v1.571H8.786V5.643zM11.93 4.07v1.572h-1.572V4.07zm0 0V2.5H13.5v1.571z"})),r||(r=o.createElement("path",{d:"M12.429 3.571V3H13v.571zm-1.572 1.572V4.57h.572v.572zM9.286 6.714v-.571h.571v.571zm-1 1v.572h-.572v-.572zM6.143 6.143h.571v.571h-.571zM4.57 4.57h.572v.572H4.57zm-1-1H3V3h.571zm3.143 5.715v.571h-.571v-.571zm-1.571 1.571v.572H4.57v-.572zM3.57 12.43V13H3v-.571zm6.286-2.572h-.571v-.571h.571zm1 1h.572v.572h-.572zm1.572 1.572H13V13h-.571z"})))}},68304:function(e,t,n){"use strict";n.d(t,{GI:function(){return _},LM:function(){return f},Qi:function(){return A},Yo:function(){return v},by:function(){return E},l:function(){return d},zk:function(){return h}});var a=n(99616),r=n(29827),o=n(21770),l=n(58962),i=n(45345),s=n(71632),u=n(43577),c=n(39358);let d=function(){let{onMutate:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,r.NL)(),{setOpen:n,setContent:l}=(0,a.R)();return(0,o.D)({mutationKey:["assets","generate"],mutationFn:c.EO,onMutate:e,onSuccess:e=>{let n=t.getQueryData(["assets",{ordering:"-created"}])||[];t.setQueryData(["assets",{ordering:"-created"}],[e,...n])},onError:e=>{n(!0);let t=e.message;if((0,u.IZ)(e)){var a,r,o,i,s,c,d,E;(null===(r=e.response)||void 0===r?void 0:null===(a=r.data)||void 0===a?void 0:a.detail)?t=null===(c=e.response)||void 0===c?void 0:null===(s=c.data)||void 0===s?void 0:s.detail:(null===(i=e.response)||void 0===i?void 0:null===(o=i.data)||void 0===o?void 0:o.text)&&(t=null===(E=e.response)||void 0===E?void 0:null===(d=E.data)||void 0===d?void 0:d.text)}l({title:"Asset generation failed.",body:t})},onSettled:()=>{t.invalidateQueries({queryKey:["assets"]})}})},E=()=>{let e=(0,r.NL)(),{setOpen:t,setContent:n}=(0,a.R)();return(0,o.D)({mutationFn:c.zj,onError:()=>{t(!0),n({title:"Error!",body:"Failed to create game. Please try again later and let us know if the issue persists."})},onSettled:()=>{e.invalidateQueries({queryKey:["projects"]}),e.invalidateQueries({queryKey:["assets"]})}})},v=()=>{let e=(0,r.NL)();return(0,o.D)({mutationFn:c.QW,onSettled:()=>{e.invalidateQueries({queryKey:["published-projects"]})}})},_=(e,t)=>{let n=t?t.next:null,a=t?{pageParams:[1],pages:[{count:t.count,next:n,previous:null,results:t.results}]}:void 0;return(0,l.N)({queryKey:["published-projects",e],queryFn:t=>{let{pageParam:n}=t;return(0,c.Bg)({...e,page:n})},initialPageParam:1,getNextPageParam:e=>{if(e.next){let t=new URL(e.next).searchParams.get("page");return t?parseInt(t,10):void 0}},staleTime:3e5,initialData:a})},S={ordering:"-created",search:"",page_size:25},h=(e,t)=>(t={...S,...t},e.fetchInfiniteQuery({queryKey:["assets",t],queryFn:e=>{let{pageParam:n}=e;return(0,c.c7)({page:n,...t})},initialPageParam:1})),f=function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return e={...S,...e},(0,l.N)({queryKey:["assets",e],queryFn:t=>{let{pageParam:n}=t;return(0,c.c7)({page:n,...e})},initialPageParam:1,getNextPageParam:e=>{if(e.next){let t=new URL(e.next).searchParams.get("page");return t?parseInt(t,10):void 0}},placeholderData:i.Wk,enabled:t})},A=e=>(0,s.a)({queryKey:["asset-generation-models",e],queryFn:()=>(0,c._o)(e)})},14036:function(e,t,n){"use strict";var a,r,o,l,i,s,u,c,d,E,v,_,S,h,f,A;n.d(t,{AR:function(){return a},Cs:function(){return i},S:function(){return u},d0:function(){return r},h3:function(){return o},ji:function(){return l},oA:function(){return c}}),(d=a||(a={})).PHASER="Phaser",d.BABYLON="Babylon",d.VOXEL="Voxel",d.THREEJS="ThreeJS",(E=r||(r={})).Diff="diff",E.Standard="standard",(v=o||(o={})).Asset2DSD="asset-2d-dreambooth",v.Asset2DSDXL="asset-2d-sdxl",v.Asset3DShape="asset-3d-shape",v.Asset3DVoxel="asset-3d-voxel",v.AssetDummy="asset-2d-dummy",v.AssetSkybox="asset-skybox",(_=l||(l={})).CHARACTER_LLM_CALL="CHARACTER_LLM_CALL",_.SUBMIT_PROMPT_CALL="SUBMIT_PROMPT_CALL",(S=i||(i={})).LEGACY="LEGACY",S.USER_CHAT_MESSAGE="USER_CHAT_MESSAGE",S.ASSISTANT_CHAT_MESSAGE="ASSISTANT_CHAT_MESSAGE",S.INTENT_ASSIGNMENT="INTENT_ASSIGNMENT",S.CODE_GENERATION_MESSAGE="CODE_GENERATION_MESSAGE",S.ASSET_GENERATION_CANCELLATION="ASSET_GENERATION_CANCELLATION",S.ASSET_GENERATION="ASSET_GENERATION",S.ASSET_GENERATION_CONFIRMATION="ASSET_GENERATION_CONFIRMATION",S.ASSET_GENERATION_SUCCESS="ASSET_GENERATION_SUCCESS",S.ASSET_GENERATION_FAILED="ASSET_GENERATION_ERROR",S.PRE_RECORDED_RESPONSE_MESSAGE="PRE_RECORDED_RESPONSE_MESSAGE",S.PRE_RECORDED_MESSAGE="PRE_RECORDED_MESSAGE",(h=s||(s={})).ASSET="ASSET",h.CHAT="CHAT",h.EDIT="EDIT",(f=u||(u={})).USER_MESSAGE="USER_MESSAGE",f.MESSAGE_CREATE="MESSAGE_CREATE",f.MESSAGE_UPDATE="MESSAGE_UPDATE",f.COMMIT_CREATE="COMMIT_CREATE",f.COMMIT_UPDATE="COMMIT_UPDATE",f.OPTIMISTIC_MESSAGE_UPDATE="OPTIMISTIC_MESSAGE_UPDATE",f.EXCEPTION="EXCEPTION",f.PRE_RECORDED_MESSAGE="PRE_RECORDED_MESSAGE",(A=c||(c={})).ACTIVE="ACTIVE",A.CLOSED="CLOSED",A.CANCELLED="CANCELLED",A.ERRORED="ERRORED"},34445:function(e,t,n){"use strict";n.d(t,{a:function(){return o},d:function(){return l}});let a=[],r=[];a=["/audio/click-1.wav","/audio/click-2.wav","/audio/click-3.wav"].map(e=>new Audio(e)),r=["/audio/bot-message-1.wav","/audio/bot-message-2.wav"].map(e=>{let t=new Audio(e);return t.volume=.1,t});let o=()=>{let e=Math.floor(Math.random()*r.length);r[e].play()},l=()=>{let e=Math.floor(Math.random()*a.length);a[e].play()}},9383:function(e,t,n){"use strict";n.d(t,{Z:function(){return m}});var a,r,o,l,i=n(57437),s=n(61994),u=n(2265),c=n(39358),d=n(33930);let E=void 0!==(null===(a=window.webkit)||void 0===a?void 0:a.messageHandlers);async function v(e){let t=e.data.content;if(E){var n;null===(n=window.webkit)||void 0===n||n.messageHandlers.callbackHandler.postMessage({action:"IframeLocalStorageChanged",content:JSON.stringify(t)})}}var _=n(94746);function S(){return(S=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(null,arguments)}var h=function(e){return _.createElement("svg",S({xmlns:"http://www.w3.org/2000/svg",width:22,height:22,fill:"none",viewBox:"0 0 22 22"},e),r||(r=_.createElement("path",{fill:"#FAFEAE",fillRule:"evenodd",d:"M11.917 2.75h7.333v7.333h-1.833V6.417h-1.834V4.583h-3.666zm-7.334 9.167v3.666h1.834v1.834H4.583h5.5v1.833H2.75v-7.333zM19.25 11.917v7.333h-7.333v-1.833h3.666v-1.834h1.834v-3.666zm-9.167-7.334H6.417v1.833H4.583V4.583v5.5H2.75V2.75h7.333z",clipRule:"evenodd"})))};function f(){return(f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e}).apply(null,arguments)}var A=function(e){return _.createElement("svg",f({xmlns:"http://www.w3.org/2000/svg",width:22,height:22,fill:"none",viewBox:"0 0 22 22"},e),o||(o=_.createElement("path",{fill:"#FAFEAE",fillRule:"evenodd",d:"M11.917 11.917v7.333h1.833v-3.666h1.833V13.75h3.667v-1.833h-7.333m-3.667-5.5V2.75h1.833v7.333H2.75V8.25h5.5-1.833V6.417z",clipRule:"evenodd"})),l||(l=_.createElement("path",{fill:"#FAFEAE",fillRule:"evenodd",d:"M11.917 11.917v7.333h1.833v-3.666h1.833V13.75h3.667v-1.833h-7.333m-3.667-5.5V2.75h1.833v7.333H2.75V8.25h5.5-1.833V6.417zM11.917 10.083h7.333V8.25h-3.667V6.417H13.75V2.75h-1.833v7.333m-5.5 3.667H2.75v-1.833h7.333v7.333H8.25v-5.5 1.833H6.417z",clipRule:"evenodd"})))},g=n(61497),p=n.n(g),m=(0,u.forwardRef)(function(e,t){let{activeCode:n,projectId:a,canvasType:r,onEvalError:o,onScriptsLoaded:l,isPermanentFullScreen:_=!1}=e,[S,f]=(0,u.useState)(0),[g,m]=(0,u.useState)(),C=(0,u.useRef)(n),[w,R]=(0,u.useState)(!1),T=(0,u.useRef)(null);async function D(e){T.current&&T.current.contentWindow&&T.current.contentWindow.postMessage({action:"setLocalStorage",data:e},"*")}async function O(e){let t;let n=e.data.payload,a=e.data.requestId;try{t={blob:await (0,c.eP)(n)}}catch(e){console.error(e),t={message:"Error fetching asset generation response"}}e.source.postMessage({action:"ephemeralImageGenerationResponse",content:t,requestId:a},e.origin)}function y(){T.current&&T.current.contentWindow&&T.current.contentWindow.postMessage({action:"update",content:n},"*")}return(0,u.useImperativeHandle)(t,()=>T.current,[T]),(0,u.useEffect)(()=>{E&&(window.setIframeLocalStorage=D)},[]),(0,u.useEffect)(()=>{if(void 0===g){let e="".concat("https://canvas.play.rosebud.ai","/canvas/").concat(r);m(e+=("phaser"===r&&E?"_webkit":"")+window.location.hash)}},[g,r]),(0,u.useEffect)(()=>{async function e(e){let t;let n=e.data.payload;n.project_id=a;let r=e.data.requestId;try{t=await (0,c.QS)(n)}catch(n){var o,l;let e="Error fetching LLM response";(null===(o=n.response)||void 0===o?void 0:o.status)===403&&(null===(l=n.response.data)||void 0===l?void 0:l.detail)==="No more entitlements available"&&(function(){if(E){var e;null===(e=window.webkit)||void 0===e||e.messageHandlers.callbackHandler.postMessage({action:"NoEntitlementsRemaining"})}}(),e="Subscribe for unlimited messages"),console.error(n),t={message:e}}e.source.postMessage({action:"llmResponse",content:t,requestId:r},e.origin)}let t=async t=>{let{action:n}=t.data;"codeError"===n&&o&&o(t.data.content),"logProgress"===n&&(0,d.xw)(t.data.content.eventName,t.data.content.eventData),"scriptsLoaded"===n&&l&&l(t.data.content),"requestLLM"===n&&await e(t),"localStorageChanged"===n&&await v(t),"requestEphemeralImageGeneration"===n&&await O(t)};if(n)return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}},[o,n,l,a]),(0,u.useEffect)(()=>{n&&n!==C.current&&(f(e=>e+1),C.current=n)},[n]),(0,i.jsxs)("div",{className:(0,s.Z)(p().CanvasContainer,(w||_)&&p().FullScreen),children:[!_&&(0,i.jsx)("button",{onClick:()=>{R(e=>!e)},className:p().FullScreenButton,children:w?(0,i.jsx)(A,{}):(0,i.jsx)(h,{})}),(0,i.jsx)("iframe",{ref:T,src:g,className:p().RenderDiv,sandbox:"allow-scripts allow-same-origin allow-pointer-lock",onLoad:()=>setTimeout(y,100),allow:"clipboard-write"},S)]})})},16672:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var a=n(57437),r=n(49027),o=n(95098),l=n(16948),i=n(79927),s=n.n(i);function u(e){let{open:t,onOpenChange:n,children:i}=e;return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(r.fC,{open:t,onOpenChange:n,children:(0,a.jsxs)(r.h_,{children:[(0,a.jsx)(r.aV,{className:s().DialogOverlay}),(0,a.jsxs)(r.VY,{className:s().DialogContent,"aria-describedby":void 0,onOpenAutoFocus:e=>{t&&e.preventDefault()},children:[(0,a.jsx)(o.f,{children:(0,a.jsx)(r.Dx,{})}),i,(0,a.jsx)(r.x8,{asChild:!0,children:(0,a.jsx)("button",{className:s().DialogCloseButton,"aria-label":"Close",children:(0,a.jsx)(l.Z,{})})})]})]})})})}},89403:function(e,t,n){"use strict";n.d(t,{K:function(){return l}});var a=n(57437),r=n(2265),o=n(49598);let l=r.forwardRef(function(e,t){let{highContrast:n=!1,...r}=e;return(0,a.jsx)(o.S,{ref:t,...r,backgroundColor:n?"black":"midnight",hoverBackgroundColor:n?"plum":"electric-purple",borderColor:"gray",borderHoverColor:n?"white":"gray"})})},49598:function(e,t,n){"use strict";n.d(t,{S:function(){return c}});var a=n(57437),r=n(14036),o=n(34445),l=n(61994),i=n(2265),s=n(72831),u=n.n(s);let c=i.forwardRef(function(e,t){let{disabled:n,variant:i,active:s,muted:c,outlineStyle:d,className:E,backgroundColor:v,hoverBackgroundColor:_,focusBackgroundColor:S,borderColor:h,borderHoverColor:f,disabledBackgroundColor:A,...g}=e,p={...v&&{"--button-background-color":"var(--".concat(v,")")},..._&&{"--button-hover-background-color":"var(--".concat(_,")")},...S&&{"--button-focus-background-color":"var(--".concat(S,")")},...h&&{"--button-border-color":"var(--".concat(h,")")},...f&&{"--button-border-hover-color":"var(--".concat(f,")")},...A&&{"--button-disabled-background-color":"var(--".concat(A,")")}};return(0,a.jsx)("button",{...g,onMouseDown:t=>{c||(0,o.d)(),e.onMouseDown&&e.onMouseDown(t)},ref:t,className:(0,l.Z)(u().Button,{[u().Elevated]:"elevated"===i,[u().Active]:s},d&&{[u().Phaser]:d===r.AR.PHASER,[u().Babylon]:d===r.AR.BABYLON||d===r.AR.THREEJS,[u().Voxel]:d===r.AR.VOXEL},E),style:p,disabled:n})})},61497:function(e){e.exports={RenderDiv:"GenericCanvasContainer_RenderDiv__jNQLU",CanvasContainer:"GenericCanvasContainer_CanvasContainer__S_Z4E",FullScreen:"GenericCanvasContainer_FullScreen__J5Mqa",FullScreenButton:"GenericCanvasContainer_FullScreenButton__N1xQm",fadeAndScaleIn:"GenericCanvasContainer_fadeAndScaleIn__HU36K",fadeAndScaleOut:"GenericCanvasContainer_fadeAndScaleOut__QDuRg"}},79927:function(e){e.exports={DialogOverlay:"DarkGlowDialog_DialogOverlay__cgRZs",DialogContent:"DarkGlowDialog_DialogContent__YOhet",DialogCloseButton:"DarkGlowDialog_DialogCloseButton__havqU",fadeIn:"DarkGlowDialog_fadeIn__jwTe_",fadeOut:"DarkGlowDialog_fadeOut__SSp_A",fadeAndScaleIn:"DarkGlowDialog_fadeAndScaleIn__NQNqI",fadeAndScaleOut:"DarkGlowDialog_fadeAndScaleOut__oqTMa"}},50019:function(e){e.exports={Tooltip:"Tooltip_Tooltip__kY3l_",DynamicWidth:"Tooltip_DynamicWidth__8omZY",TooltipArrow:"Tooltip_TooltipArrow__MoHLo",fadeAndScaleIn:"Tooltip_fadeAndScaleIn__I92b_",fadeAndScaleOut:"Tooltip_fadeAndScaleOut__0vkR0"}},72831:function(e){e.exports={Button:"StyledButton_Button___H6jS",Elevated:"StyledButton_Elevated___2hMJ",Active:"StyledButton_Active__uV6f1",ShareButton:"StyledButton_ShareButton__HVJQJ",Phaser:"StyledButton_Phaser__nJmhs",Babylon:"StyledButton_Babylon__Warfs",Voxel:"StyledButton_Voxel___efYo",fadeAndScaleIn:"StyledButton_fadeAndScaleIn__eb3OJ",fadeAndScaleOut:"StyledButton_fadeAndScaleOut__k7PMA"}}}]);