1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{r as i}from"./vendor-react-E98sgxjj.js";import{u as j}from"./vendor-query-bOUN_gKe.js";import{T as c,r as w,l as k,m as P,H as v,b as q,n as A,o as B,d as h}from"./index-BKzE8EQ8.js";import{du as y}from"./vendor-fa-Bn2dnpnC.js";import{G as D}from"./GameFrame-COJWxWBt.js";import{D as L}from"./DesktopGamePanel-BehZ5Jia.js";import{C as _}from"./CoinTopUpModal-CAwRJTIr.js";import{u as E}from"./useFullscreen-Cs7diftf.js";import{P as H,u as K,a as O}from"./index-B_kJqugV.js";import{p as N}from"./publicGameMetadata-qDtp_1-a.js";import{u as V}from"./usePlayFeatures-C6KNVcgO.js";import"./PlayPanelHost-DZaYs6Qz.js";import"./index-BxtVm1Yj.js";import"./useLocaleNavigate-BNriJdRU.js";import"./exploreHandoff-RQymaHkp.js";import"./AuthShell-DPeun0C_.js";import"./AuthPanel-B4zt6SJ5.js";import"./pendingReferral-B4JPXhl_.js";import"./LaunchPromoClips-eRoWsyBt.js";import"./ShareModal-YOmfr9ti.js";import"./SubmitVideoModal-DzX5MAqQ.js";import"./earnProgram-B9pqjKbP.js";import"./trailerShare-BGlMG0RV.js";import"./usePublishingFeatures-C8zY31rs.js";import"./planPerks-uEcgEuVc.js";import"./plans-CbMJY2XS.js";import"./socialLinks-DmmZmq5v.js";import"./useIsStaff-DZf24Ivp.js";import"./usePlayingNow-D0BSBy1C.js";import"./playingNowApi-CB_pr25U.js";import"./vanitySite-BtpHcDVO.js";import"./useChatUnread-BF3F7z48.js";import"./useGameChatSocket-Ca57ylO8.js";import"./chatRoomStore-oLAeRb02.js";import"./Avatar-B60wpoS5.js";import"./MediaImage-DKgx-nW4.js";import"./playIntent-BFBGkqRe.js";import"./chatReturn-BikAGK6w.js";import"./PlayingNowBadge-CH2HUoBo.js";import"./useFocusTrap-BzqZufCW.js";function Ie(r){const{playerShell:s,ready:a}=V();return a?s?e.jsx(W,{...r}):e.jsx(T,{...r}):e.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black",children:e.jsx(c,{size:"lg",overlay:!1})})}function W(r){const s=r.gameRef??w(document)?.ref??null,{data:a,isLoading:o}=j({queryKey:["bare-play-game",s],queryFn:()=>k.getPublic(s),enabled:!!s});return o?e.jsx("div",{className:"fixed inset-0 flex items-center justify-center bg-black",children:e.jsx(c,{size:"lg",overlay:!1})}):!a||!P(a)||a.platform_tier==="desktop"?e.jsx(T,{...r}):e.jsxs("div",{className:"fixed inset-0 bg-black",children:[e.jsxs(v,{children:[e.jsx("title",{children:`${a.name} - Play on Tesana`}),e.jsx("meta",{name:"description",content:N(a)})]}),e.jsx(H,{game:a,surface:"vanity"})]})}function T({gameRef:r}){const s=r??w(document)?.ref??null,a=i.useRef(null),o=i.useRef(null),{isFullscreen:u,toggleFullscreen:U}=E(a),{user:p,isAuthenticated:F}=q(),{data:t,isLoading:d,error:G}=j({queryKey:["bare-play-game",s],queryFn:()=>k.getPublic(s),enabled:!!s}),[R,f]=i.useState(!1),[x,z]=i.useState(!1),g=i.useCallback(l=>{o.current?.iframe()?.contentWindow?.postMessage({type:"set-muted",muted:l},"*")},[]),C=i.useCallback(()=>{z(l=>(g(!l),!l))},[g]),b=!!(F&&p&&t&&t.user===p.username),n=t?P(t):null,m=t?.platform_tier==="desktop";K(!!n),O(t?.id??null,!!t&&t.status==="completed",{surface:"launch",isOwner:b,gameName:t?.name,gamePublicId:t?.public_id,game:t});const M=i.useCallback(l=>{if(f(!1),typeof l=="number"){o.current?.completeTopUp(!0,l);return}A.getWallet().then(I=>o.current?.completeTopUp(!0,I.balance)).catch(()=>o.current?.completeTopUp(!1))},[]),S=!!G||!d&&!t||!s;return e.jsxs("div",{ref:a,className:"fixed inset-0 flex flex-col overflow-hidden bg-black",children:[e.jsxs(v,{children:[e.jsx("title",{children:t?`${t.name} - Play on Tesana`:"Play on Tesana"}),e.jsx("meta",{name:"description",content:t?N(t):"Play this game on Tesana."})]}),e.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[d&&e.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black",children:e.jsx(c,{size:"lg"})}),S&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2 bg-black",children:[e.jsx("h1",{className:"text-lg text-white",children:"Game not found"}),e.jsx("p",{className:"text-sm text-white/60",children:"This address does not point at a game yet."})]}),t&&m&&e.jsx(L,{gameName:t.name,posterUrl:B(t),surface:"launch",studioGameId:b?t.id:null}),t&&!m&&n&&e.jsx(D,{ref:o,gameId:t.id,playGameId:t.public_id,src:n,className:"absolute inset-0 h-full w-full border-none bg-black",title:t.name,sandbox:"allow-scripts allow-modals allow-same-origin allow-popups allow-forms allow-pointer-lock",allow:"fullscreen; autoplay; gamepad; pointer-lock",onTopUpRequest:()=>f(!0)}),t&&n&&!m&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",onClick:C,"aria-label":x?"Unmute game":"Mute game","aria-pressed":x,className:h("absolute right-15 top-3 z-20 flex h-9 w-9 cursor-pointer items-center justify-center","rounded-md bg-black/40 text-white transition-colors hover:bg-black/60"),
1children:e.jsx(y,{icon:["far","volume"],className:"text-sm"})}),e.jsx("button",{type:"button",onClick:U,"aria-label":u?"Exit fullscreen":"Fullscreen",className:h("absolute right-3 top-3 z-20 flex h-9 w-9 cursor-pointer items-center justify-center","rounded-md bg-black/40 text-white transition-colors hover:bg-black/60"),children:e.jsx(y,{icon:["far",u?"minimize":"maximize"],className:"text-sm"})})]})]}),e.jsx(_,{isOpen:R,onClose:M,returnUrl:typeof window>"u"?"":window.location.href})]})}export{Ie as default};
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.