PageSourceSearch

https://app.spaitial.ai/assets/_worldId-C6LU22Wr-344d37dac6c1.js

js spaitial.ai collected 2026-10-02 05:14:51 UTC 40,277 bytes, 45 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0f713-a023-7801-b8b8-a49dd0ef69dd")}catch(e){}}();const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-_TbRVc-i-344d37dac6c1.js","assets/react-D8xgUSms-344d37dac6c1.js","assets/tanstack-router-CEQu-TrB-344d37dac6c1.js","assets/tanstack-query-DTiRSa1W-344d37dac6c1.js","assets/icons-rJxGrmf1-344d37dac6c1.js","assets/radix-Dn5s4LcD-344d37dac6c1.js","assets/supabase-BcuDcHL0-344d37dac6c1.js","assets/viewer-ui-BntQHU_P-344d37dac6c1.js","assets/index-Bh1DGqOl-344d37dac6c1.js"])))=>i.map(i=>d[i]);
2import{x as M,a5 as Ca,m as Bt,a6 as Ue,a7 as w,a8 as Sa,a9 as Mt,aa as Na,ab as It,ac as At,ad as Da,ae as Gt,U as d,af as Ma,ag as _t,n as ke,o as je,q as Ce,ah as Ia,ai as Aa,aj as _a,ak as Ea,al as Fa,am as Pa,an as Wa,K as La,L as Oa,M as Ra,N as za,O as Ua,P as Ta,B as Et,ao as Ft,ap as K,aq as $a,ar as qa,as as Pt,J as ze,at as Va,au as Ba,av as Ga,aw as Wt,ax as I,ay as Qa,az as Ka,aA as Ya,_ as st}from"./index-_TbRVc-i-344d37dac6c1.js";import{r as i,j as e}from"./react-D8xgUSms-344d37dac6c1.js";import{L as Lt,y as Ha,x as Ja,v as Xa}from"./tanstack-router-CEQu-TrB-344d37dac6c1.js";import{u as ot,b as Za,c as V}from"./tanstack-query-DTiRSa1W-344d37dac6c1.js";import{u as er}from"./use-notifications-BFDMCiNG-344d37dac6c1.js";import{i as tr,d as Ot,F as ar,A as rr}from"./download-COrgWNIE-344d37dac6c1.js";import{s as Rt}from"./worlds-cache-wZpiVSgF-344d37dac6c1.js";import"./supabase-BcuDcHL0-344d37dac6c1.js";import{u as le,s as or,a as sr,b as nr}from"./generating-formats-store-DL_OG99a-344d37dac6c1.js";import{g as ir,c as Se}from"./product-analytics-B68illYy-344d37dac6c1.js";import{a as lr,g as dr,s as zt,Y as Ut,L as de,M as Tt,o as $t,$ as tt,a0 as at,a1 as cr,X as ur,z as mr}from"./icons-rJxGrmf1-344d37dac6c1.js";import"./radix-Dn5s4LcD-344d37dac6c1.js";import"./posthog-CTdkyuxI-344d37dac6c1.js";import"./textarea-Bxh9D9rR-344d37dac6c1.js";function pr(a){return ot({queryKey:M.worlds.list,queryFn:()=>Ca(),staleTime:300*1e3,enabled:a?.enabled??!0})}function rt(a="recommended"){return{loading:!0,progress:0,error:!1,lodLoadingText:null,qualityPreset:a}}const Qt="arcade-mobile-quality-banner-seen";function Kt(){if(typeof window>"u")return[];try{const a=window.localStorage.getItem(Qt);if(!a)return[];const n=JSON.parse(a);return Array.isArray(n)?n.filter(j=>typeof j=="string"):[]}catch{return[]}}function qt(a){return Kt().includes(a)}function Vt(a){if(!(typeof window>"u"))try{const n=Kt();if(n.includes(a))return;window.localStorage.setItem(Qt,JSON.stringify([...n,a]))}catch{}}const fr=i.lazy(()=>st(()=>import("./index-_TbRVc-i-344d37dac6c1.js").then(a=>a.cJ),__vite__mapDeps([0,1,2,3,4,5,6])).then(a=>({default:a.PlayCanvasSplatViewer}))),hr=i.lazy(()=>st(()=>import("./viewer-ui-BntQHU_P-344d37dac6c1.js").then(a=>a.v),__vite__mapDeps([7,0,1,2,3,4,5,6,8])).then(a=>({default:a.EditorToolbar}))),gr=i.lazy(()=>st(()=>import("./viewer-ui-BntQHU_P-344d37dac6c1.js").then(a=>a.v),__vite__mapDeps([7,0,1,2,3,4,5,6,8])).then(a=>({default:a.MobileControls})));function wr(){return e.jsx("div",{className:"flex min-h-svh flex-col items-center justify-center bg-black/55 backdrop-blur-sm",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(xr,{}),e.jsx("div",{role:"progressbar","aria-label":"Loading viewer","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":35,className:"relative h-2 w-48 overflow-hidden rounded-full bg-primary/20",children:e.jsx("div",{className:"h-full w-[35%] rounded-full bg-primary"})})]})})}function xr({size:a=64}){return e.jsxs("svg",{width:a,height:a,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("style",{children:`
3        .viewer-loader-core {
4          transform-origin: 32px 32px;
5          transform-box: fill-box;
6          animation: viewer-core-pulse 1.5s ease-in-out infinite alternate;
7        }
8        .viewer-orbit-x {
9          transform-origin: 32px 32px;
10          transform-box: fill-box;
11          animation: viewer-spin-x 3s linear infinite;
12        }
13        .viewer-orbit-y {
14          transform-origin: 32px 32px;
15          transform-box: fill-box;
16          animation: viewer-spin-y 4s linear infinite;
17        }
18        .viewer-orbit-z {
19          transform-origin: 32px 32px;
20          transform-box: fill-box;
21          animation: viewer-spin-z 8s linear infinite;
22        }
23        .viewer-compile-line-1 {
24          stroke-dasharray: 100;
25          animation: viewer-compile 2s ease-in-out infinite;
26        }
27        .viewer-compile-line-2 {
28          stroke-dasharray: 100;
29          animation: viewer-compile 2s ease-in-out infinite 1s;
30        }
31        @keyframes viewer-core-pulse {
32          0% { transform: scale(0.8); filter: drop-shadow(0 0 4px #3B82F6); }
33          100% { transform: scale(1.3); filter: drop-shadow(0 0 10px #2DD4BF); }
34        }
35        @keyframes viewer-spin-x { 100% { transform: rotateX(360deg); } }
36        @keyframes viewer-spin-y { 100% { transform: rotateY(360deg); } }
37        @keyframes viewer-spin-z { 100% { transform: rotateZ(360deg); } }
38        @keyframes viewer-compile {
39          0% { stroke-dashoffset: 100; opacity: 0; }
40          50% { stroke-dashoffset: 0; opacity: 1; filter: drop-shadow(0 0 4px #2DD4BF); }
41          100% { stroke-dashoffset: -100; opacity: 0; }
42        }
43      `}),e.jsx("circle",{cx:"32",cy:"32",r:"28",stroke:"#D1D5DB",strokeWidth:"1",strokeOpacity:"0.1"}),e.jsx("ellipse",{cx:"32",cy:"32",rx:"28",ry:"8",stroke:"#3B82F6",strokeWidth:"1.5",strokeOpacity:"0.6",className:"viewer-orbit-x"}),e.jsx("ellipse",{cx:"32",cy:"32",rx:"8",ry:"28",stroke:"#2DD4BF",strokeWidth:"1.5",strokeOpacity:"0.6",className:"viewer-orbit-y"}),e.jsx("circle",{cx:"32",cy:"32",r:"28",stroke:"#D1D5DB",strokeWidth:"1.5",strokeDasharray:"2 6",strokeOpacity:"0.3",className:"viewer-orbit-z"}),e.jsx("path",{d:"M 32 4 A 28 28 0 0 1 32 60 A 28 28 0 0 1 32 4",stroke:"#2DD4BF",strokeWidth:"2",fill:"none",strokeLinecap:"round",className:"viewer-compile-line-1"}),e.jsx("path",{d:"M 32 4 A 28 28 0 0 0 32 60 A 28 28 0 0 0 32 4",stroke:"#3B82F6",strokeWidth:"2",fill:"none",strokeLinecap:"round",className:"viewer-compile-line-2"}),e.jsx("circle",{cx:"32",cy:"32",r:"4.5",fill:"#2DD4BF",className:"viewer-loader-core"}),e.jsx("circle",{cx:"32",cy:"32",r:"2",fill:"#111114"})]})}function br(a){return a?.metadata?.arena??null}function yr(a){return a===I.QUEUED||a===I.BUILDING||a===I.MAP_READY||a===I.STARTING_SERVER}function vr({world:a,isOwner:n,user:j,accessDenied:ce=!1,requestedWorldId:u,worldsList:f,worldsLoading:z,onBack:x,onNavigate:Y,onLogoClick:Ne,onWorldSelect:Te,onDownload:De,downloadPending:r,generatingFormats:F,downloadingItems:H,panoramaUrl:U,inputImageUrl:$e,onEdit:J,shareUrl:C,onToggleVisibility:qe,onToggleListed:Ve,worldTitle:ue,worldDescription:Be,worldIsPublic:me,worldIsListed:Ge,worldAdminUnlisted:X,worldCreatedAt:pe,worldCreatorName:fe,worldModelAlias:Qe,worldInputSource:Me,devMode:O,onAnalyticsEvent:Ie,onRequestWalkMode:Z,walkModePending:b=!1,onRequestMinimap:he,minimapPending:P=!1,arenaAction:Ke,onFeedback:ee,chromeProfile:G="dashboard",versionPreview:p=!1}){const T=G==="capture",h=Bt(),Ae=Ue("splat-refine"),ge=Ue("embed-splat"),c=i.useRef(null),we=a?.viewer?.overrides?.qualityPreset??null,te=w(o=>Sa(o,a?.id,we)),[R,D]=i.useState(!1),[W,Q]=i.useState(()=>rt(te)),_e=W.loading||!!W.lodLoadingText,[ae,re]=i.useState(null),[xe,oe]=i.useState(!1),g=a?.viewer??null,y=!!g?.collision?.contentUrl,A=g?.format==="sog"||g?.format==="sog-lod",se=a?.viewer?.overrides?.cameraMode==="walk"&&A,[S,k]=i.useState(()=>se&&y?"walk":"fly"),[N,$]=i.useState(!1),[ne,_]=i.useState(()=>se&&!y),[Ye,E]=i.useState(!1),[t,s]=i.useState(!1),l=i.useRef(null),[m,L]=i.useState(!1),nt=Mt(o=>o.panelOpen),Ee=Mt(o=>o.setPanelOpen),[Fe,He]=i.useState(!1),[it,be]=i.useState(!1),[Yt,lt]=i.useState(!1),[Je,Pe]=i.useState(!0),[Xe,dt]=i.useState(null),ct=w(o=>o.fov),ut=w(o=>o.splatBudgetMillions),Ht=w(o=>o.showStats),Jt=w(o=>o.showCollision),mt=w(o=>o.setShowStats),Xt=w(o=>o.pointCloudMode),Zt=w(o=>o.normalMode),ea=w(o=>o.pointSizePx),We=w(o=>Na(o,a?.id)),pt=w(o=>o.setDollhouseRoofCutRatioForWorld),ta=w(o=>It(o,a?.id)),ft=a?.viewer?.overrides?.walkHeight??null,aa=ta??ft,ra=w(o=>At(o,a?.id)),ht=a?.viewer?.overrides?.walkSpeed??null,oa=ra??ht,sa=w(o=>o.setPointCloudMode),na=w(o=>o.setNormalMode),gt=w(o=>o.setQualityPresetForWorld),Le=`${a?.id??"none"}:${ut}`,ia=w(o=>o.coordinateFix);i.useEffect(()=>{if(p)return;const o=v=>{if(v.defaultPrevented||v.repeat||v.metaKey||v.ctrlKey||v.altKey||kr(v.target))return;if(v.key.toLowerCase()==="i"&&!v.shiftKey){mt(!w.getState().showStats);return}};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[mt,p]);const[la,da]=i.useState(a?.id),[ca,ua]=i.useState(Le),ma=!!(g?.minimap||Xe),wt=!p&&!P&&!!(j&&n&&he),Ze=!p&&A&&(ma||wt||P),et=Xe??g?.minimap,pa=A&&y,xt=!p&&!T&&!h,fa=Ue("measure"),[ha,bt]=i.useState(null),Oe=fa&&!p&&R&&!m&&(T||Da(a?.metadata)),ie=Oe&&!!a?.id&&ha===a.id,yt=ie&&!(h&&t),vt=()=>{!ie&&!h&&s(!1),bt(o=>o===a?.id?null:a?.id??null)},ga=i.useCallback(()=>bt(null),[]),Re=!p&&y,kt=!p&&!T&&Ae&&!h&&n&&!!j&&a?.status===Gt.COMPLETED;i.useEffect(()=>{Ee(!1)},[a?.id,Ee]),a?.id!==la&&(da(a?.id),D(!1),Q(rt(te)),re(null),oe(!1),k(se&&y?"walk":"fly"),_(se&&!y),dt(null),s(!1),L(!1),$(!1),He(!1),be(!1),Pe(a?.id?qt(a.id):!1)),Le!==ca&&(ua(Le),D(!1),Q(rt(te)),re(null)),i.useEffect(()=>{if(!A){_(!1),E(!1),S==="walk"&&k("fly");return}!ne||!y||(k("walk"),_(!1))},[A,y,S,ne]),i.useEffect(()=>{if(!a?.id||l.current===a.id||(l.current=a.id,!et))return;window.matchMedia("(max-width: 767px)").matches||s(!0)},[et,a?.id]);const q=i.useCallback(o=>{c.current?.exitDollhouseToOrigin?.({mode:o}),$(!1),k(o)},[]),jt=i.useCallback(()=>N?(q("fly"),!0):c.current?.enterDollhouse?.({durationMs:800,roofCutRatio:We})?(k("fly"),$(!0),!0):!1,[q,N,We]),wa=i.useCallback(o=>{a?.id&&pt(a.id,o),c.current?.setDollhouseRoofCutRatio?.(o)},[pt,a?.id]);i.useEffect(()=>{if(!a?.id){Pe(!0);return}Pe(qt(a.id))},[a?.id]),i.useEffect(()=>
43{p||!h||!a?.id||Je||W.qualityPreset==="highest"||Vt(a.id)},[h,Je,W.qualityPreset,p,a?.id]);const xa=i.useMemo(()=>({getMode:()=>c.current?.getAutoCameraMode()??"off",start:(o,v)=>c.current?.startAutoCamera(o,v),stop:()=>c.current?.stopAutoCamera()}),[]),Ct=i.useCallback(o=>{a?.id&&gt(a.id,o),c.current?.setLodQualityPreset(o),Q(v=>({...v,qualityPreset:o}))},[gt,a?.id]),ba=i.useCallback(async({roofCutRatio:o,coverageScale:v}={})=>{if(!!(j&&n)){await he?.();return}const ja=o!==void 0||v!==void 0?{roofCutRatio:o,coverageScale:v}:void 0,ve=await c.current?.captureTopDownMinimap?.(ja);ve&&dt(Dt=>(Dt?.imageUrl.startsWith("blob:")&&URL.revokeObjectURL(Dt.imageUrl),{imageUrl:URL.createObjectURL(ve.blob),bounds:ve.bounds,coordinateFrame:ve.coordinateFrame,projection:"orthographic-top",upAxis:"y",generatedAt:new Date().toISOString(),status:"ready"})),ve&&d.info("Map preview generated",{description:"Sign in as the world owner to save this map across reloads."})},[j,n,he]);if(!a)return ce&&j&&u?e.jsxs("div",{className:"flex min-h-svh flex-col items-center justify-center gap-4 bg-background px-6 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"This world isn't available to this account"}),e.jsx("p",{className:"max-w-md text-muted-foreground",children:"Sign in with the account that created this world, or ask its owner to share it with you."}),e.jsx(Lt,{to:"/login",search:{redirect:`/worlds/${u}`},className:"text-sm font-medium text-primary hover:underline",children:"Switch account"}),e.jsx("button",{onClick:()=>Y("/worlds"),className:"text-sm text-muted-foreground hover:underline",children:"Go to My Worlds"})]}):e.jsxs("div",{className:"flex min-h-svh flex-col items-center justify-center gap-4 bg-background",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"World not found"}),e.jsx("p",{className:"text-muted-foreground",children:"This world doesn't exist or is not publicly available."}),j?e.jsx("button",{onClick:()=>Y("/worlds"),className:"text-sm text-primary hover:underline",children:"Go to My Worlds"}):e.jsx(Lt,{to:"/",className:"text-sm text-primary hover:underline",children:"Go to Home"})]});if(!a.splat_url&&!g?.contentUrl)return e.jsxs("div",{className:"flex min-h-svh flex-col items-center justify-center gap-4 bg-background",children:[a.thumbnail_url?e.jsx("img",{src:a.thumbnail_url,alt:a.caption||"World thumbnail",className:"max-w-md rounded-lg"}):e.jsx("p",{className:"text-muted-foreground",children:"No splat available for this world"}),e.jsx("button",{onClick:x,className:"text-sm text-primary hover:underline",children:"Go back"})]});const St=g?.format==="sog"||g?.format==="sog-lod"||g?.format==="spz"?g.format:a.splat_url?"spz":void 0,Nt=g?.contentUrl??a.splat_url??void 0,ya=g?.transform??"none",ye=g?.overrides?.camera??null,va=ye?{position:ye.position,target:ye.target,fov:typeof ye.fov=="number"?ye.fov:ct}:void 0;return Nt&&St?e.jsx(i.Suspense,{fallback:e.jsx(wr,{}),children:e.jsxs("div",{className:"relative h-svh w-full overflow-hidden bg-black",children:[e.jsx(fr,{ref:c,contentUrl:Nt,format:St,collisionUrl:g?.collision?.contentUrl,cameraMode:S,walkModeHeight:aa,walkModeSpeed:oa,initialCamera:va,onCollisionUnavailable:()=>{c.current?.exitDollhouse?.(),$(!1),k("fly")},onDollhouseChange:(o,v)=>{$(o),k(v==="jump"?"walk":"fly")},showCollisionDebug:Jt&&y,background:[0,0,0],fov:ct,splatBudgetMillions:ut,initialLodQualityPreset:te,transform:ya,transformOverride:ia,renderSettings:g?.renderSettings??null,pointCloudMode:Xt,pointSizePx:ea,onPointCloudModeChange:sa,normalMode:Zt,onNormalModeChange:na,onLoadingStatusChange:Q,onLoaded:()=>{D(!0),re(c.current?.getRecordingTarget()??null);const o=w.getState();c.current?.setRenderParams({fov:o.fov,toneMapping:o.toneMapping,walkModeHeight:It(o,a.id)??a.viewer?.overrides?.walkHeight??null,walkModeSpeed:At(o,a.id)??a.viewer?.overrides?.walkSpeed??null})}},Le),!p&&!T&&e.jsx(hr,{logoSrc:"/logo/icon-32.png",onLogoClick:Ne,onResetView:()=>c.current?.resetView(),onBack:x,onNavigate:Y,worlds:f,worldsLoading:z,currentWorldId:a.id,onWorldSelect:Te,isAuthenticated:!!j,splatLoaded:R,onDownload:De,downloadPending:r,panoramaUrl:U,inputImageUrl:$e,splatUrl:a.splat_url,convertedFormats:a.converted_formats||null,generatingFormats:F,downloadingItems:H,shareUrl:C,isOwner:n,onToggleVisibility:qe,onToggleListed:Ve,onEdit:J,isMobile:h,worldTitle:ue,worldDescription:Be,worldIsPublic:me,worldIsListed:Ge,worldAdminUnlisted:X,worldCreatedAt:pe,worldCreatorName:fe,worldModelAlias:Qe,worldInputSource:Me,devMode:O,engine:null,cinema:xa,recordingTarget:ae,onOpenSettings:()=>oe(!0),arenaAction:Ke,onFeedback:ee,onAnalyticsEvent:Ie,centerTools:!h&&(A||Oe)?e.jsxs(e.Fragment,{children:[Oe&&e.jsxs(ke,{children:[e.jsx(je,{asChild:!0,children:e.jsx("button",{type:"button",onClick:vt,"aria-pressed":ie,"aria-label":"Measure",className:`flex size-8 items-center justify-center rounded-full transition-colors ${ie?"bg-primary text-primary-foreground":"text-foreground
43/80 hover:bg-muted dark:text-white/80 dark:hover:bg-white/10"}`,children:e.jsx(Ut,{className:"size-4"})})}),e.jsx(Ce,{side:"top",children:"Measure"})]}),A&&e.jsxs(e.Fragment,{children:[Ze&&e.jsxs(ke,{children:[e.jsx(je,{asChild:!0,children:e.jsx("button",{type:"button",onClick:()=>s(o=>!o),"aria-pressed":t,"aria-label":P?"Generating map":"Map",className:`flex size-8 items-center justify-center rounded-full transition-colors ${t?"bg-primary text-primary-foreground":"text-foreground/80 hover:bg-muted dark:text-white/80 dark:hover:bg-white/10"}`,children:P?e.jsx(de,{className:"size-4 animate-spin"}):e.jsx(Tt,{className:"size-4"})})}),e.jsx(Ce,{side:"top",children:P?"Generating floor plan…":"Floor plan"})]}),Re&&e.jsxs(ke,{children:[e.jsx(je,{asChild:!0,children:e.jsx("button",{type:"button",onClick:()=>{jt()||d.error("Dollhouse view needs a loaded scene.")},"aria-pressed":N,"aria-label":"Dollhouse",className:`flex size-8 items-center justify-center rounded-full transition-colors ${N?"bg-primary text-primary-foreground":"text-foreground/80 hover:bg-muted dark:text-white/80 dark:hover:bg-white/10"}`,children:e.jsx($t,{className:"size-4"})})}),e.jsx(Ce,{side:"top",children:"Dollhouse"})]}),e.jsxs("div",{role:"radiogroup","aria-label":"Camera mode",className:"flex items-center rounded-full bg-muted/80 p-0.5 dark:bg-white/10",children:[e.jsxs(ke,{children:[e.jsx(je,{asChild:!0,children:e.jsx("button",{type:"button",role:"radio",disabled:!b&&!y&&!Z,"aria-checked":S==="walk","aria-label":b?"Preparing walk mode":"Walk mode",onClick:()=>{if(N){if(y){q("walk");return}if(q("fly"),b){_(!0);return}E(!0);return}if(y){k("walk");return}if(b){_(!0);return}E(!0)},className:`flex size-7 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60 ${S==="walk"?"bg-primary text-primary-foreground shadow-sm":"text-foreground/70 hover:text-foreground dark:text-white/70 dark:hover:text-white"}`,children:b?e.jsx(de,{className:"size-3.5 animate-spin"}):e.jsx(tt,{className:"size-3.5"})})}),e.jsx(Ce,{side:"top",children:b?ne?"Walk starts when ready…":"Preparing walk mode…":"Walk"})]}),e.jsxs(ke,{children:[e.jsx(je,{asChild:!0,children:e.jsx("button",{type:"button",role:"radio","aria-checked":S==="fly","aria-label":"Orbit mode",onClick:()=>{if(N){q("fly");return}k("fly")},className:`flex size-7 items-center justify-center rounded-full transition-colors ${S==="fly"?"bg-primary text-primary-foreground shadow-sm":"text-foreground/70 hover:text-foreground dark:text-white/70 dark:hover:text-white"}`,children:e.jsx(at,{className:"size-3.5"})})}),e.jsx(Ce,{side:"top",children:"Orbit"})]})]})]})]}):void 0,statusContent:!h&&A?e.jsx(_t,{status:W,onPresetChange:Ct,open:it,onOpenChange:be}):void 0,moreTools:h?void 0:[...n&&ge?[{id:"embed",label:"Embed",group:"capture",icon:e.jsx(lr,{className:"size-4"}),onSelect:()=>lt(!0)}]:[],...xt?[{id:"record-path",label:"Record",icon:e.jsx(dr,{className:"size-4 fill-red-500 text-red-500"}),onSelect:()=>{s(!1),L(!0)}}]:[],...kt?[{id:"refine",label:"Refine",icon:e.jsx(zt,{className:"size-4 text-muted-foreground"}),onSelect:()=>{s(!1),Ee(!nt)},trailing:e.jsx(Ma,{worldId:a.id})}]:[]]}),n&&ge&&e.jsx(Ia,{open:Yt,onOpenChange:lt,worldId:a.id,getCurrentCamera:()=>{const o=c.current?.getCameraPose()??null;return o?{position:o.position,target:o.target,fov:o.fov}:null}}),p&&e.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 z-50 flex justify-center px-4 pt-4",children:e.jsxs("div",{role:"status",className:"overflow-hidden text-ellipsis whitespace-nowrap rounded-full border border-white/15 bg-black/75 px-4 py-2 text-sm text-white/90 shadow-lg backdrop-blur-md",children:["You're viewing a previous version",ue??a.caption?` · ${ue??a.caption}`:""]})}),!p&&h&&!t&&e.jsx(gr,{onMovementChange:o=>c.current?.setExternalMovement(o)}),!p&&h&&!t&&e.jsx("button",{type:"button",onClick:()=>c.current?.resetView(),"aria-label":"Reset view to origin",className:"absolute bottom-6 right-6 z-40 flex size-12 items-center justify-center rounded-full border bg-background/90 text-foreground shadow-xl backdrop-blur-md transition-[transform,background-color] duration-150 ease-out hover:bg-muted active:scale-[0.97] dark:text-white dark:hover:bg-white/10",children:e.jsx(cr,{className:"size-5"})}),!p&&h&&!t&&Oe&&e.jsx("button",{type:"button",onClick:vt,"aria-pressed":ie,"aria-label":"Measure",className:`absolute bottom-20 right-6 z-40 flex size-12 items-center justify-center rounded-full border shadow-xl backdrop-blur-md transition-[transform,background-color] duration-150 ease-out active:scale-[0.97] ${ie?"border-transparent bg-[#0A84FF] text-white":"bg-background/90 text-foreground hover:bg-muted dark:text-white dark:hover:bg-white/10"}`,children:e.jsx(Ut,{className:"size-5"})}),yt&&e.jsx(Aa,{worldId:a.id,viewer:c.current,isMobile:h,onExit:ga,onAnalyticsEvent:Ie},a.id),!p&&Ht&&e.jsx(Cr,{viewer:c.current}
43),!p&&h&&!yt&&!Je&&W.qualityPreset!=="highest"&&e.jsxs("div",{className:"absolute left-4 right-4 top-4 z-40 rounded-2xl border border-border/70 bg-background/90 p-3 pr-10 text-sm text-foreground shadow-xl backdrop-blur-md",children:[e.jsx("p",{className:"font-medium",children:"Fast mode activated"}),e.jsxs("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:["We are showing you a lower but fast quality level to improve experience on mobile. You can switch quality in"," ",e.jsx("button",{type:"button",onClick:()=>{He(!0),be(!0)},className:"font-medium text-foreground underline underline-offset-2",children:"settings"}),", or open this world on a desktop."]}),e.jsx("button",{type:"button",onClick:()=>{a.id&&Vt(a.id),Pe(!0)},className:"absolute right-2 top-2 flex size-7 items-center justify-center rounded-full text-muted-foreground transition hover:bg-muted hover:text-foreground","aria-label":"Dismiss quality notice",children:e.jsx(ur,{className:"size-4"})})]}),!p&&e.jsx(_a,{open:xe,onClose:()=>oe(!1),viewer:c.current,worldId:a.id,walkHeightOverride:ft,walkSpeedOverride:ht,qualityPresetOverride:we,showDollhouseSetting:Re,profile:T?"capture":"full"}),Re&&N&&e.jsx(Ea,{ratio:We,onRatioChange:wa}),Ze&&e.jsx(Fa,{viewer:c.current,minimap:Xe??g?.minimap,isGenerating:P,canGenerate:wt,isMobile:h,open:t,onOpenChange:s,onEnterWalkMode:()=>y?(k("walk"),!0):b?(_(!0),!1):(E(!0),!1),onGenerate:o=>ba({roofCutRatio:o?.roofCutRatio,coverageScale:o?.coverageScale})}),xt&&e.jsx(Pa,{viewer:c.current,minimap:et,walkAvailable:pa,dollhouseRoofCutRatio:We,open:m,onOpenChange:L,worldTitle:a.caption??void 0,onDollhouseEnter:()=>{k("fly"),$(!0)}}),kt&&e.jsx(Wa,{worldId:a.id,viewer:R?c.current:null,open:nt,onOpenChange:Ee,onNavigate:Y,worldCaption:a.caption},a.id),!p&&A&&e.jsxs(e.Fragment,{children:[h&&!t&&e.jsxs("div",{className:"absolute bottom-6 left-6 z-40 flex flex-col items-start gap-2",children:[Fe&&e.jsxs(e.Fragment,{children:[e.jsx(_t,{status:W,onPresetChange:Ct,open:it,onOpenChange:be,contentAlign:"start",triggerClassName:"h-11 border bg-background/90 px-4 text-sm font-medium shadow-xl backdrop-blur-md hover:bg-muted dark:text-white/90 dark:hover:bg-white/10"}),T&&e.jsxs("button",{type:"button",onClick:()=>{be(!1),oe(!0)},className:"flex h-11 items-center gap-2 rounded-full border bg-background/90 px-4 text-sm font-medium text-foreground shadow-xl backdrop-blur-md transition hover:bg-muted dark:text-white/90 dark:hover:bg-white/10",children:[e.jsx(zt,{className:"size-4"}),"Settings"]}),Re&&e.jsxs("button",{type:"button",onClick:()=>{jt()},"aria-pressed":N,className:`flex h-11 items-center gap-2 rounded-full border px-4 text-sm font-medium shadow-xl backdrop-blur-md transition ${N?"bg-foreground text-background":"bg-background/90 text-foreground hover:bg-muted dark:text-white/90 dark:hover:bg-white/10"}`,children:[e.jsx($t,{className:"size-4"}),"Dollhouse"]}),Ze&&e.jsxs("button",{type:"button",onClick:()=>s(!0),className:"flex h-11 items-center gap-2 rounded-full border bg-background/90 px-4 text-sm font-medium text-foreground shadow-xl backdrop-blur-md transition hover:bg-muted dark:text-white/90 dark:hover:bg-white/10",children:[P?e.jsx(de,{className:"size-4 animate-spin"}):e.jsx(Tt,{className:"size-4"}),P?"Generating map…":"Map"]}),e.jsxs("button",{type:"button",onClick:()=>{if(N){q("fly");return}k("fly")},"aria-pressed":S==="fly",className:`flex h-11 items-center gap-2 rounded-full border px-4 text-sm font-medium shadow-xl backdrop-blur-md transition ${S==="fly"?"bg-foreground text-background":"bg-background/90 text-foreground hover:bg-muted dark:text-white/90 dark:hover:bg-white/10"}`,children:[e.jsx(at,{className:"size-4"}),"Orbit"]}),e.jsxs("button",{type:"button",disabled:!b&&!y&&!Z,"aria-pressed":S==="walk",onClick:()=>{if(N){if(y){q("walk");return}if(q("fly"),b){_(!0);return}E(!0);return}if(y){k("walk");return}if(b){_(!0);return}E(!0)},className:`flex h-11 items-center gap-2 rounded-full border px-4 text-sm font-medium shadow-xl backdrop-blur-md transition disabled:cursor-not-allowed disabled:opacity-60 ${S==="walk"?"bg-foreground text-background":"bg-background/90 text-foreground hover:bg-muted dark:text-white/90 dark:hover:bg-white/10"}`,children:[b?e.jsx(de,{className:"size-4 animate-spin"}):e.jsx(tt,{className:"size-4"}),b?ne?"Starting soon…":"Preparing…":"Walk"]})]}),e.jsx("button",{type:"button",onClick:()=>He(o=>!o),"aria-expanded":Fe,"aria-label":Fe?"Hide controls":_e?"Show controls, scene loading":"Show controls",className:"flex size-12 items-center justify-center rounded-full border bg-background/90 text-foreground shadow-xl backdrop-blur-md transition hover:bg-muted dark:text-white dark:hover:bg-white/10",children:Fe?e.jsx(mr,{className:"size-5"}):_e?e.jsx(de,{className:"size-5 animate-spin text-primary"}):S==="walk"?e.jsx(tt,{className:"size-5"}):e.jsx(at,{className:"size-5"})})]}),e.jsx(La,{open:Ye,onOpenChange:E,children:e.jsxs(Oa,{children:[e.jsxs(Ra,{children:[e.jsx(za,{children:"Walk mode needs collision"}),e.jsx(Ua,{children:"Walk mode requires a generated collision mesh for this world, so you can walk around and bump into walls. Generating it takes a few seconds. You'll be notified when it's ready, and walk mode will start automatically."})]}),e.jsxs(Ta,{children:[e.jsx(Et,{variant:"outline",onClick:()=>E(!1),disabled:b,children:"Cancel"}),e.jsx(Et,{disabled:b,onClick:async()=>{E(!1),_(!0),await Z?.()==="ready"&&k("walk")},children:b?e.jsxs(e.Fragment,{children:[e.jsx(de,{className:"size-4 animate-spin"}),"Generating..."]}):"Generate collision"})]})]})})]})]})}):e.jsxs("div",{className:"flex min-h-svh flex-col items-center justify-center gap-4 bg-background",children:[e.jsx("p",{className:"text-muted-foreground",children:"No viewer asset available for this world"}),e.jsx("button",{onClick:x,className:"text-sm text-primary hover:underline",children:"Go back"})]})}function kr(a){if(!(a instanceof HTMLElement))return!1;const n=a.tagName.toLowerCase();return a.isContentEditable||n==="input"||n==="textarea"||n==="select"}function B(a,n=0){return Number.isFinite(a)?a.toFixed(n):"-"}
43function jr(a){return a===void 0?"-":a>=1e6?`${(a/1e6).toFixed(2)}M`:a>=1e3?`${(a/1e3).toFixed(1)}K`:a.toLocaleString()}function Cr({viewer:a}){const[n,j]=i.useState(()=>a?.getStats()??null);if(i.useEffect(()=>{if(!a){j(null);return}j(a.getStats());const u=window.setInterval(()=>{j(a.getStats())},250);return()=>window.clearInterval(u)},[a]),!n)return e.jsx("div",{"data-testid":"viewer-stats","data-viewer-stats-status":"waiting",className:"pointer-events-none fixed left-4 top-20 z-40 rounded-xl border border-white/10 bg-black/70 px-3 py-2 font-mono text-[11px] text-white/70 shadow-2xl backdrop-blur-md",children:"Waiting for viewer stats..."});const ce=[["FPS",B(n.fps)],["Frame",`${B(n.frameMs,1)} ms`],["Renderer",n.renderer.toUpperCase()],["Profile",n.deviceProfile],["Canvas",`${n.canvasWidth}x${n.canvasHeight} @ ${B(n.devicePixelRatio,2)}x`],["Buffer",`${n.backbufferWidth}x${n.backbufferHeight}`],["Format",n.contentFormat??"-"],["Splats",jr(n.splatCount)],["LOD",n.lodLevels?`${n.renderParams.lodRangeMin}-${n.renderParams.lodRangeMax} / ${n.lodLevels}`:"flat"],["Mode",n.cameraMode],["Collision",n.collisionLoaded?"loaded":"none"],["Collision Viz",n.collisionDebugVisible?"on":"off"],["Budget",n.lodLevels?`${B(n.renderParams.splatBudgetMillions,2)}M`:"n/a (flat)"],["FOV",`${B(n.renderParams.fov)} deg`],["Walk height",n.renderParams.walkModeHeight===null?"default":`${B(n.renderParams.walkModeHeight,2)} m`],["Walk speed",n.renderParams.walkModeSpeed===null?"default":`${B(n.renderParams.walkModeSpeed,2)} m/s`],["Tone",n.renderParams.toneMapping],["Frames",n.renderedFrames.toLocaleString()],["Camera",n.cameraPosition.map(u=>B(u,2)).join(", ")]];return e.jsxs("div",{"data-testid":"viewer-stats","data-viewer-stats-status":"ready","data-viewer-stats-version":"1","data-viewer-stats":JSON.stringify(n),className:"pointer-events-none fixed left-4 top-20 z-40 w-64 rounded-xl border border-white/10 bg-black/75 p-3 font-mono text-[11px] text-white/80 shadow-2xl backdrop-blur-md",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between border-b border-white/10 pb-2",children:[e.jsx("span",{className:"font-semibold tracking-wide text-white",children:"Viewer Stats"}),e.jsx("span",{className:"rounded bg-white/10 px-1.5 py-0.5 text-[10px] text-white/50",children:"I"})]}),e.jsx("div",{className:"space-y-1",children:ce.map(([u,f])=>e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{className:"text-white/45",children:u}),e.jsx("span",{className:"truncate text-right text-white/85",children:f})]},u))})]})}function zr(){const{world:a,isOwner:n,accessDenied:j}=Ft.useLoaderData(),{worldId:ce}=Ft.useParams(),u=Ha({select:t=>{const s=t.location.href,l=s.includes("?")?s.slice(s.indexOf("?")):"";return new URLSearchParams(l).get("preview")==="version"}}),{user:f}=Ja({strict:!1}),z=Xa(),x=Za(),[Y,Ne]=i.useState(!1),[Te,De]=i.useState(!1),[r,F]=i.useState(a),H=r?.id??"",U=le(or(H)),$e=le(sr(H)),J=le(t=>t.setGenerating),C=le(t=>t.clearGenerating),qe=le(t=>t.setDownloading),Ve=le(t=>t.clearDownloading),ue=Bt(),Be=i.useCallback(t=>{if(t.type==="COLLISION_READY"){C(t.worldId,"voxel"),K({data:{worldId:t.worldId}}).then(s=>{F(l=>({...s,creator:s.creator??l?.creator??null})),x.invalidateQueries({queryKey:M.worlds.all})});return}if(t.type==="COLLISION_FAILED"){C(t.worldId,"voxel"),K({data:{worldId:t.worldId}}).then(s=>{F(l=>({...s,creator:s.creator??l?.creator??null}))});return}if(t.type==="MINIMAP_READY"){C(t.worldId,"minimap"),K({data:{worldId:t.worldId}}).then(s=>{F(l=>({...s,creator:s.creator??l?.creator??null})),x.invalidateQueries({queryKey:M.worlds.all})});return}if(t.type==="MINIMAP_FAILED"){C(t.worldId,"minimap"),K({data:{worldId:t.worldId}}).then(s=>{F(l=>({...s,creator:s.creator??l?.creator??null}))});return}t.type!=="DOWNLOAD_READY"||!t.downloadFormat||!t.convertedPath||(C(t.worldId,t.downloadFormat),F(s=>{if(!s||s.id!==t.worldId||!t.downloadFormat||!t.convertedPath)return s;const l=s.converted_formats||{};return{...s,converted_formats:{...l,[t.downloadFormat]:{path:t.convertedPath,convertedAt:new Date().toISOString()}}}}))},[C,x]);er({userId:f?.id,enabled:!!f?.id,onNotification:Be}),i.useEffect(()=>{F(a)},[a]);const{data:me}=nr(),Ge=i.useMemo(()=>tr(f?.email,me?.allowedEmailDomains??[]),[f?.email,me?.allowedEmailDomains]),X=r?.metadata,pe=typeof X?.modal_alias=="str
43ing"?X.modal_alias:null,fe=X?.input_source==="text"?"text":X?.input_source==="pano"?"pano":"image",Qe=r?.creator?.username?`@${r.creator.username}`:r?.creator?.name??null,Me=n?"edit":"view",O=i.useMemo(()=>({...ir(),userId:f?.id,workspaceId:r?.workspace_id??void 0,worldId:r?.id,surface:"world_viewer",isOwner:n,worldStatus:r?.status,generationAlias:pe,inputSource:fe}),[n,f?.id,fe,pe,r?.id,r?.status,r?.workspace_id]);i.useEffect(()=>{r&&Se("world_viewed",{...O,viewerMode:Me})},[O,Me,r]);const Ie=i.useMemo(()=>(t,s)=>{const l={...O,...s};Se(t,l)},[O]),{data:Z=[]}=ot({queryKey:M.workspaces.byUserId(f?.id),queryFn:()=>$a({data:{userId:f.id}}),enabled:!!f?.id}),b=i.useMemo(()=>{const t=r?.workspace_id;return t?Z.find(s=>s.workspace.id===t)?.role==="viewer":!1},[Z,r?.workspace_id]),he=i.useMemo(()=>{if(!(!r||typeof window>"u")&&!b)return`${window.location.origin}/worlds/${r.id}`},[r,b]),{data:P,isLoading:Ke}=pr({enabled:!!f}),{data:ee}=ot({queryKey:M.signedUrls.byWorldId(r?.id??""),queryFn:()=>qa({data:{worldId:r.id}}),enabled:!!r?.id,staleTime:1e3*60*5}),G=i.useCallback(t=>{F(s=>({...t,creator:t.creator??s?.creator??null})),x.invalidateQueries({queryKey:M.worlds.all}),t.workspace_id&&x.invalidateQueries({queryKey:M.worlds.byWorkspaceId(t.workspace_id)}),t.user_id&&x.invalidateQueries({queryKey:M.worlds.byUserId(t.user_id)})},[x]),p=i.useCallback(t=>{F(l=>{if(!l)return l;const m=l.metadata??{};return{...l,metadata:{...m,arena:t}}});const s=l=>l.map(m=>{if(m.id!==H)return m;const L=m.metadata??{};return{...m,metadata:{...L,arena:t}}});Rt(x,["workspaceWorlds"],s),Rt(x,["userWorlds"],s),x.invalidateQueries({queryKey:M.worlds.all}),x.invalidateQueries({queryKey:M.worlds.list}),r?.workspace_id&&x.invalidateQueries({queryKey:M.worlds.byWorkspaceId(r.workspace_id)}),r?.user_id&&x.invalidateQueries({queryKey:M.worlds.byUserId(r.user_id)})},[H,x,r?.user_id,r?.workspace_id]),T=V({mutationFn:async t=>{if(!r)throw new Error("No world to update");return Pt({data:{worldId:r.id,is_public:t}})},onSuccess:(t,s)=>{G(t),d.success(s?"World is now public and can be shared":"World is now private")},onError:(t,s)=>{d.error(`Failed to make world ${s?"public":"private"}. Please try again.`)}}),h=V({mutationFn:async t=>{if(!r)throw new Error("No world to update");return Pt({data:{worldId:r.id,is_listed:t}})},onSuccess:(t,s)=>{G(t),d.success(s?"World will appear in community gallery":"World removed from community gallery")},onError:()=>{d.error("Failed to update listing status. Please try again.")}}),Ae=V({mutationFn:async()=>{if(!r)throw new Error("No world to prepare");return Va({data:{worldId:r.id}})},onSuccess:async t=>{if(r){if(t.status==="ready"){C(r.id,"voxel");const s=await K({data:{worldId:r.id}});G(s);return}J(r.id,"voxel"),d.info("Generating walk mode...",{description:"We're generating collision data for this world. You'll be notified when it's ready.",duration:1e4})}},onError:t=>{r&&C(r.id,"voxel"),d.error(ze(t,"generic"))}}),ge=V({mutationFn:async t=>{if(!r)throw new Error("No world to map");return t?Ba({data:{worldId:r.id,capture:t}}):Ga({data:{worldId:r.id}})},onSuccess:async t=>{if(r){if(t.status==="ready"){C(r.id,"minimap");const s=await K({data:{worldId:r.id}});G(s);return}J(r.id,"minimap"),d.info("Generating map...",{description:"We're generating a top-down navigation map for this world. You'll be notified when it's ready.",duration:1e4})}},onError:t=>{r&&(C(r.id,"minimap"),d.error(ze(t,"generic")))}}),c=t=>t.type==="splat"&&t.format?`splat:${t.format}`:t.type==="panorama"?"panorama":t.type==="input-image"?"input-image":null,we=V({onMutate:t=>{if(!r)return;const s=c(t);s&&qe(r.id,s)},onSettled:(t,s,l)=>{if(!r)return;const m=c(l);m&&Ve(r.id,m)},mutationFn:async t=>{if(!r)throw new Error("No world to download");const s=(r.caption||"world").replace(/[^a-zA-Z0-9.-]/g,"_").substring(0,50);if(t.type==="panorama"){const l=ee?.panorama_url;if(!l)throw new Error("Panorama not available");const m=d.loading("Downloading panorama...");try{await Ot(l,`${s}_panorama.jpg`),Se("world_download_requested",{...O,format:"panorama",assetType:"panorama"}),d.success("Download complete",{id:m})}catch{throw d.error("Failed to download panorama. Please try again.",{id:m}),new Error("Failed to download panorama")}return}if(t.type==="input-image"){const l=ee?.input_image_url;if(!l)throw new Error("Input image not available");const m=d.loading("Downloading input image...");try{await Ot(l,`${s}_input.jpg`),Se("world_download_requested",{...O,format:"input-image",assetType:"input-image"}),d.success("Download complete",{id:m})}catch{throw d.error("Failed to download image. Please try again.",{id:m}),new Error("Failed to download input image")}return}if(t.type==="splat"&&t.format){const l=d.loading(`Preparing ${t.label} download...`,{description:"Converting file format, this may take a moment"});try{const m=await Wt({data:{worldId:r.id,format:t.format}});if(Se("world_download_requested",{...O,format:t.format,assetType:"splat"}),m.status==="ready")d.success("Download started",{id:l,description:`${t.label} file is downloading`}),t.format&&C(r.id,t.format);else{const L=t.format==="mesh"||t.format==="mesh-simplified";d.info(L?"Generating mesh...":"Converting...",{id:l,description:L?"We're generating your mesh. You'll be notified when it's ready.":`We're preparing your ${t.label} file. You'll be notified when it's ready.`,duration:1e4}),t.format&&J(r.id,t.format)}}catch{throw d.error("Failed to download. Please try again.",{id:l}),new Error("Download failed")}}}}),te=Ue("show-arena"),R=br(r),D=R?.status,W=te&&n&&r?.status===Gt.COMPLETED&&!!r.splat_url,Q=i.useMemo(()=>r?.converted_formats??{},[r?.converted_formats]),_e=i.useMemo(()=>[{id:"mesh",label:"Simplified mesh",description:"Optimized collision mesh used for movement, physics, and navigation.",format:"mesh-simplified",isReady:!!Q["mesh-simplified"],isGenerating:U.has("mesh")||U.has("mesh-simplified")}],[Q,U]),ae=V({mutationFn:async()=>
43{if(!r)throw new Error("No world to deploy");return Qa({data:{worldId:r.id}})},onSuccess:t=>{if(p(t.arena),t.arena.status===I.READY&&t.arena.joinUrl){d.success("Arena server is ready"),window.open(t.arena.joinUrl,"_blank","noopener,noreferrer");return}d.info("Preparing your Arena map",{description:"This usually takes a few minutes."})},onError:t=>{d.error(ze(t,"generic"))}}),re=V({mutationFn:async()=>{if(!r)throw new Error("No world to cancel");return Ka({data:{worldId:r.id}})},onSuccess:t=>{p(t.arena)},onError:t=>{d.error(ze(t,"generic"))}}),xe=V({mutationFn:async t=>{if(!r)throw new Error("No world to prepare");const s=Ya[t],l=d.loading(`Checking ${s}...`,{description:"Checking if file is ready..."});try{if((await Wt({data:{worldId:r.id,format:t,inline:!0}})).status==="ready"){C(r.id,t),d.success(`${s} is ready`,{id:l,description:"Arena can use this artifact now."});const L=await K({data:{worldId:r.id}});G(L);return}J(r.id,t),d.info(`Generating ${s}...`,{id:l,description:"We're generating this artifact. You'll be notified when it's ready.",duration:1e4})}catch(m){throw d.error("Failed to prepare Arena artifact. Please try again.",{id:l}),m}}}),oe=ae.isPending||D===I.QUEUED?"Preparing Arena...":D===I.BUILDING?"Building Arena map...":D===I.MAP_READY||D===I.STARTING_SERVER?"Starting Arena server...":D===I.READY&&R?.joinUrl?"Open Arena":D===I.FAILED?"Retry Arena build":"Play in Arena",g=i.useCallback(t=>{window.open(t,"_blank","noopener,noreferrer")},[]),y=()=>{if(D===I.READY&&R?.joinUrl){g(R.joinUrl);return}ae.mutate()},A=()=>{re.mutate()},se=t=>{xe.mutate(t)},S=t=>xe.isPending&&xe.variables===t,k=W?{label:oe,isLoading:ae.isPending||yr(D),onClick:()=>De(!0)}:void 0,N=()=>{const t=sessionStorage.getItem("lastDashboardRoute");t&&["/worlds","/explore"].includes(t)?z.navigate({to:t}):z.navigate({to:"/worlds"})},$=t=>{z.navigate({to:t})},ne=()=>{z.navigate({to:"/worlds"})},_=t=>{z.navigate({to:`/worlds/${t}`})},Ye=n&&r?.panorama_path?()=>{z.navigate({to:"/worlds/$worldId/edit",params:{worldId:r.id}})}:void 0,E=f?async()=>(await Ae.mutateAsync()).status:void 0;return e.jsxs(e.Fragment,{children:[e.jsx(vr,{world:r,isOwner:!u&&n,user:f||null,accessDenied:j,requestedWorldId:ce,worldsList:P,worldsLoading:Ke,onBack:N,onNavigate:$,onLogoClick:ne,onWorldSelect:_,onDownload:u?void 0:t=>we.mutate(t),downloadPending:we.isPending,generatingFormats:U,downloadingItems:$e,panoramaUrl:Ge?ee?.panorama_url:null,inputImageUrl:ee?.input_image_url,shareUrl:u?void 0:he,onToggleVisibility:u||!f?void 0:async t=>{await T.mutateAsync(t)},onToggleListed:u||!n?void 0:async t=>{await h.mutateAsync(t)},onEdit:u?void 0:Ye,worldTitle:r?.caption,worldDescription:r?.description,worldIsPublic:r?.is_public,worldIsListed:r?.is_listed??!1,worldAdminUnlisted:r?.admin_unlisted??!1,worldCreatedAt:r?.created_at,worldCreatorName:Qe,worldModelAlias:pe,worldInputSource:fe,devMode:me?.isProduction===!1,onAnalyticsEvent:Ie,onRequestWalkMode:u?void 0:E,walkModePending:Ae.isPending||U.has("voxel")||r?.viewer?.collisionStatus==="processing",onRequestMinimap:u?void 0:t=>ge.mutateAsync(t),minimapPending:ge.isPending||U.has("minimap")||r?.viewer?.minimapStatus==="processing",arenaAction:u?null:k,onFeedback:u||!f||ue?void 0:()=>Ne(!0),versionPreview:u}),f&&!u&&e.jsx(ar,{open:Y,onOpenChange:Ne,userName:f.name,userEmail:f.email,worldId:r?.id}),W&&!u&&e.jsx(rr,{open:Te,onOpenChange:De,arenaState:R,prerequisites:_e,isDeploying:ae.isPending,onDeploy:y,onCancel:A,isCancelling:re.isPending,onOpenArena:g,onPrepareArtifact:se,isPreparingArtifact:S})]})}export{vr as WorldViewerContent,zr as component};
44
45//# chunkId=01a0f713-a023-7801-b8b8-a49dd0ef69dd

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.