1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{r as l}from"./vendor-react-E98sgxjj.js";import{u as S}from"./vendor-query-bOUN_gKe.js";import{du as p}from"./vendor-fa-Bn2dnpnC.js";import{u as g,aN as j,aO as h,s as _}from"./index-BKzE8EQ8.js";import{u as E,E as F,a as O,S as M,r as R}from"./reveal-De4EoCkr.js";import{u as C}from"./useIsPaid-Cw2jGyd_.js";import{U as L}from"./index-i1nPji9k.js";import{useGameSettings as $}from"./GameSettingsLayout-D9S5c2Df.js";import"./paywall-CG7xVZtx.js";import"./plans-CbMJY2XS.js";import"./pricingExperiments-zMZby8z7.js";import"./useLocaleNavigate-BNriJdRU.js";import"./organization-BuGhuc22.js";function P({game:t}){const{t:r}=g("exports"),[o,n]=l.useState(null),[i,a]=l.useState(!1),[b,c]=l.useState(!1),[w,m]=l.useState(!1),d=C(),y=!!(t.remixed_from_id||t.template_derived_from_id),{link:N}=E({gameId:t.id,engineGameName:t.engine_game_name}),k=_&&!!N,u=(s,f)=>{if(s==="code"&&k&&!f?.forceRebuild){R(t.id);return}a(!!f?.forceRebuild),n(s)},{data:x=[]}=S({queryKey:["gameExports",t.id],queryFn:()=>j.list(t.id),refetchOnWindowFocus:!0,enabled:d}),v=s=>{s==="tier"?c(!0):m(!0)};return e.jsxs("section",{id:"export",className:"mb-10 scroll-mt-20",children:[e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h2",{className:"text-lg text-foreground",children:r("settings.heading")}),!d&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 mt-0.5 rounded bg-yellow-500/15 text-yellow-700 dark:text-yellow-400 font-medium tracking-wide",children:r("proFeaturePill","Pro feature")})]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:r("settings.description")})]}),e.jsx("div",{className:"mb-8",children:e.jsx(F,{gameId:t.id,inline:!0,isPaid:d,isDerivative:y,engineKind:h(t),onSelectFormat:s=>u(s),onLockedClick:v})}),d&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-medium text-foreground mb-3",children:r("settings.recentHeading")}),x.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:r("settings.noRecent")}):e.jsx("div",{className:"border border-border rounded-md overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-foreground
1/3 text-xs uppercase tracking-wider text-muted-foreground",children:[e.jsx("th",{className:"text-left font-medium px-3 py-2",children:r("settings.tableFormat")}),e.jsx("th",{className:"text-left font-medium px-3 py-2",children:r("settings.tableStatus")}),e.jsx("th",{className:"text-left font-medium px-3 py-2",children:r("settings.tableSize")}),e.jsx("th",{className:"text-left font-medium px-3 py-2 hidden sm:table-cell",children:r("settings.tableCreated")}),e.jsx("th",{className:"text-right font-medium px-3 py-2"})]})}),e.jsx("tbody",{children:x.map(s=>e.jsx(B,{exp:s,isWebEngine:h(t)==="web",onRebuild:()=>u(s.format,{forceRebuild:!0})},s.id))})]})})]}),o&&e.jsx(O,{isOpen:!!o,onClose:()=>{n(null),a(!1)},game:t,format:o,forceRebuildOnOpen:i}),e.jsx(L,{isOpen:b,onClose:()=>c(!1),gameId:t.id,context:"export-locked"}),e.jsx(M,{isOpen:w,onClose:()=>m(!1),reason:t.remixed_from_id?"remix":"template_clone"})]})}function I(t){if(!t||t<=0)return"â";const r=t/(1024*1024);return r<1?`${(t/1024).toFixed(0)} KB`:r<1e3?`${r.toFixed(r<10?1:0)} MB`:`${(r/1024).toFixed(1)} GB`}function T(t){const r=new Date(t).getTime(),o=Math.floor((Date.now()-r)/1e3);return o<60?"just now":o<3600?`${Math.floor(o/60)}m ago`:o<86400?`${Math.floor(o/3600)}h ago`:`${Math.floor(o/86400)}d ago`}const A={ready:"text-emerald-600 dark:text-emerald-400",building:"text-yellow-600 dark:text-yellow-400",uploading:"text-yellow-600 dark:text-yellow-400",queued:"text-yellow-600 dark:text-yellow-400",failed:"text-red-500",cancelled:"text-muted-foreground",expired:"text-muted-foreground"};function B({exp:t,isWebEngine:r,onRebuild:o}){const{t:n}=g("exports"),i=async()=>{if(!(t.status!=="ready"||!t.download_url))try{await j.downloadInBrowser(t.id)}catch(a){console.error("Failed to start export download:",a)}};return e.jsxs("tr",{className:"border-t border-border",children:[e.jsx("td",{className:"px-3 py-2 text-foreground",children:n(t.format==="code"&&r?"formats.codeWeb.label":`formats.${t.format}.label`)}),e.jsx("td",{className:`px-3 py-2 ${A[t.status]??"text-foreground"}`,children:n(`status.${t.status}`,t.status==="building"?{percent:t.progress_percent}:{})}),e.jsx("td",{className:"px-3 py-2 text-muted-foreground",children:I(t.artifact_size_bytes)}),e.jsx("td",{className:"px-3 py-2 text-muted-foreground hidden sm:table-cell",children:T(t.created_at)}),e.jsx("td",{className:"px-3 py-2 text-right",children:t.status==="ready"&&t.download_url&&e.jsxs("div",{className:"flex items-center gap-3 justify-end",children:[e.jsxs("button",{onClick:o,className:"text-xs text-muted-foreground hover:text-foreground hover:underline cursor-pointer flex items-center gap-1",title:n("modal.rebuildHint"),children:[e.jsx(p,{icon:["far","arrows-rotate"]}),n("settings.rebuild")]}),e.jsxs("button",{onClick:i,className:"text-xs text-foreground hover:underline cursor-pointer flex items-center gap-1",children:[e.jsx(p,{icon:["far","download"]}),n("modal.downloadAgain")]})]})})]})}function ee(){const{game:t}=$();return e.jsx(P,{game:t})}export{ee 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.