@weppy/roblox-mcp 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dashboard/dist/assets/AssetsPage-yddSUaZg.js +51 -0
  3. package/dashboard/dist/assets/{ChangelogDetailPage-BQu8E3gB.js → ChangelogDetailPage-BiiG5ZpO.js} +1 -1
  4. package/dashboard/dist/assets/{ChangelogPage-BYIOvsqN.js → ChangelogPage-oIxW8_VE.js} +1 -1
  5. package/dashboard/dist/assets/{ConfirmModal-DSKr5eS9.js → ConfirmModal-CpImpY9c.js} +1 -1
  6. package/dashboard/dist/assets/{ConnectionPage-OvC9gL_W.js → ConnectionPage-zGBwRnwi.js} +1 -1
  7. package/dashboard/dist/assets/{GameChangeDetail-BmXlRT3i.js → GameChangeDetail-CghOvUm8.js} +1 -1
  8. package/dashboard/dist/assets/{InfoLabel-CldY9uOT.js → InfoLabel-Cyz7d4Kc.js} +1 -1
  9. package/dashboard/dist/assets/{OverviewPage-Cdw1CYe4.js → OverviewPage-B6ZL_JXU.js} +1 -1
  10. package/dashboard/dist/assets/PageHeader-CThGgsAt.js +6 -0
  11. package/dashboard/dist/assets/{PlaytestPage-azdyKqSE.js → PlaytestPage-CQqE8m04.js} +1 -1
  12. package/dashboard/dist/assets/{SettingsPage-BLPo-MfN.js → SettingsPage-DX6vgUTw.js} +1 -1
  13. package/dashboard/dist/assets/{StatusBadge-DxlagIzF.js → StatusBadge-CkLieULy.js} +1 -1
  14. package/dashboard/dist/assets/{SyncPage-DtqIcJ5z.js → SyncPage-cfQ-4IDk.js} +1 -1
  15. package/dashboard/dist/assets/{Tabs-BgJY0tsU.js → Tabs-BhkhdCvF.js} +1 -1
  16. package/dashboard/dist/assets/{ToolsPage-BEq7XLqc.js → ToolsPage-B004HHzX.js} +1 -1
  17. package/dashboard/dist/assets/{TooltipText-DazmfUnr.js → TooltipText-H3YSCbob.js} +1 -1
  18. package/dashboard/dist/assets/{UiStudioPage-BR3NgjBs.js → UiStudioPage-CwURRVO9.js} +2 -2
  19. package/dashboard/dist/assets/WhatsNewPage-CBUk7WTn.js +1 -0
  20. package/dashboard/dist/assets/index-CjzKb5lS.css +1 -0
  21. package/dashboard/dist/assets/index-DG2RrKOl.js +532 -0
  22. package/dashboard/dist/assets/{sample-requests-Cq6wCxhD.js → sample-requests-D1b5Z8FU.js} +1 -1
  23. package/dashboard/dist/assets/{useLiveUptime-Dg607eVr.js → useLiveUptime-BHqJirBV.js} +1 -1
  24. package/dashboard/dist/index.html +2 -2
  25. package/dist/index.js +96 -92
  26. package/package.json +1 -1
  27. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  28. package/dashboard/dist/assets/AssetsPage-B1-IkNLs.js +0 -56
  29. package/dashboard/dist/assets/PageHeader-ueZvp6K9.js +0 -11
  30. package/dashboard/dist/assets/WhatsNewPage-BGAIXqWd.js +0 -1
  31. package/dashboard/dist/assets/index-1ZlHj3-1.js +0 -523
  32. package/dashboard/dist/assets/index-BdS5zBaA.css +0 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,17 @@ All notable changes to this project will be documented in this file.
8
8
 
9
9
 
10
10
 
11
+
12
+ ## [2.8.1] - 2026-06-15
13
+
14
+ ### Features
15
+
16
+ - **Playtest controls now live under Studio actions** — AI agents and direct MCP users should use `manage_studio.play_start`, `manage_studio.play_stop`, `manage_studio.play_pause`, `manage_studio.play_resume`, `manage_studio.play_status`, and `manage_studio.run_test` for Playtest workflows. The older `system_info` Playtest aliases are no longer the documented path, keeping `system_info` focused on read-only status and diagnostics.
17
+
18
+ ### Bug Fixes
19
+
20
+ - **Fix Play Stop cases that required a retry** — Stopping a Playtest now handles cases where Roblox Studio creates multiple plugin connections after Play starts. WEPPY no longer relies on only one connection for Stop, and cleanup checks the Playtest status when it needs confirmation that Studio returned to Edit mode. This reduces cases where the AI asks Studio to stop but the test keeps running until you retry.
21
+
11
22
  ## [2.8.0] - 2026-06-14
12
23
 
13
24
  ### Features
@@ -0,0 +1,51 @@
1
+ import{q as se,a as w,s as be,u as he,j as t,P as dt,I as ut,r as i,t as pt,R as He,X as Ie,E as ht,v as Ke,k as mt,i as gt,m as xt}from"./index-DG2RrKOl.js";import{C as Ge}from"./ConfirmModal-CpImpY9c.js";import{D as Pe,P as bt}from"./PageHeader-CThGgsAt.js";import{T as H}from"./TooltipText-H3YSCbob.js";/**
2
+ * @license lucide-react v1.8.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const yt=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ft=se("arrow-left",yt);/**
7
+ * @license lucide-react v1.8.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const jt=[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]],vt=se("audio-lines",jt);/**
12
+ * @license lucide-react v1.8.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Ct=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]],_t=se("badge",Ct);/**
17
+ * @license lucide-react v1.8.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const St=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],At=se("box",St);/**
22
+ * @license lucide-react v1.8.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const Nt=[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]],It=se("clapperboard",Nt);/**
27
+ * @license lucide-react v1.8.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const kt=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],We=se("copy",kt);/**
32
+ * @license lucide-react v1.8.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const Pt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]],Rt=se("film",Pt);/**
37
+ * @license lucide-react v1.8.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const wt=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],$t=se("search",wt);/**
42
+ * @license lucide-react v1.8.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const Lt=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Bt=se("trash-2",Lt);/**
47
+ * @license lucide-react v1.8.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const Dt=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Et=se("upload",Dt);function ze(e){if(e.scope==="place"&&typeof e.placeId=="number")return{placeId:String(e.placeId)}}function Q(e){const a=ze(e);return a?`?placeId=${encodeURIComponent(a.placeId)}`:""}function ye(e){return`/api/assets/${encodeURIComponent(e.scope)}/${encodeURIComponent(e.category)}`}function ce(e,a){return`${ye(e)}/${encodeURIComponent(a)}`}async function Ut(e){return w.get(ye(e),ze(e))}async function Tt(e){return w.post(`${ye(e)}/rescan${Q(e)}`,{})}async function Ot(e,a,u){return(await w.patch(`${ce(e,a)}${Q(e)}`,u)).asset}async function Ft(e,a){return w.delete(`${ce(e,a)}${Q(e)}`)}async function Mt(e,a,u){return(await w.post(`${ce(e,a)}/upload${Q(e)}`,u)).asset}async function Re(e,a){return(await w.post(`${ce(e,a)}/status-refresh${Q(e)}`,{})).asset}async function Ht(e,a,u){const o={...e,placeId:u??e.placeId};return w.post(`${ce(e,a)}/usage-scan${Q(o)}`,{})}async function Kt(e,a){return w.post(`${ye(e)}/export-selection-rbxm${Q(e)}`,a)}async function Gt(e,a,u){return w.post(`${ce(e,a)}/import-rbxm${Q(e)}`,u)}async function Wt(e,a){return(await w.post(`${ce(e,a)}/thumbnail-generate${Q(e)}`,{})).asset}function Ve(e){return e.fileUrl?`${be}${e.fileUrl}`:`${be}/api/assets/${e.scope.kind}/${e.category}/${encodeURIComponent(e.id)}/file${Q({scope:e.scope.kind,placeId:e.scope.kind==="place"?e.scope.placeId:void 0})}`}function Ye(e){return e.previewUrl?`${be}${e.previewUrl}`:`${be}/api/assets/${e.scope.kind}/${e.category}/${encodeURIComponent(e.id)}/preview${Q({scope:e.scope.kind,placeId:e.scope.kind==="place"?e.scope.placeId:void 0})}`}const Xe=["all","image","decal","rbxm"],zt=new Set(Xe),we=["model","animation"];function ge(e){return/\.(rbxm|rbxmx)$/i.test(e.file.original)}function Vt(e){return zt.has(e)}function Ae(e,a){return e==="all"?a("assets.category.all","All"):a(`assets.category.${e}`,e==="rbxm"?"RBXM":e)}function ie(e,a){return Ae(ge(e)?"rbxm":e.category,a)}function $e(e){return e==="all"?["image","decal",...we]:e==="rbxm"?we:[e]}function Yt(e,a){return a==="all"?e.category==="image"||e.category==="decal"||ge(e):a==="rbxm"?ge(e):(a==="model"||a==="animation")&&ge(e)?!1:e.category===a}function Xt(e){return[...e].sort((a,u)=>u.createdAt.localeCompare(a.createdAt)||u.id.localeCompare(a.id))}const qt="_page_8op6c_1",Zt="_experimentalBadge_8op6c_9",Jt="_toolbarShell_8op6c_23",Qt="_toolbar_8op6c_23",es="_segmented_8op6c_39",ts="_listContextSummary_8op6c_43",ss="_toolbarActions_8op6c_49",as="_categoryControl_8op6c_54",os="_contextDivider_8op6c_76",ns="_categoryControlLabel_8op6c_80",rs="_categoryRail_8op6c_86",ls="_categoryButton_8op6c_94",is="_categoryButtonActive_8op6c_123",cs="_actionRow_8op6c_130",ds="_copyRow_8op6c_131",us="_buttonRow_8op6c_132",ps="_segmentedActive_8op6c_163",hs="_filterLabel_8op6c_168",ms="_commandButton_8op6c_186",gs="_primaryButton_8op6c_187",xs="_iconButton_8op6c_188",bs="_dangerButton_8op6c_228",ys="_iconButtonActive_8op6c_238",fs="_grid_8op6c_251",js="_assetCard_8op6c_257",vs="_assetCardSelected_8op6c_271",Cs="_thumbnailWrap_8op6c_276",_s="_thumbnail_8op6c_276",Ss="_thumbnailFallback_8op6c_292",As="_assetCardBody_8op6c_303",Ns="_assetName_8op6c_310",Is="_assetMeta_8op6c_318",ks="_statusChip_8op6c_325",Ps="_categoryPill_8op6c_326",Rs="_status_uploaded_8op6c_339",ws="_status_failed_8op6c_344",$s="_status_processing_8op6c_349",Ls="_status_uploading_8op6c_350",Bs="_assetId_8op6c_355",Ds="_scopeText_8op6c_356",Es="_muted_8op6c_357",Us="_emptyState_8op6c_362",Ts="_notice_8op6c_363",Os="_errorState_8op6c_364",Fs="_messageState_8op6c_365",Ms="_proNotice_8op6c_395",Hs="_rbxmGuide_8op6c_411",Ks="_drawer_8op6c_437",Gs="_settingsInlinePanel_8op6c_451",Ws="_settingsPopoverIn_8op6c_1",zs="_settingsDrawer_8op6c_471",Vs="_detailPopupLayer_8op6c_487",Ys="_detailDialog_8op6c_503",Xs="_detailDialogHeader_8op6c_520",qs="_detailTitleBlock_8op6c_531",Zs="_detailEyebrow_8op6c_553",Js="_detailHeaderActions_8op6c_562",Qs="_detailDialogBody_8op6c_570",ea="_detailPreviewPane_8op6c_579",ta="_detailPreview_8op6c_579",sa="_detailPreviewFallback_8op6c_591",aa="_detailContentPane_8op6c_627",oa="_formStack_8op6c_633",na="_drawerHeader_8op6c_637",ra="_preview_8op6c_660",la="_previewFallback_8op6c_661",ia="_detailSection_8op6c_688",ca="_noticeList_8op6c_689",da="_settingsPanel_8op6c_690",ua="_setupNotice_8op6c_707",pa="_field_8op6c_732",ha="_fieldLabelRow_8op6c_740",ma="_fieldHelp_8op6c_764",ga="_twoColumn_8op6c_769",xa="_technicalDetails_8op6c_780",ba="_detailGrid_8op6c_797",ya="_metadataList_8op6c_798",fa="_compactMeta_8op6c_809",ja="_copyableValue_8op6c_836",va="_inlineCopyButton_8op6c_847",Ca="_hashText_8op6c_868",_a="_usageList_8op6c_872",Sa="_usageItem_8op6c_878",Aa="_metadataItem_8op6c_879",Na="_settingsSubsection_8op6c_927",Ia="_settingsSectionHeader_8op6c_932",ka="_settingsDefinitionList_8op6c_945",Pa="_toggleRow_8op6c_967",Ra="_inlineHelp_8op6c_981",wa="_headerRow_8op6c_1058",$a="_headerMeta_8op6c_1064",s={page:qt,experimentalBadge:Zt,toolbarShell:Jt,toolbar:Qt,segmented:es,listContextSummary:ts,toolbarActions:ss,categoryControl:as,contextDivider:os,categoryControlLabel:ns,categoryRail:rs,categoryButton:ls,categoryButtonActive:is,actionRow:cs,copyRow:ds,buttonRow:us,segmentedActive:ps,filterLabel:hs,commandButton:ms,primaryButton:gs,iconButton:xs,dangerButton:bs,iconButtonActive:ys,grid:fs,assetCard:js,assetCardSelected:vs,thumbnailWrap:Cs,thumbnail:_s,thumbnailFallback:Ss,assetCardBody:As,assetName:Ns,assetMeta:Is,statusChip:ks,categoryPill:Ps,status_uploaded:Rs,status_failed:ws,status_processing:$s,status_uploading:Ls,assetId:Bs,scopeText:Ds,muted:Es,emptyState:Us,notice:Ts,errorState:Os,messageState:Fs,proNotice:Ms,rbxmGuide:Hs,drawer:Ks,settingsInlinePanel:Gs,settingsPopoverIn:Ws,settingsDrawer:zs,detailPopupLayer:Vs,detailDialog:Ys,detailDialogHeader:Xs,detailTitleBlock:qs,detailEyebrow:Zs,detailHeaderActions:Js,detailDialogBody:Qs,detailPreviewPane:ea,detailPreview:ta,detailPreviewFallback:sa,detailContentPane:aa,formStack:oa,drawerHeader:na,preview:ra,previewFallback:la,detailSection:ia,noticeList:ca,settingsPanel:da,setupNotice:ua,field:pa,fieldLabelRow:ha,fieldHelp:ma,twoColumn:ga,technicalDetails:xa,detailGrid:ba,metadataList:ya,compactMeta:fa,copyableValue:ja,inlineCopyButton:va,hashText:Ca,usageList:_a,usageItem:Sa,metadataItem:Aa,settingsSubsection:Na,settingsSectionHeader:Ia,settingsDefinitionList:ka,toggleRow:Pa,inlineHelp:Ra,headerRow:wa,headerMeta:$a},La={image:ut,decal:_t,audio:vt,mesh:At,model:dt,video:Rt,animation:It};function Ne(e,a){return a(`assets.status.${e}`,e)}function Ba(e){return e.category==="image"||e.category==="decal"||!!e.file.preview}function Da(e){return e.category==="decal"?e.roblox.creatorAssetId??e.roblox.assetId:e.roblox.assetId}function Ea({assets:e,selectedAssetId:a,onSelect:u}){const{t:o}=he();return e.length===0?t.jsxs("div",{className:s.emptyState,children:[t.jsx("p",{children:o("assets.empty.title","No assets yet")}),t.jsx("span",{children:o("assets.empty.body","Choose a scope and category, then rescan that inbox folder.")})]}):t.jsx("div",{className:s.grid,children:e.map(l=>{const $=La[l.category],C=Da(l);return t.jsxs("button",{type:"button",className:[s.assetCard,a===l.id?s.assetCardSelected:""].filter(Boolean).join(" "),onClick:()=>u(l.id),children:[t.jsx("span",{className:s.thumbnailWrap,children:Ba(l)?t.jsx("img",{className:s.thumbnail,src:Ye(l),alt:l.displayName,loading:"lazy"}):t.jsx("span",{className:s.thumbnailFallback,"aria-hidden":"true",children:t.jsx($,{size:30})})}),t.jsxs("span",{className:s.assetCardBody,children:[t.jsx("span",{className:s.assetName,children:l.displayName}),t.jsxs("span",{className:s.assetMeta,children:[t.jsx("span",{className:s.categoryPill,children:ie(l,o)}),t.jsx("span",{className:`${s.statusChip} ${s[`status_${l.status}`]??""}`,children:Ne(l.status,o)})]}),t.jsxs("span",{className:s.assetMeta,children:[t.jsx("span",{className:s.scopeText,children:l.scope.kind==="shared"?o("assets.scope.shared","Shared"):o("assets.scope.place","Current Place")}),t.jsx("span",{className:s.assetId,children:C?`#${C}`:o("assets.status.localOnly","Local only")})]})]})]},l.id)})})}const Ua="https://create.roblox.com/dashboard/creations/store",Ta=/^https:\/\/create\.roblox\.com\/store\/asset\/\d+(?:\/.*)?$/;function Oa(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function xe(e){const a=new Date(e);if(Number.isNaN(a.getTime()))return e;const u=a.getFullYear(),o=String(a.getMonth()+1).padStart(2,"0"),l=String(a.getDate()).padStart(2,"0"),$=String(a.getHours()).padStart(2,"0"),C=String(a.getMinutes()).padStart(2,"0");return`${u}-${o}-${l} ${$}:${C}`}function Fa(e){return e.category==="image"||e.category==="decal"||!!e.file.preview}function Ma(e){return e.file.preview?Ye(e):Ve(e)}function Ha(e){var u;const a=Object.entries(((u=e.rbxm)==null?void 0:u.classCounts)??{}).sort((o,l)=>l[1]-o[1]).slice(0,8);return a.length===0?"-":a.map(([o,l])=>`${o} ${l}`).join(", ")}function Le(e){var l;const a=(l=e.rbxm)==null?void 0:l.thumbnail;if(!a)return"-";const u=a.source?` via ${a.source}`:"",o=a.message?` · ${a.message}`:"";return`${a.status}${u}${o}`}function Be(e){const{width:a,height:u}=e.file;return a===null||u===null?null:`${a} x ${u}px`}function De(e){const{durationMs:a}=e.file;return a===null?null:a<1e3?`${a} ms`:`${(a/1e3).toFixed(1)} s`}function Ka(e){return`${Ua}/${e}/configure`}function Ga(e){return e.category==="decal"?e.roblox.creatorAssetId??e.roblox.assetId??null:e.roblox.assetId??null}function Wa(e){const a=Ga(e),u=a?Ka(a):null,o=e.category==="decal"?e.roblox.creatorAssetWebUrl??e.roblox.assetWebUrl:e.roblox.assetWebUrl;return!o||u&&Ta.test(o)?u:o}function za(e){return`${xe(e.startedAt)} -> ${e.status}`}function Ee(e){return!e.creatorType||!e.creatorId?null:`${e.creatorType} ${e.creatorId}`}function Ue(e){return e.assetRole?`Asset role: ${e.assetRole}`:null}function me({label:e,value:a}){return a?t.jsx("button",{type:"button",className:s.inlineCopyButton,"aria-label":e,title:e,onClick:()=>{var u;return void((u=navigator.clipboard)==null?void 0:u.writeText(a))},children:t.jsx(We,{size:13})}):null}function Va({asset:e,busyAction:a,canUpload:u,canImportRbxm:o,importRbxmTooltip:l,importRbxmTargetParent:$,onClose:C,onSave:D,onUpload:p,onDelete:G,onImportRbxm:O,onRefreshStatus:U,onScanUsage:m}){var L,A;const{t:n}=he(),W=i.useRef(null),[K,V]=i.useState(""),[F,X]=i.useState("");if(i.useEffect(()=>{V((e==null?void 0:e.displayName)??""),X((e==null?void 0:e.description)??"")},[e==null?void 0:e.description,e==null?void 0:e.displayName,e==null?void 0:e.id]),i.useEffect(()=>{var g;if(!e)return;(g=W.current)==null||g.focus();const r=Z=>{Z.key==="Escape"&&C()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[e,C]),!e)return null;const k=e.status==="processing"&&!!(e.roblox.operationId??e.roblox.operationPath),q=!!e.roblox.assetUri,f=Wa(e),P=e.roblox.uploadAttempts??[],S=e.category==="decal"&&!!(e.roblox.creatorAssetId||e.roblox.backingImageAssetId||e.roblox.assetId),z=e.roblox.creatorAssetId??e.roblox.assetId,j=e.roblox.backingImageAssetId??e.roblox.assetId,v=e.roblox.assetId?e.usage.lastScannedAt?n("assets.detail.noUsageAfterScan","No references were found in local Sync files during the last check."):n("assets.detail.noUsageUnscanned","Run Scan usage to search local Sync files for this Roblox Asset ID."):n("assets.detail.noUsageNoRobloxId","This asset does not have a Roblox Asset ID yet, so usage cannot be checked. Upload it before scanning usage.");return t.jsx("div",{className:s.detailPopupLayer,onClick:C,role:"presentation",children:t.jsxs("section",{ref:W,className:s.detailDialog,role:"dialog","aria-modal":"true","aria-label":n("assets.detail.title","Asset details"),tabIndex:-1,onClick:r=>r.stopPropagation(),children:[t.jsxs("div",{className:s.detailDialogHeader,children:[t.jsxs("div",{className:s.detailTitleBlock,children:[t.jsxs("span",{className:s.detailEyebrow,children:[ie(e,n)," · ",Ne(e.status,n)]}),t.jsx("h2",{children:e.displayName}),t.jsx("span",{children:e.id})]}),t.jsxs("div",{className:s.detailHeaderActions,children:[t.jsx(H,{text:u?n("assets.upload.open.tooltip","Upload this local file to Roblox through Open Cloud."):n("assets.proOnly.tooltip","Roblox upload is available on Pro."),children:t.jsxs("button",{type:"button",className:s.commandButton,disabled:!u,onClick:p,children:[t.jsx(Et,{size:15}),n("assets.upload.open","Upload")]})}),o&&t.jsx(H,{text:l,children:t.jsxs("button",{type:"button",className:s.commandButton,disabled:a==="import-rbxm",onClick:()=>void O(),children:[t.jsx(pt,{size:15}),n("assets.detail.importRbxm","Insert into Studio")]})}),t.jsxs("button",{type:"button",className:s.commandButton,disabled:!k||a==="status-refresh",onClick:()=>void U(),children:[t.jsx(He,{size:15}),n("assets.detail.refreshStatus","Refresh")]}),t.jsxs("button",{type:"button",className:s.commandButton,disabled:!e.roblox.assetId||a==="usage-scan",onClick:()=>void m(),children:[t.jsx($t,{size:15}),n("assets.detail.scanUsage","Scan usage")]}),t.jsx(H,{text:n("assets.delete.tooltip","Delete this local Asset Library item."),children:t.jsxs("button",{type:"button",className:`${s.commandButton} ${s.dangerButton}`,disabled:a==="delete",onClick:G,children:[t.jsx(Bt,{size:15}),n("common.delete","Delete")]})}),t.jsx(H,{text:n("common.close","Close"),children:t.jsx("button",{type:"button",className:s.iconButton,onClick:C,"aria-label":n("common.close","Close"),children:t.jsx(Ie,{size:16})})})]})]}),t.jsxs("div",{className:s.detailDialogBody,children:[t.jsx("div",{className:s.detailPreviewPane,children:Fa(e)?t.jsx("img",{className:s.detailPreview,src:Ma(e),alt:e.displayName}):t.jsxs("div",{className:s.detailPreviewFallback,children:[t.jsx("span",{children:ie(e,n)}),t.jsx("code",{children:e.file.original}),((L=e.rbxm)==null?void 0:L.thumbnail)&&t.jsx("small",{children:Le(e)})]})}),t.jsxs("div",{className:s.detailContentPane,children:[t.jsxs("div",{className:s.formStack,children:[t.jsxs("label",{className:s.field,children:[t.jsx("span",{children:n("assets.detail.displayName","Display name")}),t.jsx("input",{value:K,onChange:r=>V(r.target.value)})]}),t.jsxs("label",{className:s.field,children:[t.jsx("span",{children:n("assets.detail.description","Description")}),t.jsx("textarea",{value:F,rows:3,onChange:r=>X(r.target.value)})]}),t.jsx("button",{type:"button",className:s.primaryButton,disabled:a==="update",onClick:()=>void D(K,F),children:n("assets.detail.save","Save metadata")})]}),t.jsxs("section",{className:s.detailSection,children:[t.jsx("h3",{children:n("assets.detail.localFile","Local file")}),t.jsxs("dl",{className:s.detailGrid,children:[t.jsx("dt",{children:n("assets.detail.fileName","File")}),t.jsx("dd",{children:e.file.original}),t.jsx("dt",{children:n("assets.detail.source","Source path")}),t.jsx("dd",{children:e.source.originalPath}),t.jsx("dt",{children:n("assets.detail.category","Category")}),t.jsx("dd",{children:ie(e,n)}),t.jsx("dt",{children:n("assets.detail.scope","Scope")}),t.jsx("dd",{children:e.scope.kind==="shared"?n("assets.scope.shared","Shared"):n("assets.scope.place","Current Place")}),t.jsx("dt",{children:n("assets.detail.mimeType","Type")}),t.jsx("dd",{children:e.file.mimeType}),t.jsx("dt",{children:n("assets.detail.size","Size")}),t.jsx("dd",{children:Oa(e.file.sizeBytes)}),Be(e)&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.dimensions","Dimensions")}),t.jsx("dd",{children:Be(e)})]}),De(e)&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.duration","Duration")}),t.jsx("dd",{children:De(e)})]})]})]}),e.rbxm&&t.jsxs("section",{className:s.detailSection,children:[t.jsx("h3",{children:n("assets.detail.rbxm","RBXM contents")}),t.jsxs("dl",{className:s.detailGrid,children:[t.jsx("dt",{children:n("assets.detail.rbxmExportedCount","Exported roots")}),t.jsx("dd",{children:e.rbxm.exportedCount}),t.jsx("dt",{children:n("assets.detail.rbxmClasses","Classes")}),t.jsx("dd",{children:Ha(e)}),t.jsx("dt",{children:n("assets.detail.rbxmThumbnail","Thumbnail")}),t.jsx("dd",{children:Le(e)}),o&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.studioInsertTarget","Studio insert target")}),t.jsx("dd",{children:$})]})]}),e.rbxm.roots.length>0&&t.jsxs("div",{className:s.metadataList,children:[t.jsx("strong",{children:n("assets.detail.rbxmRoots","Root tree")}),e.rbxm.roots.map(r=>t.jsxs("div",{className:s.metadataItem,children:[t.jsxs("span",{children:[r.name," (",r.className,")"]}),t.jsx("code",{children:r.path})]},`${r.path}-${r.className}`))]}),e.rbxm.resourceReferences.length>0&&t.jsxs("div",{className:s.metadataList,children:[t.jsx("strong",{children:n("assets.detail.rbxmReferences","Asset references")}),e.rbxm.resourceReferences.map((r,g)=>t.jsxs("div",{className:s.metadataItem,children:[t.jsxs("span",{children:[r.path," · ",r.property]}),t.jsx("code",{children:r.assetId?`${r.value} (#${r.assetId})`:r.value})]},`${r.path}-${r.property}-${g}`))]})]}),t.jsxs("section",{className:s.detailSection,children:[t.jsx("h3",{children:n("assets.detail.roblox","Roblox upload status")}),t.jsxs("dl",{className:s.detailGrid,children:[t.jsx("dt",{children:n("assets.detail.status","Status")}),t.jsx("dd",{children:Ne(e.status,n)}),S?t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.decalAssetId","Roblox Decal ID")}),t.jsxs("dd",{className:s.copyableValue,children:[t.jsx("span",{children:z??n("assets.status.localOnly","Local only")}),t.jsx(me,{label:n("assets.detail.copyDecalAssetId","Copy Roblox Decal ID"),value:z})]}),t.jsx("dt",{children:n("assets.detail.studioTextureImageId","Studio Texture Image ID")}),t.jsxs("dd",{className:s.copyableValue,children:[t.jsx("span",{children:j??"-"}),t.jsx(me,{label:n("assets.detail.copyStudioTextureImageId","Copy Studio Texture Image ID"),value:j})]})]}):t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.assetId","Asset ID")}),t.jsxs("dd",{className:s.copyableValue,children:[t.jsx("span",{children:e.roblox.assetId??n("assets.status.localOnly","Local only")}),t.jsx(me,{label:n("assets.detail.copyAssetId","Copy Asset ID"),value:e.roblox.assetId})]})]}),t.jsx("dt",{children:n("assets.detail.studioUri","Studio URI")}),t.jsx("dd",{children:e.roblox.assetUri??"-"}),t.jsx("dt",{children:n("assets.detail.robloxWebUrl","Creator Dashboard URL")}),t.jsxs("dd",{className:s.copyableValue,children:[t.jsx("span",{children:f??"-"}),t.jsx(me,{label:n("assets.detail.copyWebUrl","Copy configure URL"),value:f})]}),e.roblox.errorMessage&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.error","Error")}),t.jsx("dd",{children:e.roblox.errorMessage})]})]}),t.jsxs("div",{className:s.copyRow,children:[t.jsxs("button",{type:"button",className:s.commandButton,disabled:!q,onClick:()=>{var r;return e.roblox.assetUri&&void((r=navigator.clipboard)==null?void 0:r.writeText(e.roblox.assetUri))},children:[t.jsx(We,{size:15}),n("assets.detail.copyStudioUri","Copy Studio URI")]}),f&&t.jsxs("a",{className:s.commandButton,href:f,target:"_blank",rel:"noreferrer",children:[t.jsx(ht,{size:15}),n("assets.detail.openRobloxPage","Open configure page")]})]}),e.roblox.assetId&&t.jsx("p",{className:s.muted,children:n("assets.detail.robloxWebUrlNotice","Opening this page requires the Roblox account that owns or can manage the uploaded asset.")}),P.length>0&&t.jsxs("div",{className:s.metadataList,children:[t.jsx("strong",{children:n("assets.detail.uploadHistory","Upload history")}),P.slice().reverse().map((r,g)=>t.jsxs("div",{className:s.metadataItem,children:[t.jsx("span",{children:za(r)}),Ee(r)&&t.jsx("code",{children:Ee(r)}),Ue(r)&&t.jsx("code",{children:Ue(r)}),r.operationPath&&t.jsx("code",{children:r.operationPath}),r.assetId&&t.jsxs("code",{children:[n("assets.detail.assetId","Asset ID"),": ",r.assetId]}),r.remotePath&&t.jsx("code",{children:r.remotePath}),r.message&&t.jsx("code",{children:r.message}),r.errorMessage&&t.jsx("code",{children:r.errorMessage})]},`${r.startedAt}-${r.operationPath??g}`))]})]}),t.jsxs("section",{className:s.detailSection,children:[t.jsx("h3",{children:n("assets.detail.usedInPlace","Where this asset is used in this Place")}),t.jsxs("dl",{className:s.detailGrid,children:[t.jsx("dt",{children:n("assets.detail.usageSource","Checked against")}),t.jsx("dd",{children:e.usage.scanSource==="localSync"?n("assets.detail.usageSource.localSync","Local Sync files"):n("assets.detail.usageSource.notScanned","Not checked yet")}),t.jsx("dt",{children:n("assets.detail.lastScanned","Last checked")}),t.jsx("dd",{children:e.usage.lastScannedAt?n("assets.detail.lastScannedAt","Last checked: {time}").replace("{time}",xe(e.usage.lastScannedAt)):n("assets.detail.lastScanned.never","No check yet")})]}),e.usage.references.length===0?t.jsx("p",{className:s.muted,children:v}):t.jsx("div",{className:s.usageList,children:e.usage.references.map((r,g)=>t.jsxs("div",{className:s.usageItem,children:[t.jsx("strong",{children:r.kind==="property"?r.instancePath:r.filePath}),t.jsx("span",{children:r.property??n("assets.detail.line","line {line}").replace("{line}",String(r.line??"-"))}),t.jsx("code",{children:r.value})]},`${r.kind}-${g}`))})]}),t.jsxs("details",{className:s.technicalDetails,children:[t.jsx("summary",{children:n("assets.detail.technicalDetails","Technical details")}),t.jsxs("dl",{className:s.detailGrid,children:[t.jsx("dt",{children:n("assets.detail.stableId","Stable ID")}),t.jsx("dd",{className:s.hashText,children:e.id}),t.jsx("dt",{children:n("assets.detail.sourceKind","Source kind")}),t.jsx("dd",{children:e.source.kind}),t.jsx("dt",{children:n("assets.detail.sha256","SHA-256")}),t.jsx("dd",{className:s.hashText,children:e.file.sha256}),t.jsx("dt",{children:n("assets.detail.createdAt","Created")}),t.jsx("dd",{children:xe(e.createdAt)}),t.jsx("dt",{children:n("assets.detail.updatedAt","Updated")}),t.jsx("dd",{children:xe(e.updatedAt)}),e.roblox.operationId&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.operationId","Operation ID")}),t.jsx("dd",{className:s.hashText,children:e.roblox.operationId})]}),e.roblox.operationPath&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.operationPath","Operation path")}),t.jsx("dd",{className:s.hashText,children:e.roblox.operationPath})]}),e.roblox.versionId&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.versionId","Version ID")}),t.jsx("dd",{className:s.hashText,children:e.roblox.versionId})]}),e.roblox.remotePath&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.remotePath","Remote path")}),t.jsx("dd",{className:s.hashText,children:e.roblox.remotePath})]}),e.roblox.moderationState&&t.jsxs(t.Fragment,{children:[t.jsx("dt",{children:n("assets.detail.moderationState","Moderation")}),t.jsx("dd",{children:e.roblox.moderationState})]})]}),((A=e.rbxm)==null?void 0:A.thumbnail.attempts)&&e.rbxm.thumbnail.attempts.length>0&&t.jsxs("div",{className:s.metadataList,children:[t.jsx("strong",{children:n("assets.detail.rbxmThumbnailAttempts","Thumbnail attempts")}),e.rbxm.thumbnail.attempts.map((r,g)=>t.jsxs("div",{className:s.metadataItem,children:[t.jsxs("span",{children:[r.method," · ",r.status]}),r.message&&t.jsx("code",{children:r.message})]},`${r.method}-${g}`))]})]})]})]})]})})}function qe(e){return{assetUploadByOpenCloudEnabled:e.hot.ENABLE_ASSET_UPLOAD_BY_OPEN_CLOUD===!0}}function Ya(e){const a={};return typeof e.assetUploadByOpenCloudEnabled=="boolean"&&(a.ENABLE_ASSET_UPLOAD_BY_OPEN_CLOUD=e.assetUploadByOpenCloudEnabled),a}async function Ze(){const e=await w.get("/api/dashboard/settings");return qe(e)}async function Xa(e){const a=await w.patch("/api/dashboard/settings",Ya(e));return qe(a)}async function Je(){return w.get("/api/dashboard/open-cloud/credential-profiles")}async function qa(e){return w.post("/api/dashboard/open-cloud/credential-profiles",e)}async function Za(e){return w.patch("/api/dashboard/open-cloud/credential-profiles/active",{profileId:e})}async function Ja(e,a){return w.put(`/api/dashboard/open-cloud/credential-profiles/${encodeURIComponent(e)}/api-key`,a)}async function Qa(e){return w.delete(`/api/dashboard/open-cloud/credential-profiles/${encodeURIComponent(e)}`)}async function eo(e,a){return w.post(`/api/dashboard/open-cloud/credential-profiles/${encodeURIComponent(e)}/creators`,a)}async function to(e,a){return w.patch(`/api/dashboard/open-cloud/credential-profiles/${encodeURIComponent(e)}/creators/${encodeURIComponent(a)}/default`,{})}async function so(e,a){return w.delete(`/api/dashboard/open-cloud/credential-profiles/${encodeURIComponent(e)}/creators/${encodeURIComponent(a)}`)}async function ao(e,a){return w.post(`/api/dashboard/open-cloud/credential-profiles/${encodeURIComponent(e)}/test`,a?{creatorPresetId:a}:{})}async function oo(e){return w.post("/api/dashboard/open-cloud/credential/test",e?{apiKey:e}:{})}function no(e){return e.category==="image"||e.category==="decal"}function ro(e,a){return e==="group"?a("assets.creator.group","Group"):a("assets.creator.user","User")}function lo(e,a){return`${e.label} · ${ro(e.creatorType,a)} ${e.creatorId}`}function Te(e){if(!e)return null;if(e.defaultCreatorId){const a=e.creators.find(u=>u.id===e.defaultCreatorId);if(a)return a}return e.creators[0]??null}function io({asset:e,open:a,canUpload:u,busyAction:o,onClose:l,onBack:$,onOpenSettings:C,onUpload:D}){const{t:p}=he(),G=i.useRef(null),[O,U]=i.useState(null),[m,n]=i.useState(null),[W,K]=i.useState(!1),[V,F]=i.useState(null),[X,k]=i.useState(""),[q,f]=i.useState(""),[P,S]=i.useState(""),[z,j]=i.useState("user"),[v,L]=i.useState("");if(i.useEffect(()=>{k((e==null?void 0:e.displayName)??""),f((e==null?void 0:e.description)??"")},[e==null?void 0:e.description,e==null?void 0:e.displayName,e==null?void 0:e.id]),i.useEffect(()=>{if(!a)return;let x=!1;return K(!0),F(null),(async()=>{try{const[B,T]=await Promise.all([Ze(),Je()]);if(x)return;U(B);const oe=T.profiles.find(de=>de.id===T.activeProfileId)??T.profiles[0]??null;n(oe);const Y=Te(oe);S((Y==null?void 0:Y.id)??""),j((Y==null?void 0:Y.creatorType)??"user"),L((Y==null?void 0:Y.creatorId)??"")}catch(B){if(x)return;F(B instanceof Error?B.message:p("assets.upload.settingsLoadFailed","Failed to load upload settings.")),U(null),n(null)}finally{x||K(!1)}})(),()=>{x=!0}},[a,p]),i.useEffect(()=>{var B;if(!a||!e)return;(B=G.current)==null||B.focus();const x=T=>{T.key==="Escape"&&l()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[e,l,a]),!a||!e)return null;const A=(O==null?void 0:O.assetUploadByOpenCloudEnabled)===!0,r=!!m,g=Te(m),Z=(m==null?void 0:m.creators.find(x=>x.id===P))??null,ee=!!g,J=(m==null?void 0:m.storageProvider)==="env"&&r&&!ee,ae=J&&v.trim().length>0,h=u&&!W&&!V&&(!A||!r||!ee&&!J),te=u&&!W&&!V&&A&&r&&(ee||ae)&&o!=="upload";return t.jsx("div",{className:s.detailPopupLayer,onClick:l,role:"presentation",children:t.jsxs("section",{ref:G,className:s.detailDialog,role:"dialog","aria-modal":"true","aria-label":p("assets.upload.title","Upload asset"),tabIndex:-1,onClick:x=>x.stopPropagation(),children:[t.jsxs("div",{className:s.detailDialogHeader,children:[t.jsxs("div",{className:s.detailTitleBlock,children:[t.jsxs("span",{className:s.detailEyebrow,children:[ie(e,p)," · ",p("assets.upload.intent","Upload to Roblox")]}),t.jsx("h2",{children:p("assets.upload.title","Upload asset")}),t.jsx("span",{children:e.displayName})]}),t.jsxs("div",{className:s.detailHeaderActions,children:[t.jsxs("button",{type:"button",className:s.commandButton,onClick:$,children:[t.jsx(ft,{size:15}),p("assets.upload.backToDetails","Back to details")]}),t.jsx(H,{text:p("common.close","Close"),children:t.jsx("button",{type:"button",className:s.iconButton,onClick:l,"aria-label":p("common.close","Close"),children:t.jsx(Ie,{size:16})})})]})]}),t.jsxs("div",{className:s.detailDialogBody,children:[t.jsx("div",{className:s.detailPreviewPane,children:no(e)?t.jsx("img",{className:s.detailPreview,src:Ve(e),alt:e.displayName}):t.jsxs("div",{className:s.detailPreviewFallback,children:[t.jsx("span",{children:ie(e,p)}),t.jsx("code",{children:e.file.original})]})}),t.jsxs("div",{className:s.detailContentPane,children:[!u&&t.jsx("div",{className:s.notice,children:p("assets.proOnly.upload","Roblox upload is available on Pro.")}),W&&t.jsx("div",{className:s.notice,children:p("assets.upload.checkingSettings","Checking upload settings...")}),V&&t.jsx("div",{className:s.errorState,children:V}),t.jsxs("dl",{className:s.compactMeta,children:[t.jsx("dt",{children:p("assets.detail.category","Category")}),t.jsx("dd",{children:ie(e,p)}),t.jsx("dt",{children:p("assets.detail.source","Source")}),t.jsx("dd",{children:e.source.originalPath})]}),h&&t.jsxs("div",{className:s.setupNotice,children:[t.jsx("strong",{children:p("assets.upload.settingsRequired","Upload settings required")}),t.jsx("p",{children:r?A?p("assets.upload.settingsRequired.creator","Save a default Creator before uploading."):p("assets.upload.settingsRequired.toggle","Enable Open Cloud upload before uploading."):p("assets.upload.settingsRequired.apiKey","Save an Open Cloud API key before uploading.")}),t.jsxs("button",{type:"button",className:s.commandButton,onClick:C,children:[t.jsx(Ke,{size:15}),p("assets.upload.openSettings","Open Asset Library settings")]})]}),t.jsxs("div",{className:s.formStack,children:[t.jsxs("label",{className:s.field,children:[t.jsx("span",{children:p("assets.detail.displayName","Display name")}),t.jsx("input",{value:X,disabled:!u,onChange:x=>k(x.target.value)}),t.jsx("small",{className:s.fieldHelp,children:p("assets.upload.displayNameHelp","Saved to Roblox as the asset display name.")})]}),t.jsxs("label",{className:s.field,children:[t.jsx("span",{children:p("assets.detail.description","Description")}),t.jsx("textarea",{value:q,rows:3,disabled:!u,onChange:x=>f(x.target.value)}),t.jsx("small",{className:s.fieldHelp,children:p("assets.upload.descriptionHelp","Saved to Roblox as the asset description.")})]}),ee&&t.jsxs("label",{className:s.field,children:[t.jsx("span",{children:p("assets.upload.creator","Creator")}),t.jsx("select",{"aria-label":p("assets.upload.creator","Creator"),value:P,disabled:!u||W,onChange:x=>S(x.target.value),children:m==null?void 0:m.creators.map(x=>t.jsx("option",{value:x.id,children:lo(x,p)},x.id))}),t.jsx("small",{className:s.fieldHelp,children:p("assets.upload.creatorHelp","Used by Open Cloud as the owner of the uploaded asset.")})]}),J&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:s.inlineHelp,children:p("assets.upload.envCreatorHelp","Environment API keys cannot save a default Creator here. Enter the Creator for this upload.")}),t.jsxs("div",{className:s.twoColumn,children:[t.jsxs("label",{className:s.field,children:[t.jsx("span",{children:p("assets.upload.creatorType","Creator type")}),t.jsxs("select",{value:z,disabled:!u,onChange:x=>j(x.target.value),children:[t.jsx("option",{value:"user",children:p("assets.creator.user","User")}),t.jsx("option",{value:"group",children:p("assets.creator.group","Group")})]}),t.jsx("small",{className:s.fieldHelp,children:p("assets.upload.creatorTypeHelp","Sent to Open Cloud as the Creator type.")})]}),t.jsxs("label",{className:s.field,children:[t.jsx("span",{children:p("assets.upload.creatorId","Creator ID")}),t.jsx("input",{value:v,disabled:!u,onChange:x=>L(x.target.value)}),t.jsx("small",{className:s.fieldHelp,children:p("assets.upload.creatorIdHelp","Sent to Open Cloud as the User or Group ID that owns the uploaded asset.")})]})]})]}),t.jsx("button",{type:"button",className:s.primaryButton,disabled:!te,onClick:()=>{const x=v.trim(),B=J&&x?{creatorType:z,creatorId:x}:{},T=!J&&Z&&g&&Z.id!==g.id?{creatorType:Z.creatorType,creatorId:Z.creatorId}:{};D({displayName:X,description:q,...B,...T})},children:o==="upload"?p("assets.upload.uploading","Uploading..."):p("assets.upload.submit","Upload with Roblox Open Cloud")})]}),t.jsxs("div",{className:s.noticeList,children:[t.jsx("p",{children:p("assets.upload.noDelete","WEPPY does not provide Roblox asset deletion.")}),t.jsx("p",{children:p("assets.upload.delay","Roblox processing and moderation can delay visibility in Studio or Creator Dashboard.")})]})]})]})]})})}function Oe(e,a){return e==="env"?a("assets.settings.credential.env","Environment variable"):a("assets.settings.credential.local","Local encrypted file")}function ve(e,a){return e==="valid"?a("assets.settings.validation.valid","Connected"):e==="invalid"?a("assets.settings.validation.invalid","Needs attention"):a("assets.settings.validation.unknown","Not tested")}function co(e,a){return(e==null?void 0:e.status)==="valid"?a("assets.settings.apiKeyTested","Open Cloud API key connection tested."):(e==null?void 0:e.message)??a("assets.settings.tested","Connection tested.")}function uo(e,a){return(e==null?void 0:e.status)==="valid"?a("assets.settings.apiKeyTested","Open Cloud API key connection tested."):(e==null?void 0:e.message)??a("assets.settings.tested","Connection tested.")}function po(e,a){return e==="group"?a("assets.creator.group","Group"):a("assets.creator.user","User")}function ho(e,a){return`${po(e.creatorType,a)} ${e.creatorId}`}function mo({open:e,tier:a,onClose:u}){const{t:o}=he(),[l,$]=i.useState(null),[C,D]=i.useState(null),[p,G]=i.useState(""),[O,U]=i.useState(!1),[m,n]=i.useState(""),[W,K]=i.useState(""),[V,F]=i.useState("user"),[X,k]=i.useState(""),[q,f]=i.useState(""),[P,S]=i.useState(!0),[z,j]=i.useState(null),[v,L]=i.useState(null),[A,r]=i.useState(!1),g=a==="basic",Z=i.useCallback(async()=>{r(!0),j(null);try{const[d,N]=await Promise.all([Ze(),Je()]);$(d),D(N);const R=N.profiles.find(re=>re.id===N.activeProfileId)??N.profiles[0]??null;G((R==null?void 0:R.id)??""),U(!R),S(!R||R.creators.length===0),F("user"),k(""),f("")}catch(d){j(d instanceof Error?d.message:o("assets.settings.loadFailed","Failed to load upload settings."))}finally{r(!1)}},[o]);if(i.useEffect(()=>{e&&Z()},[Z,e]),!e)return null;const ee=(l==null?void 0:l.assetUploadByOpenCloudEnabled)===!0,E=W.trim(),J=X.trim(),ae=(C==null?void 0:C.profiles)??[],h=ae.find(d=>d.id===p)??ae[0]??null,te=!!h,x=te&&(h==null?void 0:h.storageProvider)==="localFile",B=te&&(h==null?void 0:h.storageProvider)==="env",T=h!=null&&h.defaultCreatorId?h.creators.find(d=>d.id===h.defaultCreatorId):h==null?void 0:h.creators[0],oe=!!(h!=null&&h.creators.length),Y=!oe||P,de=ae.length>1,ne=g?o("assets.settings.action.proRequired","Asset upload settings are available on Pro."):A?o("assets.settings.action.busy","Wait for the current settings action to finish."):null,c=g||A||!E,y=ne??(E?o("assets.settings.saveApiKey.tooltip.ready","Save this API key to local encrypted storage."):o("assets.settings.saveApiKey.tooltip.enter","Enter an Open Cloud API key to save it locally.")),b=g||A||!E&&!te,_=ne??(E?o("assets.settings.testConnection.tooltip.entered","Test the entered API key before saving it."):te?o("assets.settings.testConnection.tooltip.saved","Test the saved Open Cloud API key."):o("assets.settings.testConnection.tooltip.enterOrSaved","Enter an API key or save one before testing the connection.")),I=g||A||!x,M=ne??(x?o("assets.settings.removeApiKey.tooltip.ready","Remove the locally saved Open Cloud API key."):B?o("assets.settings.removeApiKey.tooltip.env","Environment API keys cannot be removed from Dashboard. Remove ROBLOX_OPEN_CLOUD_API_KEY outside WEPPY."):o("assets.settings.removeApiKey.tooltip.none","No local Open Cloud API key is saved.")),ue=g||A||!x||!J,Qe=ne??(B?o("assets.settings.saveCreator.tooltip.env","Environment API keys cannot save a default Creator here. Enter Creator details in the upload dialog."):x?J?o("assets.settings.saveCreator.tooltip.ready","Save this Creator as the default owner for uploads."):o("assets.settings.saveCreator.tooltip.enterId","Enter a user or group ID before saving the default Creator."):o("assets.settings.saveCreator.tooltip.noLocal","Save a local Open Cloud API key before saving a default Creator.")),et=ne??(x?o("assets.settings.addCreator.tooltip.ready","Add another User or Group Creator preset to this profile."):o("assets.settings.saveCreator.tooltip.noLocal","Save a local Open Cloud API key before saving a default Creator.")),tt=g||A||B||!x,st=ne??(x?o("assets.settings.unregisterCreator.tooltip.ready","Unregister this Creator from the selected profile."):B?o("assets.settings.saveCreator.tooltip.env","Environment API keys cannot save a default Creator here. Enter Creator details in the upload dialog."):o("assets.settings.saveCreator.tooltip.noLocal","Save a local Open Cloud API key before saving a default Creator.")),at=T?o("assets.settings.saveCreatorPreset","Save Creator"):o("assets.settings.saveCreator","Save default Creator"),ot=(h==null?void 0:h.label)??o("assets.settings.credential.none","No API key saved"),fe=d=>{const N=d.profiles.find(R=>R.id===d.activeProfileId)??d.profiles[0]??null;D(d),G((N==null?void 0:N.id)??""),S(!N||N.creators.length===0),U(d.profiles.length===0)},nt=async()=>{if(h){r(!0);try{const d=await ao(h.id,T==null?void 0:T.id);fe(d),j(uo(d.validation,o))}catch(d){j(d instanceof Error?d.message:o("assets.settings.testFailed","Connection test failed."))}finally{r(!1)}}},rt=async()=>{if(v){r(!0);try{if(v.kind==="apiKey"){const d=await Qa(v.profileId);fe(d),j(o("assets.settings.apiKeyRemoved","Open Cloud API key unregistered from local storage."))}else{const d=await so(v.profileId,v.creatorPresetId);fe(d),j(o("assets.settings.creatorUnregistered","Creator unregistered from this profile."))}L(null)}catch(d){j(d instanceof Error?d.message:v.kind==="apiKey"?o("assets.settings.removeFailed","Failed to unregister API key."):o("assets.settings.creatorUnregisterFailed","Failed to unregister Creator."))}finally{r(!1)}}},lt=(v==null?void 0:v.kind)==="apiKey"?o("assets.settings.unregisterApiKey.title","Unregister API Key?"):o("assets.settings.unregisterCreator.title","Unregister Creator?"),it=(v==null?void 0:v.kind)==="apiKey"?o("assets.settings.unregisterApiKey.message","Roblox API key is not revoked. WEPPY only removes the local Credential Profile registration on this device."):o("assets.settings.unregisterCreator.message","Roblox user or group is not deleted. WEPPY only removes this Creator from the selected API Key profile."),ct=(v==null?void 0:v.kind)==="apiKey"?o("assets.settings.removeApiKey","Unregister API Key"):o("assets.settings.unregisterCreator","Unregister Creator");return t.jsxs("section",{id:"asset-library-settings-panel",className:`${s.settingsInlinePanel} ${s.settingsDrawer}`,role:"region","aria-label":o("assets.settings.title","Asset Library settings"),"data-panel-placement":"toolbar-popover",children:[t.jsxs("div",{className:s.drawerHeader,children:[t.jsxs("div",{children:[t.jsx("h2",{children:o("assets.settings.title","Asset Library settings")}),t.jsx("span",{children:ot})]}),t.jsx(H,{text:o("common.close","Close"),children:t.jsx("button",{type:"button",className:s.iconButton,onClick:u,"aria-label":o("common.close","Close"),children:t.jsx(Ie,{size:16})})})]}),g&&t.jsx("div",{className:`${s.notice} ${s.proNotice}`,children:o("assets.settings.proOnly","Roblox upload settings and Open Cloud credential controls are available on Pro.")}),t.jsxs("section",{className:s.settingsPanel,children:[t.jsxs("label",{className:s.toggleRow,children:[t.jsxs("span",{children:[t.jsx("strong",{children:o("assets.settings.openCloudToggle","Open Cloud upload")}),t.jsx("small",{children:o("assets.settings.openCloudToggle.help","Controls whether server-side Open Cloud upload mutations can run.")})]}),t.jsx("input",{type:"checkbox",checked:ee,disabled:g||A,onChange:d=>{(async()=>{r(!0);try{const N=await Xa({assetUploadByOpenCloudEnabled:d.target.checked});$(N),j(o("assets.settings.saved","Upload settings saved."))}catch(N){j(N instanceof Error?N.message:o("assets.settings.saveFailed","Failed to save upload settings."))}finally{r(!1)}})()}})]}),de&&t.jsx("div",{className:s.metadataList,children:ae.map(d=>{const N=d.id===(h==null?void 0:h.id);return t.jsxs("div",{className:s.metadataItem,children:[t.jsx("strong",{children:d.label}),t.jsxs("span",{children:[o("assets.settings.field.storage","Storage"),": ",Oe(d.storageProvider,o)]}),t.jsxs("span",{children:[o("assets.settings.field.validationStatus","Validation status"),": ",ve(d.validationStatus,o)]}),N&&t.jsx("code",{children:o("assets.settings.activeProfileBadge","Active")}),!N&&d.storageProvider==="localFile"&&t.jsx("button",{type:"button",className:s.commandButton,disabled:g||A,onClick:()=>{(async()=>{r(!0);try{const R=await Za(d.id),re=R.profiles.find(je=>je.id===(R.activeProfileId??d.id))??d;D(R),G(re.id),S(re.creators.length===0),F("user"),k(""),f(""),j(o("assets.settings.profileSelected","Open Cloud credential profile selected."))}catch(R){j(R instanceof Error?R.message:o("assets.settings.saveFailed","Failed to save upload settings."))}finally{r(!1)}})()},children:o("assets.settings.useProfile","Use profile")})]},d.id)})}),h&&t.jsxs("div",{className:s.settingsSubsection,children:[t.jsx("div",{className:s.settingsSectionHeader,children:t.jsx("h3",{children:o("assets.settings.credentialProfile","Credential Profile")})}),t.jsxs("div",{className:s.metadataItem,children:[t.jsxs("dl",{className:s.settingsDefinitionList,children:[t.jsxs("div",{children:[t.jsx("dt",{children:o("assets.settings.field.profile","Profile")}),t.jsx("dd",{children:h.label})]}),h.maskedKey&&t.jsxs("div",{children:[t.jsx("dt",{children:o("assets.settings.field.apiKey","API Key")}),t.jsx("dd",{children:h.maskedKey})]}),t.jsxs("div",{children:[t.jsx("dt",{children:o("assets.settings.field.storage","Storage")}),t.jsx("dd",{children:Oe(h.storageProvider,o)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:o("assets.settings.field.validationStatus","Validation status")}),t.jsx("dd",{children:ve(h.validationStatus,o)})]}),t.jsxs("div",{children:[t.jsx("dt",{children:o("assets.settings.field.creators","Creators")}),t.jsx("dd",{children:h.creators.length})]})]}),!O&&t.jsxs("div",{className:s.buttonRow,children:[t.jsx(H,{text:_,children:t.jsx("button",{type:"button",className:s.commandButton,disabled:b,onClick:()=>{nt()},children:o("assets.settings.testConnection","Test Connection")})}),x&&t.jsx("button",{type:"button",className:s.commandButton,disabled:g||A,onClick:()=>U(!0),children:o("assets.settings.replaceApiKey","Replace API Key")}),t.jsx(H,{text:M,children:t.jsx("button",{type:"button",className:`${s.commandButton} ${s.dangerButton}`,disabled:I,onClick:()=>L({kind:"apiKey",profileId:h.id}),children:o("assets.settings.removeApiKey","Unregister API Key")})})]})]})]}),O&&t.jsxs("div",{className:s.formStack,children:[t.jsxs("div",{className:s.field,children:[t.jsx("div",{className:s.fieldLabelRow,children:t.jsx("label",{htmlFor:"asset-settings-open-cloud-profile-label",children:o("assets.settings.profileLabel","Profile name")})}),t.jsx("input",{id:"asset-settings-open-cloud-profile-label",value:m,disabled:g||A,onChange:d=>n(d.target.value),placeholder:o("assets.settings.profileLabel.placeholder","Studio automation key")}),t.jsx("p",{className:s.inlineHelp,children:o("assets.settings.profileLabel.help","Optional. If left blank, WEPPY saves this profile as Open Cloud key automatically.")})]}),t.jsxs("div",{className:s.field,children:[t.jsxs("div",{className:s.fieldLabelRow,children:[t.jsx("label",{htmlFor:"asset-settings-open-cloud-api-key",children:o("assets.settings.apiKey","Open Cloud API Key")}),t.jsx(Pe,{topicId:"openCloudApiKey",variant:"field",state:{hasOpenCloudCredential:te}})]}),t.jsx("input",{id:"asset-settings-open-cloud-api-key",value:W,type:"password",disabled:g||A,onChange:d=>K(d.target.value)}),t.jsx("p",{className:s.inlineHelp,children:o("assets.settings.apiKey.inlineHelp","WEPPY uses this key only for Roblox Open Cloud requests. The key is encrypted on this device and is not sent to WEPPY servers or stored in any other external storage.")})]}),!te&&t.jsx("p",{className:s.inlineHelp,children:t.jsx("a",{href:"https://create.roblox.com/docs/cloud/auth/api-keys",target:"_blank",rel:"noreferrer",children:o("assets.settings.apiKeyGuide","Create a Roblox API key with Assets Read and Write permissions.")})}),t.jsxs("div",{className:s.buttonRow,children:[t.jsx(H,{text:y,children:t.jsx("button",{type:"button",className:s.commandButton,disabled:c,onClick:()=>{(async()=>{var d;r(!0);try{const N={apiKey:E,...m.trim()?{label:m.trim()}:{}},R=(h==null?void 0:h.storageProvider)==="localFile"?await Ja(h.id,N):await qa(N),re=R.profiles.find(je=>{var ke;return je.id===(R.activeProfileId??((ke=R.profile)==null?void 0:ke.id))});D(R),G(R.activeProfileId??((d=R.profile)==null?void 0:d.id)??""),S(!re||re.creators.length===0),U(!1),K(""),n(""),j(o("assets.settings.apiKeySaved","Open Cloud API key saved locally."))}catch(N){j(N instanceof Error?N.message:o("assets.settings.saveFailed","Failed to save upload settings."))}finally{r(!1)}})()},children:o("assets.settings.saveApiKey","Save API Key")})}),t.jsx(H,{text:_,children:t.jsx("button",{type:"button",className:s.commandButton,disabled:b,onClick:()=>{(async()=>{r(!0);try{const d=await oo(E||void 0);j(co(d.validation,o))}catch(d){j(d instanceof Error?d.message:o("assets.settings.testFailed","Connection test failed."))}finally{r(!1)}})()},children:o("assets.settings.testConnection","Test Connection")})}),t.jsx(H,{text:M,children:t.jsx("button",{type:"button",className:`${s.commandButton} ${s.dangerButton}`,disabled:I,onClick:()=>{h&&L({kind:"apiKey",profileId:h.id})},children:o("assets.settings.removeApiKey","Unregister API Key")})})]})]}),t.jsx("div",{className:s.metadataList,children:h==null?void 0:h.creators.map(d=>t.jsxs("div",{className:s.metadataItem,children:[t.jsx("strong",{children:d.label}),t.jsx("span",{children:ho(d,o)}),d.id===h.defaultCreatorId&&t.jsx("code",{children:o("assets.settings.defaultCreatorBadge","Default")}),t.jsxs("span",{children:[o("assets.settings.field.validationStatus","Validation status"),": ",ve(d.validationStatus,o)]}),t.jsxs("div",{className:s.buttonRow,children:[d.id!==h.defaultCreatorId&&h.storageProvider==="localFile"&&t.jsx("button",{type:"button",className:s.commandButton,disabled:g||A,onClick:()=>{(async()=>{if(h){r(!0);try{const N=await to(h.id,d.id);D(N),j(o("assets.settings.defaultCreatorSaved","Open Cloud default Creator saved locally."))}catch(N){j(N instanceof Error?N.message:o("assets.settings.saveFailed","Failed to save upload settings."))}finally{r(!1)}}})()},children:o("assets.settings.makeDefaultCreator","Make default")}),t.jsx(H,{text:st,children:t.jsx("button",{type:"button",className:`${s.commandButton} ${s.dangerButton}`,disabled:tt,onClick:()=>L({kind:"creator",profileId:h.id,creatorPresetId:d.id}),children:o("assets.settings.unregisterCreator","Unregister Creator")})})]})]},d.id))}),oe&&!P&&t.jsx(H,{text:et,children:t.jsx("button",{type:"button",className:s.commandButton,disabled:g||A||B||!x,onClick:()=>{F("user"),k(""),f(""),S(!0)},children:o("assets.settings.addCreator","Add Creator")})}),Y&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:s.twoColumn,children:[t.jsxs("div",{className:s.field,children:[t.jsx("div",{className:s.fieldLabelRow,children:t.jsx("label",{htmlFor:"asset-settings-creator-type",children:o("assets.upload.creatorType","Creator type")})}),t.jsxs("select",{id:"asset-settings-creator-type",value:V,disabled:g||A||B||!x,onChange:d=>F(d.target.value),children:[t.jsx("option",{value:"user",children:o("assets.creator.user","User")}),t.jsx("option",{value:"group",children:o("assets.creator.group","Group")})]})]}),t.jsxs("div",{className:s.field,children:[t.jsxs("div",{className:s.fieldLabelRow,children:[t.jsx("label",{htmlFor:"asset-settings-creator-id",children:o("assets.upload.creatorId","Creator ID")}),t.jsx(Pe,{topicId:"openCloudCreatorId",variant:"field",state:{hasDefaultCreator:!!T}})]}),t.jsx("input",{id:"asset-settings-creator-id",value:X,disabled:g||A||B||!x,onChange:d=>k(d.target.value)}),t.jsx("p",{className:s.inlineHelp,children:o("assets.settings.creatorId.inlineHelp","Default owner for new Roblox assets: your User ID or a Group ID.")})]})]}),t.jsxs("div",{className:s.field,children:[t.jsx("div",{className:s.fieldLabelRow,children:t.jsx("label",{htmlFor:"asset-settings-creator-label",children:o("assets.settings.creatorLabel","Creator label")})}),t.jsx("input",{id:"asset-settings-creator-label",value:q,disabled:g||A||B||!x,onChange:d=>f(d.target.value),placeholder:o("assets.settings.creatorLabel.placeholder","Main studio group")}),t.jsx("p",{className:s.inlineHelp,children:o("assets.settings.creatorLabel.help","Optional. If left blank, WEPPY automatically saves a label like User 123 or Group 456.")})]}),!T&&t.jsx("p",{className:s.inlineHelp,children:o("assets.settings.creatorHelp","Use the numeric user ID from a profile URL or group ID from a group URL.")}),t.jsxs("div",{className:s.buttonRow,children:[t.jsx(H,{text:Qe,children:t.jsx("button",{type:"button",className:s.primaryButton,disabled:ue,onClick:()=>{(async()=>{if(h){r(!0);try{const d=await eo(h.id,{creatorType:V,creatorId:J,makeDefault:!T,...q.trim()?{label:q.trim()}:{}});D(d),k(""),f(""),S(!1),j(o("assets.settings.defaultCreatorSaved","Open Cloud default Creator saved locally."))}catch(d){j(d instanceof Error?d.message:o("assets.settings.saveFailed","Failed to save upload settings."))}finally{r(!1)}}})()},children:at})}),oe&&t.jsx("button",{type:"button",className:s.commandButton,disabled:g||A,onClick:()=>{F("user"),k(""),f(""),S(!1)},children:o("assets.settings.cancelCreator","Cancel")})]})]})]}),z&&t.jsx("div",{className:s.messageState,children:z}),t.jsx(Ge,{open:v!==null,title:lt,message:it,cancelLabel:o("common.cancel","Cancel"),confirmLabel:ct,loading:A,onCancel:()=>L(null),onConfirm:()=>{rt()}})]})}const go=12,xo=5e3;function le(e,a){return e instanceof Error&&e.message.trim().length>0?e.message:a}function Ce(e,a){return e.some(o=>o.id===a.id)?e.map(o=>o.id===a.id?a:o):[a,...e]}function _e(e,a){return Xt(e.filter(u=>Yt(u,a)))}function pe(e,a){return e?`${e.displayName} (${e.id})`:a??"unknown asset"}function bo(e){return e.length===0?"none":e.map(a=>pe(a)).join(", ")}function Fe(e){const a=`status ${e.status}`;return e.roblox.assetId?`Roblox asset ${e.roblox.assetId}; ${a}`:a}function yo(e,a){const u=pe(a);return e==="update"?`Updated metadata for asset: ${u}.`:e==="upload"?`Uploaded asset: ${u} -> ${Fe(a)}.`:e==="thumbnail-generate"?`Generated thumbnail for asset: ${u}.`:e==="status-refresh"?`Refreshed Roblox status for asset: ${u} -> ${Fe(a)}.`:e==="usage-scan"?`Scanned usage for asset: ${u} -> ${a.usage.references.length} reference(s).`:`Updated asset: ${u}.`}function fo(e){return e!=="upload"&&e!=="status-refresh"}function Se(e,a){if((a==null?void 0:a.id)===e)return a.category;const u=/^asset_(image|decal|audio|mesh|model|video|animation)_/.exec(e);return u!=null&&u[1]?u[1]:null}function Me(e){return e.status==="processing"&&!!(e.roblox.operationId??e.roblox.operationPath)}function jo(e){return{scope:e.scope.kind,placeId:e.scope.kind==="place"?e.scope.placeId:void 0,category:e.category}}function vo(e){if(e.pluginConnected&&e.activePlaceId!==null)return{placeId:e.activePlaceId,placeName:e.activePlaceName,studioConnected:!0};if(e.lastActivePlaceId!==null)return{placeId:e.lastActivePlaceId,placeName:e.lastActivePlaceName,studioConnected:!1};const a=e.places[0];return{placeId:(a==null?void 0:a.placeId)??null,placeName:(a==null?void 0:a.placeName)??null,studioConnected:!1}}function Co(){const[e,a]=i.useState([]),[u,o]=i.useState(0),[l,$]=i.useState(null),[C,D]=i.useState("place"),[p,G]=i.useState("all"),[O,U]=i.useState(null),[m,n]=i.useState(null),[W,K]=i.useState(!1),[V,F]=i.useState(!0),[X,k]=i.useState(null),[q,f]=i.useState(null),[P,S]=i.useState(null),z=i.useRef(!0),j=i.useRef(new Map),v=i.useMemo(()=>e.find(c=>c.id===l)??null,[e,l]),L=i.useCallback(c=>{const y=j.current.get(c);y!==void 0&&(clearTimeout(y),j.current.delete(c))},[]),A=i.useCallback((c,y=go)=>{if(!Me(c)||y<=0){L(c.id);return}L(c.id),(async()=>{try{const b=await Re(jo(c),c.id);if(!z.current)return;if(a(_=>Ce(_,b)),Me(b)&&y>1){const _=setTimeout(()=>{j.current.delete(b.id),A(b,y-1)},xo);j.current.set(b.id,_);return}L(b.id)}catch(b){if(!z.current)return;L(c.id),f(le(b,"Asset Library status refresh failed."))}})()},[L]);i.useEffect(()=>()=>{z.current=!1;for(const c of j.current.values())clearTimeout(c);j.current.clear()},[]);const r=i.useCallback(()=>({scope:C,placeId:C==="place"?O:void 0}),[O,C]),g=i.useCallback(c=>({...r(),category:c}),[r]),Z=i.useCallback(async()=>{try{const c=await mt(),y=vo(c);return U(y.placeId),n(y.placeName),K(y.studioConnected),y.placeId}catch{return U(null),n(null),K(!1),null}},[]),ee=i.useCallback(async()=>{f(null);try{const c=await Z(),y={scope:C,placeId:C==="place"?c:void 0};if(C==="place"&&c===null){a([]),o(0),F(!1),f("No active place is connected for place-scoped assets.");return}const b=await Promise.all($e(p).map(I=>Ut({...y,category:I}))),_=_e(b.flatMap(I=>I.assets),p);a(_),o(_.length)}catch(c){f(le(c,"Failed to load Asset Library."))}finally{F(!1)}},[p,Z,C]);i.useEffect(()=>{ee()},[ee]);const E=i.useCallback(async(c,y,b)=>{const _=Se(y,v);if(!_)return f("Asset category is unavailable."),null;k(c),f(null),S(null);try{const I=await b(g(_));return a(M=>Ce(M,I)),$(I.id),fo(c)&&S(yo(c,I)),I}catch(I){return f(le(I,"Asset Library action failed.")),null}finally{k(null)}},[g,v]),J=i.useCallback(async()=>{k("rescan"),f(null),S(null);try{const c=await Promise.all($e(p).map(M=>Tt(g(M)))),y=_e(c.flatMap(M=>M.assets),p),b=c.reduce((M,ue)=>M+ue.adoptedCount,0),_=c.reduce((M,ue)=>M+ue.skippedCount,0),I=_e(c.flatMap(M=>M.adopted),p);a(y),o(y.length),S(`Rescan complete for ${p}: ${b} asset(s) added, ${_} skipped. Added: ${bo(I)}.`)}catch(c){f(le(c,"Asset Library rescan failed."))}finally{k(null)}},[p,g]),ae=i.useCallback(async(c,y)=>{k("export-selection-rbxm"),f(null),S(null);try{const b=await Kt(g(c),y);return a(_=>Ce(_,b.asset)),$(b.asset.id),S(`Exported Studio selection as RBXM asset: ${pe(b.asset)}${b.deduplicated?" (reused existing local asset)":""}.`),b}catch(b){return f(le(b,"Asset Library .rbxm export failed.")),null}finally{k(null)}},[g]),h=i.useCallback((c,y)=>E("update",c,b=>Ot(b,c,y)),[E]),te=i.useCallback(async(c,y)=>{const b=await E("upload",c,_=>Mt(_,c,y));return b&&A(b),b},[E,A]),x=i.useCallback(async c=>{const y=Se(c,v);if(!y)return f("Asset category is unavailable."),!1;L(c);const b=e.find(_=>_.id===c)??v;k("delete"),f(null),S(null);try{return await Ft(g(y),c),a(_=>{const I=_.filter(M=>M.id!==c);return o(I.length),I}),$(_=>_===c?null:_),S(`Deleted asset: ${pe(b,c)}. Local files removed; uploaded Roblox assets were not deleted.`),!0}catch(_){return f(le(_,"Asset Library delete failed.")),!1}finally{k(null)}},[e,L,g,v]),B=i.useCallback(async(c,y)=>{const b=Se(c,v);if(!b)return f("Asset category is unavailable."),null;const _=e.find(I=>I.id===c)??v;k("import-rbxm"),f(null),S(null);try{const I=await Gt(g(b),c,y);return $(c),S(`Imported RBXM asset: ${pe(_,c)} -> ${I.importedCount} instance(s) to ${I.targetParent}.`),I}catch(I){return f(le(I,"Asset Library .rbxm import failed.")),null}finally{k(null)}},[e,g,v]),T=i.useCallback(c=>E("thumbnail-generate",c,y=>Wt(y,c)),[E]),oe=i.useCallback(c=>(L(c),E("status-refresh",c,y=>Re(y,c))),[L,E]),Y=i.useCallback((c,y)=>E("usage-scan",c,async b=>(await Ht(b,c,y)).asset),[E]),de=i.useCallback(c=>{D(c),$(null)},[]),ne=i.useCallback(c=>{Vt(c)&&(G(c),$(null))},[]);return{assets:e,totalCount:u,selectedAsset:v,selectedAssetId:l,scope:C,categoryFilter:p,activePlaceId:O,activePlaceName:m,studioConnected:W,loading:V,busyAction:X,error:q,lastMessage:P,setScope:de,setCategoryFilter:ne,selectAsset:$,refresh:ee,rescan:J,exportSelectionRbxm:ae,updateMetadata:h,uploadAsset:te,deleteAsset:x,importRbxm:B,generateThumbnail:T,refreshStatus:oe,scanUsage:Y}}function _o(e,a){return a("assets.count.shown","Shown assets: {count}").replace("{count}",String(e))}function ko(){const{t:e}=he(),{trackEvent:a}=gt(),{tier:u,loading:o}=xt(),l=Co(),[$,C]=i.useState(!1),[D,p]=i.useState(!1),[G,O]=i.useState(!1),U=!o&&u==="pro",m=l.selectedAsset,n=(m==null?void 0:m.file.original.toLowerCase().endsWith(".rbxm"))??!1,W=(m==null?void 0:m.category)==="model"||(m==null?void 0:m.category)==="animation",K="game.Workspace",F=!!(U&&l.studioConnected&&m&&n&&W),X=i.useMemo(()=>l.scope==="place"?l.activePlaceName??e("assets.scope.place","Current Place"):e("assets.scope.shared","Shared"),[l.activePlaceName,l.scope,e]),k=i.useMemo(()=>Ae(l.categoryFilter,e),[l.categoryFilter,e]),q=_o(l.totalCount,e),f=e("assets.detail.importRbxm.tooltip","Insert this local RBXM asset into {target} in the connected Studio place.").replace("{target}",K);return t.jsxs("div",{className:s.page,children:[t.jsx(bt,{title:e("assets.title","Assets"),description:e("assets.subtitle","Browse local originals, upload to Roblox, and inspect synced usage by place."),badge:t.jsx("span",{className:s.experimentalBadge,children:e("assets.experimental","Experimental")}),helpTopicId:"assets",helpState:{tier:u}}),t.jsxs("div",{className:s.toolbarShell,children:[t.jsxs("div",{className:s.toolbar,children:[t.jsxs("div",{className:s.segmented,role:"group","aria-label":e("assets.scope.label","Asset scope"),children:[t.jsx("button",{type:"button",className:l.scope==="place"?s.segmentedActive:"",onClick:()=>l.setScope("place"),children:e("assets.scope.place","Current Place")}),t.jsx("button",{type:"button",className:l.scope==="shared"?s.segmentedActive:"",onClick:()=>l.setScope("shared"),children:e("assets.scope.shared","Shared")})]}),t.jsxs("div",{className:s.listContextSummary,children:[t.jsx("span",{children:X}),t.jsx("span",{className:s.contextDivider,children:" · "}),t.jsx("span",{children:k}),t.jsx("span",{className:s.contextDivider,children:" · "}),t.jsx("strong",{children:q})]}),t.jsxs("div",{className:s.toolbarActions,children:[t.jsx(H,{text:e("assets.rescan.tooltip","Scan inbox folders for the current filter."),children:t.jsxs("button",{type:"button",className:s.commandButton,disabled:l.busyAction==="rescan",onClick:()=>{a("dashboard_click_event",{click_target:"assets_rescan",page:"assets"}),l.rescan()},children:[t.jsx(He,{size:15}),e("assets.rescan","Rescan")]})}),t.jsx(H,{text:D?"":e("assets.settings.open.tooltip","Open Roblox upload settings."),children:t.jsx("button",{type:"button",className:[s.iconButton,D?s.iconButtonActive:""].filter(Boolean).join(" "),onClick:()=>{a("dashboard_click_event",{click_target:"assets_open_settings",page:"assets"}),p(P=>!P)},"aria-label":e("assets.settings.open","Open settings"),"aria-controls":"asset-library-settings-panel","aria-expanded":D,children:t.jsx(Ke,{size:16})})})]}),t.jsxs("div",{className:s.categoryControl,children:[t.jsx("span",{id:"assets-category-filter-label",className:s.categoryControlLabel,children:e("assets.category.filter","Category")}),t.jsx("div",{className:s.categoryRail,role:"radiogroup","aria-labelledby":"assets-category-filter-label",children:Xe.map(P=>{const S=l.categoryFilter===P,z=Ae(P,e);return t.jsx("button",{type:"button",role:"radio","aria-checked":S,className:[s.categoryButton,S?s.categoryButtonActive:""].filter(Boolean).join(" "),onClick:()=>{l.setCategoryFilter(P)},children:z},P)})})]})]}),t.jsx(mo,{open:D,tier:u,onClose:()=>p(!1)})]}),l.error&&t.jsx("div",{className:s.errorState,children:l.error}),l.lastMessage&&t.jsx("div",{className:s.messageState,children:l.lastMessage}),l.categoryFilter==="rbxm"&&t.jsxs("section",{className:s.rbxmGuide,"aria-label":e("assets.rbxmGuide.title","Save RBXM from Studio"),children:[t.jsx("h2",{children:e("assets.rbxmGuide.title","Save RBXM from Studio")}),t.jsx("p",{children:e("assets.rbxmGuide.body","Select objects in Roblox Studio, then use WEPPY Plugin > Assets to save the selection as a local RBXM asset.")}),t.jsx("p",{children:e("assets.rbxmGuide.thumbnail","The plugin save flow includes a thumbnail option, and saved RBXM assets appear here for management, upload, and insertion.")})]}),!U&&!o&&t.jsx("div",{className:`${s.notice} ${s.proNotice}`,children:e("assets.basic.notice","Browse, preview, edit metadata, and scan usage on Basic. Roblox upload controls are available on Pro.")}),l.loading?t.jsx("div",{className:s.emptyState,children:e("common.loading","Loading...")}):t.jsx(Ea,{assets:l.assets,selectedAssetId:l.selectedAssetId,onSelect:l.selectAsset}),t.jsx(Va,{asset:$||D||G?null:m,busyAction:l.busyAction,canUpload:U,canImportRbxm:F,importRbxmTooltip:f,importRbxmTargetParent:K,onClose:()=>l.selectAsset(null),onSave:async(P,S)=>{m&&await l.updateMetadata(m.id,{displayName:P,description:S})},onUpload:()=>C(!0),onDelete:()=>O(!0),onImportRbxm:async()=>{m&&(a("dashboard_click_event",{click_target:"assets_import_rbxm",page:"assets"}),await l.importRbxm(m.id,{targetParent:K}))},onRefreshStatus:async()=>{m&&await l.refreshStatus(m.id)},onScanUsage:async()=>{m&&(a("dashboard_click_event",{click_target:"assets_usage_scan",page:"assets"}),await l.scanUsage(m.id,l.activePlaceId??void 0))}}),t.jsx(Ge,{open:G&&!!m,title:e("assets.delete.title","Delete asset"),message:e("assets.delete.message","This removes the local Asset Library files only. Uploaded Roblox assets are not deleted."),cancelLabel:e("common.cancel","Cancel"),confirmLabel:e("common.delete","Delete"),loading:l.busyAction==="delete",onCancel:()=>O(!1),onConfirm:()=>{m&&(a("dashboard_click_event",{click_target:"assets_delete",page:"assets"}),l.deleteAsset(m.id).then(P=>{P&&O(!1)}))}}),t.jsx(io,{asset:m,open:$,canUpload:U,busyAction:l.busyAction,onClose:()=>{C(!1),l.selectAsset(null)},onBack:()=>C(!1),onOpenSettings:()=>{C(!1),p(!0)},onUpload:async P=>{if(!m)return;a("dashboard_click_event",{click_target:"assets_upload_submit",page:"assets"}),await l.uploadAsset(m.id,P)&&C(!1)}})]})}export{ko as Component};
@@ -1 +1 @@
1
- import{r,a as R,u as M,b as B,c as V,j as e}from"./index-1ZlHj3-1.js";import{I as G}from"./InfoLabel-CldY9uOT.js";import{G as D}from"./GameChangeDetail-BmXlRT3i.js";import{T as m}from"./TooltipText-DazmfUnr.js";function F(n){const s={scriptsModified:0,scriptsCreated:0,instancesCreated:0,instancesDeleted:0,instancesMoved:0,propertiesChanged:0,lightingChanged:!1,terrainChanged:!1,assetsInserted:0};for(const l of n)switch(l.category){case"script":l.changeType==="create"?s.scriptsCreated++:s.scriptsModified++;break;case"instance":l.changeType==="create"?s.instancesCreated++:l.changeType==="delete"?s.instancesDeleted++:l.changeType==="move"&&s.instancesMoved++;break;case"property":s.propertiesChanged++;break;case"lighting":s.lightingChanged=!0;break;case"terrain":s.terrainChanged=!0;break;case"asset":s.assetsInserted++;break}return s}function P(n){const[s,l]=r.useState(""),[a,d]=r.useState(""),[u,q]=r.useState(),[w,y]=r.useState("completed"),[I,E]=r.useState([]),[L,O]=r.useState([]),[x,f]=r.useState([]),[p,_]=r.useState(),[j,b]=r.useState(),[v,S]=r.useState(),[C,N]=r.useState({scriptsModified:0,scriptsCreated:0,instancesCreated:0,instancesDeleted:0,instancesMoved:0,propertiesChanged:0,lightingChanged:!1,terrainChanged:!1,assetsInserted:0}),[T,g]=r.useState(!0),[k,h]=r.useState(null),i=r.useCallback(async()=>{if(n){g(!0),h(null);try{const[c,o]=await Promise.all([R.get(`/api/dashboard/changelog/${n}`),R.get(`/api/dashboard/changelog/${n}/changes`)]);l(c.entryId),d(c.startTime),q(c.endTime),y(c.status),E(c.entries),O(c.failures),_(c.contextSummary),b(c.replayMetadata),S(c.verificationSummary),f(o.changes),N(F(o.changes))}catch(c){h(c instanceof Error?c.message:"Failed to load changelog detail")}finally{g(!1)}}},[n]);return r.useEffect(()=>{i()},[i]),{entryId:s,startTime:a,endTime:u,status:w,entries:I,failures:L,changes:x,changeSummary:C,contextSummary:p,replayMetadata:j,verificationSummary:v,loading:T,error:k,refresh:i}}const U={script:"📝",instance:"🧱",property:"🎨",lighting:"🌅",terrain:"⛰️",asset:"📦"};function H(n){return U[n]??"❓"}const W="_page_q2jbi_2",Y="_header_q2jbi_10",z="_backLink_q2jbi_16",J="_headerTitle_q2jbi_29",Q="_headerTime_q2jbi_37",X="_statusActive_q2jbi_44",Z="_statusCompleted_q2jbi_49",ee="_section_q2jbi_54",te="_sectionTitle_q2jbi_61",ne="_summaryGrid_q2jbi_74",ae="_summaryCard_q2jbi_80",ie="_summaryCardActive_q2jbi_94",se="_summaryIcon_q2jbi_99",ce="_summaryCount_q2jbi_105",re="_summaryLabel_q2jbi_112",oe="_contextGrid_q2jbi_121",le="_contextRow_q2jbi_127",de="_contextKey_q2jbi_133",me="_contextValue_q2jbi_141",ge="_timelineFilter_q2jbi_149",he="_filterLabel_q2jbi_156",ue="_filterSelect_q2jbi_162",ye="_timeline_q2jbi_149",xe="_timelineEntry_q2jbi_182",fe="_timelineTime_q2jbi_199",pe="_timelineIcon_q2jbi_207",_e="_timelineBody_q2jbi_212",je="_timelineSummary_q2jbi_217",be="_timelineTarget_q2jbi_224",ve="_timelineConfidence_q2jbi_231",Se="_confidenceExact_q2jbi_240",Ce="_confidencePartial_q2jbi_245",Ne="_confidenceAfterOnly_q2jbi_250",Te="_confidenceIntentOnly_q2jbi_255",ke="_confidenceUnknown_q2jbi_260",qe="_timelineExpanded_q2jbi_266",we="_empty_q2jbi_338",Ie="_loading_q2jbi_347",Ee="_error_q2jbi_356",t={page:W,header:Y,backLink:z,headerTitle:J,headerTime:Q,statusActive:X,statusCompleted:Z,section:ee,sectionTitle:te,summaryGrid:ne,summaryCard:ae,summaryCardActive:ie,summaryIcon:se,summaryCount:ce,summaryLabel:re,contextGrid:oe,contextRow:le,contextKey:de,contextValue:me,timelineFilter:ge,filterLabel:he,filterSelect:ue,timeline:ye,timelineEntry:xe,timelineTime:fe,timelineIcon:pe,timelineBody:_e,timelineSummary:je,timelineTarget:be,timelineConfidence:ve,confidenceExact:Se,confidencePartial:Ce,confidenceAfterOnly:Ne,confidenceIntentOnly:Te,confidenceUnknown:ke,timelineExpanded:qe,empty:we,loading:Ie,error:Ee},$=[{key:"script",icon:"📝",labelKey:"changelog.category.script"},{key:"instance",icon:"🧱",labelKey:"changelog.category.instance"},{key:"property",icon:"🎨",labelKey:"changelog.category.property"},{key:"lighting",icon:"🌅",labelKey:"changelog.category.lighting"},{key:"terrain",icon:"⛰️",labelKey:"changelog.category.terrain"},{key:"asset",icon:"📦",labelKey:"changelog.category.asset"}];function A(n){if(!n)return"--:--";const s=new Date(n);return`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`}function Le(n){if(!n)return"--:--:--";const s=new Date(n);return`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}`}function Oe(n,s){if(!n||!s)return"";const l=new Date(s).getTime()-new Date(n).getTime();return l<0?"":`${Math.round(l/6e4)}min`}function Ae(n){switch(n){case"exact":return t.confidenceExact;case"partial":return t.confidencePartial;case"after-only":return t.confidenceAfterOnly;case"intent-only":return t.confidenceIntentOnly;default:return t.confidenceUnknown}}function Ke(n,s){switch(s){case"exact":return n("changelog.detail.confidence.exact","Exact");case"partial":return n("changelog.detail.confidence.partial","Partial");case"after-only":return n("changelog.detail.confidence.afterOnly","After only");case"intent-only":return n("changelog.detail.confidence.intentOnly","Intent only");default:return n("changelog.detail.confidence.unknown","Unknown")}}function Re(n,s){switch(s){case"exact":return n("changelog.detail.confidence.exact.tooltip","Both the before and after state were confirmed for this change.");case"partial":return n("changelog.detail.confidence.partial.tooltip","Only part of the before and after state could be confirmed for this change.");case"after-only":return n("changelog.detail.confidence.afterOnly.tooltip","Only the resulting state after the change could be confirmed.");case"intent-only":return n("changelog.detail.confidence.intentOnly.tooltip","Only the requested action was recorded, not the resulting state.");default:return n("changelog.detail.confidence.unknown.tooltip","This change could not be confidently classified from the available data.")}}function Ge(){var x,f,p,_,j,b,v,S,C,N,T,g,k,h;const{t:n}=M(),{id:s}=B(),l=V(),a=P(s),[d,u]=r.useState("all"),[q,w]=r.useState(null),y=r.useMemo(()=>[...d==="all"?a.changes:a.changes.filter(c=>c.category===d)].reverse(),[a.changes,d]);if(a.loading)return e.jsx("div",{className:t.loading,children:n("common.loading","Loading...")});if(a.error)return e.jsxs("div",{className:t.error,children:[a.error,e.jsx("br",{}),e.jsxs("span",{className:t.backLink,onClick:()=>l("/changelog"),children:["←"," ",n("changelog.detail.backToList","Back to list")]})]});const I=Oe(a.startTime,a.endTime),E=a.endTime?`${A(a.startTime)} → ${A(a.endTime)} (${I})`:`${A(a.startTime)} → ${n("changelog.card.inProgress","in progress")}`,L=!!((x=a.contextSummary)!=null&&x.intent||(f=a.contextSummary)!=null&&f.testScenario||(p=a.contextSummary)!=null&&p.expectedBehavior||(_=a.contextSummary)!=null&&_.observedBehavior),O=!!((j=a.verificationSummary)!=null&&j.label||(b=a.verificationSummary)!=null&&b.status||(v=a.verificationSummary)!=null&&v.testTimestamp);return e.jsxs("div",{className:t.page,children:[e.jsxs("div",{className:t.header,children:[e.jsxs("span",{className:t.backLink,onClick:()=>l("/changelog"),children:["←"," ",n("sidebar.changelog","Changelog")]}),e.jsx("span",{className:t.headerTitle,children:"|"}),e.jsx("span",{className:t.headerTime,children:E}),e.jsx(m,{text:a.status==="active"?n("changelog.card.active.tooltip","This session is still receiving new game changes."):n("changelog.card.completed.tooltip","This session has ended and no more changes are expected."),children:e.jsx("span",{className:a.status==="active"?t.statusActive:t.statusCompleted,children:a.status==="active"?n("changelog.card.active","Active"):n("changelog.card.completed","Completed")})})]}),e.jsxs("div",{className:t.section,children:[e.jsx("div",{className:t.sectionTitle,children:e.jsx(m,{text:n("changelog.detail.changeSummary.tooltip","Counts of extracted game changes grouped by category for this session."),children:e.jsx("span",{children:n("changelog.detail.changeSummary","Change Summary")})})}),e.jsx("div",{className:t.summaryGrid,children:$.map(i=>{const c=a.changeSummary;let o;switch(i.key){case"script":o=c.scriptsModified+c.scriptsCreated;break;case"instance":o=c.instancesCreated+c.instancesDeleted+c.instancesMoved;break;case"property":o=c.propertiesChanged;break;case"lighting":o=c.lightingChanged?1:0;break;case"terrain":o=c.terrainChanged?1:0;break;case"asset":o=c.assetsInserted;break;default:o=0}const K=d===i.key;return e.jsxs("div",{className:`${t.summaryCard} ${K?t.summaryCardActive:""}`,onClick:()=>u(K?"all":i.key),children:[e.jsx("span",{className:t.summaryIcon,children:i.icon}),e.jsx("div",{className:t.summaryCount,children:o}),e.jsx("div",{className:t.summaryLabel,children:n(i.labelKey,i.key)})]},i.key)})})]}),L&&e.jsxs("div",{className:t.section,children:[e.jsx("div",{className:t.sectionTitle,children:e.jsx(m,{text:n("changelog.detail.context.tooltip","Structured execution context captured for this changelog session."),children:e.jsx("span",{children:n("changelog.detail.context.title","Context Summary")})})}),e.jsxs("div",{className:t.contextGrid,children:[((S=a.contextSummary)==null?void 0:S.intent)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("changelog.card.sessionIntent","Session intent")}),e.jsx("span",{className:t.contextValue,children:a.contextSummary.intent})]}),((C=a.contextSummary)==null?void 0:C.testScenario)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("playtest.context.why","Why this test ran")}),e.jsx("span",{className:t.contextValue,children:a.contextSummary.testScenario})]}),((N=a.contextSummary)==null?void 0:N.expectedBehavior)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("playtest.context.expected","Expected")}),e.jsx("span",{className:t.contextValue,children:a.contextSummary.expectedBehavior})]}),((T=a.contextSummary)==null?void 0:T.observedBehavior)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("playtest.context.observed","Observed")}),e.jsx("span",{className:t.contextValue,children:a.contextSummary.observedBehavior})]})]})]}),O&&e.jsxs("div",{className:t.section,children:[e.jsx("div",{className:t.sectionTitle,children:e.jsx(m,{text:n("changelog.detail.verification.tooltip","Verification signals linked to this changelog session."),children:e.jsx("span",{children:n("changelog.detail.verification.title","Verification")})})}),e.jsxs("div",{className:t.contextGrid,children:[((g=a.verificationSummary)==null?void 0:g.label)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("changelog.detail.verification.label","Result")}),e.jsx("span",{className:t.contextValue,children:a.verificationSummary.label})]}),((k=a.verificationSummary)==null?void 0:k.status)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("changelog.detail.verification.status","Status")}),e.jsx("span",{className:t.contextValue,children:a.verificationSummary.status})]}),((h=a.verificationSummary)==null?void 0:h.testTimestamp)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("changelog.detail.verification.timestamp","Recorded at")}),e.jsx("span",{className:t.contextValue,children:a.verificationSummary.testTimestamp})]})]})]}),e.jsxs("div",{className:t.section,children:[e.jsx("div",{className:t.sectionTitle,children:e.jsx(m,{text:n("changelog.detail.changeTimeline.tooltip","Chronological list of extracted game changes for this session."),children:e.jsx("span",{children:n("changelog.detail.changeTimeline","Change Timeline")})})}),e.jsxs("div",{className:t.timelineFilter,children:[e.jsx("span",{className:t.filterLabel,children:e.jsx(G,{label:`${n("changelog.detail.filterCategory","Category")}:`,tooltip:n("changelog.detail.filterCategory.tooltip","Filter the timeline to a single change category.")})}),e.jsxs("select",{className:t.filterSelect,value:d,onChange:i=>u(i.target.value),children:[e.jsx("option",{value:"all",children:n("tools.filter.all","All")}),$.map(i=>e.jsxs("option",{value:i.key,children:[i.icon," ",n(i.labelKey,i.key)]},i.key))]})]}),y.length===0?e.jsx("div",{className:t.empty,children:n("changelog.detail.noChanges","No changes in this category")}):e.jsx("div",{className:t.timeline,children:y.map((i,c)=>{const o=q===c;return e.jsxs("div",{children:[e.jsxs("div",{className:t.timelineEntry,onClick:()=>w(o?null:c),children:[e.jsx("span",{className:t.timelineTime,children:Le(i.timestamp)}),e.jsx("span",{className:t.timelineIcon,children:H(i.category)}),e.jsxs("div",{className:t.timelineBody,children:[e.jsxs("div",{className:t.timelineSummary,children:[i.summary,e.jsx(m,{text:Re(n,i.confidence),children:e.jsx("span",{className:`${t.timelineConfidence} ${Ae(i.confidence)}`,children:Ke(n,i.confidence)})})]}),e.jsx("div",{className:t.timelineTarget,children:i.target})]})]}),o&&e.jsx("div",{className:t.timelineExpanded,children:e.jsx(D,{change:i})})]},c)})})]})]})}export{Ge as Component};
1
+ import{r,a as R,u as M,b as B,c as V,j as e}from"./index-DG2RrKOl.js";import{I as G}from"./InfoLabel-Cyz7d4Kc.js";import{G as D}from"./GameChangeDetail-CghOvUm8.js";import{T as m}from"./TooltipText-H3YSCbob.js";function F(n){const s={scriptsModified:0,scriptsCreated:0,instancesCreated:0,instancesDeleted:0,instancesMoved:0,propertiesChanged:0,lightingChanged:!1,terrainChanged:!1,assetsInserted:0};for(const l of n)switch(l.category){case"script":l.changeType==="create"?s.scriptsCreated++:s.scriptsModified++;break;case"instance":l.changeType==="create"?s.instancesCreated++:l.changeType==="delete"?s.instancesDeleted++:l.changeType==="move"&&s.instancesMoved++;break;case"property":s.propertiesChanged++;break;case"lighting":s.lightingChanged=!0;break;case"terrain":s.terrainChanged=!0;break;case"asset":s.assetsInserted++;break}return s}function P(n){const[s,l]=r.useState(""),[a,d]=r.useState(""),[u,q]=r.useState(),[w,y]=r.useState("completed"),[I,E]=r.useState([]),[L,O]=r.useState([]),[x,f]=r.useState([]),[p,_]=r.useState(),[j,b]=r.useState(),[v,S]=r.useState(),[C,N]=r.useState({scriptsModified:0,scriptsCreated:0,instancesCreated:0,instancesDeleted:0,instancesMoved:0,propertiesChanged:0,lightingChanged:!1,terrainChanged:!1,assetsInserted:0}),[T,g]=r.useState(!0),[k,h]=r.useState(null),i=r.useCallback(async()=>{if(n){g(!0),h(null);try{const[c,o]=await Promise.all([R.get(`/api/dashboard/changelog/${n}`),R.get(`/api/dashboard/changelog/${n}/changes`)]);l(c.entryId),d(c.startTime),q(c.endTime),y(c.status),E(c.entries),O(c.failures),_(c.contextSummary),b(c.replayMetadata),S(c.verificationSummary),f(o.changes),N(F(o.changes))}catch(c){h(c instanceof Error?c.message:"Failed to load changelog detail")}finally{g(!1)}}},[n]);return r.useEffect(()=>{i()},[i]),{entryId:s,startTime:a,endTime:u,status:w,entries:I,failures:L,changes:x,changeSummary:C,contextSummary:p,replayMetadata:j,verificationSummary:v,loading:T,error:k,refresh:i}}const U={script:"📝",instance:"🧱",property:"🎨",lighting:"🌅",terrain:"⛰️",asset:"📦"};function H(n){return U[n]??"❓"}const W="_page_q2jbi_2",Y="_header_q2jbi_10",z="_backLink_q2jbi_16",J="_headerTitle_q2jbi_29",Q="_headerTime_q2jbi_37",X="_statusActive_q2jbi_44",Z="_statusCompleted_q2jbi_49",ee="_section_q2jbi_54",te="_sectionTitle_q2jbi_61",ne="_summaryGrid_q2jbi_74",ae="_summaryCard_q2jbi_80",ie="_summaryCardActive_q2jbi_94",se="_summaryIcon_q2jbi_99",ce="_summaryCount_q2jbi_105",re="_summaryLabel_q2jbi_112",oe="_contextGrid_q2jbi_121",le="_contextRow_q2jbi_127",de="_contextKey_q2jbi_133",me="_contextValue_q2jbi_141",ge="_timelineFilter_q2jbi_149",he="_filterLabel_q2jbi_156",ue="_filterSelect_q2jbi_162",ye="_timeline_q2jbi_149",xe="_timelineEntry_q2jbi_182",fe="_timelineTime_q2jbi_199",pe="_timelineIcon_q2jbi_207",_e="_timelineBody_q2jbi_212",je="_timelineSummary_q2jbi_217",be="_timelineTarget_q2jbi_224",ve="_timelineConfidence_q2jbi_231",Se="_confidenceExact_q2jbi_240",Ce="_confidencePartial_q2jbi_245",Ne="_confidenceAfterOnly_q2jbi_250",Te="_confidenceIntentOnly_q2jbi_255",ke="_confidenceUnknown_q2jbi_260",qe="_timelineExpanded_q2jbi_266",we="_empty_q2jbi_338",Ie="_loading_q2jbi_347",Ee="_error_q2jbi_356",t={page:W,header:Y,backLink:z,headerTitle:J,headerTime:Q,statusActive:X,statusCompleted:Z,section:ee,sectionTitle:te,summaryGrid:ne,summaryCard:ae,summaryCardActive:ie,summaryIcon:se,summaryCount:ce,summaryLabel:re,contextGrid:oe,contextRow:le,contextKey:de,contextValue:me,timelineFilter:ge,filterLabel:he,filterSelect:ue,timeline:ye,timelineEntry:xe,timelineTime:fe,timelineIcon:pe,timelineBody:_e,timelineSummary:je,timelineTarget:be,timelineConfidence:ve,confidenceExact:Se,confidencePartial:Ce,confidenceAfterOnly:Ne,confidenceIntentOnly:Te,confidenceUnknown:ke,timelineExpanded:qe,empty:we,loading:Ie,error:Ee},$=[{key:"script",icon:"📝",labelKey:"changelog.category.script"},{key:"instance",icon:"🧱",labelKey:"changelog.category.instance"},{key:"property",icon:"🎨",labelKey:"changelog.category.property"},{key:"lighting",icon:"🌅",labelKey:"changelog.category.lighting"},{key:"terrain",icon:"⛰️",labelKey:"changelog.category.terrain"},{key:"asset",icon:"📦",labelKey:"changelog.category.asset"}];function A(n){if(!n)return"--:--";const s=new Date(n);return`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`}function Le(n){if(!n)return"--:--:--";const s=new Date(n);return`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}`}function Oe(n,s){if(!n||!s)return"";const l=new Date(s).getTime()-new Date(n).getTime();return l<0?"":`${Math.round(l/6e4)}min`}function Ae(n){switch(n){case"exact":return t.confidenceExact;case"partial":return t.confidencePartial;case"after-only":return t.confidenceAfterOnly;case"intent-only":return t.confidenceIntentOnly;default:return t.confidenceUnknown}}function Ke(n,s){switch(s){case"exact":return n("changelog.detail.confidence.exact","Exact");case"partial":return n("changelog.detail.confidence.partial","Partial");case"after-only":return n("changelog.detail.confidence.afterOnly","After only");case"intent-only":return n("changelog.detail.confidence.intentOnly","Intent only");default:return n("changelog.detail.confidence.unknown","Unknown")}}function Re(n,s){switch(s){case"exact":return n("changelog.detail.confidence.exact.tooltip","Both the before and after state were confirmed for this change.");case"partial":return n("changelog.detail.confidence.partial.tooltip","Only part of the before and after state could be confirmed for this change.");case"after-only":return n("changelog.detail.confidence.afterOnly.tooltip","Only the resulting state after the change could be confirmed.");case"intent-only":return n("changelog.detail.confidence.intentOnly.tooltip","Only the requested action was recorded, not the resulting state.");default:return n("changelog.detail.confidence.unknown.tooltip","This change could not be confidently classified from the available data.")}}function Ge(){var x,f,p,_,j,b,v,S,C,N,T,g,k,h;const{t:n}=M(),{id:s}=B(),l=V(),a=P(s),[d,u]=r.useState("all"),[q,w]=r.useState(null),y=r.useMemo(()=>[...d==="all"?a.changes:a.changes.filter(c=>c.category===d)].reverse(),[a.changes,d]);if(a.loading)return e.jsx("div",{className:t.loading,children:n("common.loading","Loading...")});if(a.error)return e.jsxs("div",{className:t.error,children:[a.error,e.jsx("br",{}),e.jsxs("span",{className:t.backLink,onClick:()=>l("/changelog"),children:["←"," ",n("changelog.detail.backToList","Back to list")]})]});const I=Oe(a.startTime,a.endTime),E=a.endTime?`${A(a.startTime)} → ${A(a.endTime)} (${I})`:`${A(a.startTime)} → ${n("changelog.card.inProgress","in progress")}`,L=!!((x=a.contextSummary)!=null&&x.intent||(f=a.contextSummary)!=null&&f.testScenario||(p=a.contextSummary)!=null&&p.expectedBehavior||(_=a.contextSummary)!=null&&_.observedBehavior),O=!!((j=a.verificationSummary)!=null&&j.label||(b=a.verificationSummary)!=null&&b.status||(v=a.verificationSummary)!=null&&v.testTimestamp);return e.jsxs("div",{className:t.page,children:[e.jsxs("div",{className:t.header,children:[e.jsxs("span",{className:t.backLink,onClick:()=>l("/changelog"),children:["←"," ",n("sidebar.changelog","Changelog")]}),e.jsx("span",{className:t.headerTitle,children:"|"}),e.jsx("span",{className:t.headerTime,children:E}),e.jsx(m,{text:a.status==="active"?n("changelog.card.active.tooltip","This session is still receiving new game changes."):n("changelog.card.completed.tooltip","This session has ended and no more changes are expected."),children:e.jsx("span",{className:a.status==="active"?t.statusActive:t.statusCompleted,children:a.status==="active"?n("changelog.card.active","Active"):n("changelog.card.completed","Completed")})})]}),e.jsxs("div",{className:t.section,children:[e.jsx("div",{className:t.sectionTitle,children:e.jsx(m,{text:n("changelog.detail.changeSummary.tooltip","Counts of extracted game changes grouped by category for this session."),children:e.jsx("span",{children:n("changelog.detail.changeSummary","Change Summary")})})}),e.jsx("div",{className:t.summaryGrid,children:$.map(i=>{const c=a.changeSummary;let o;switch(i.key){case"script":o=c.scriptsModified+c.scriptsCreated;break;case"instance":o=c.instancesCreated+c.instancesDeleted+c.instancesMoved;break;case"property":o=c.propertiesChanged;break;case"lighting":o=c.lightingChanged?1:0;break;case"terrain":o=c.terrainChanged?1:0;break;case"asset":o=c.assetsInserted;break;default:o=0}const K=d===i.key;return e.jsxs("div",{className:`${t.summaryCard} ${K?t.summaryCardActive:""}`,onClick:()=>u(K?"all":i.key),children:[e.jsx("span",{className:t.summaryIcon,children:i.icon}),e.jsx("div",{className:t.summaryCount,children:o}),e.jsx("div",{className:t.summaryLabel,children:n(i.labelKey,i.key)})]},i.key)})})]}),L&&e.jsxs("div",{className:t.section,children:[e.jsx("div",{className:t.sectionTitle,children:e.jsx(m,{text:n("changelog.detail.context.tooltip","Structured execution context captured for this changelog session."),children:e.jsx("span",{children:n("changelog.detail.context.title","Context Summary")})})}),e.jsxs("div",{className:t.contextGrid,children:[((S=a.contextSummary)==null?void 0:S.intent)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("changelog.card.sessionIntent","Session intent")}),e.jsx("span",{className:t.contextValue,children:a.contextSummary.intent})]}),((C=a.contextSummary)==null?void 0:C.testScenario)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("playtest.context.why","Why this test ran")}),e.jsx("span",{className:t.contextValue,children:a.contextSummary.testScenario})]}),((N=a.contextSummary)==null?void 0:N.expectedBehavior)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("playtest.context.expected","Expected")}),e.jsx("span",{className:t.contextValue,children:a.contextSummary.expectedBehavior})]}),((T=a.contextSummary)==null?void 0:T.observedBehavior)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("playtest.context.observed","Observed")}),e.jsx("span",{className:t.contextValue,children:a.contextSummary.observedBehavior})]})]})]}),O&&e.jsxs("div",{className:t.section,children:[e.jsx("div",{className:t.sectionTitle,children:e.jsx(m,{text:n("changelog.detail.verification.tooltip","Verification signals linked to this changelog session."),children:e.jsx("span",{children:n("changelog.detail.verification.title","Verification")})})}),e.jsxs("div",{className:t.contextGrid,children:[((g=a.verificationSummary)==null?void 0:g.label)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("changelog.detail.verification.label","Result")}),e.jsx("span",{className:t.contextValue,children:a.verificationSummary.label})]}),((k=a.verificationSummary)==null?void 0:k.status)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("changelog.detail.verification.status","Status")}),e.jsx("span",{className:t.contextValue,children:a.verificationSummary.status})]}),((h=a.verificationSummary)==null?void 0:h.testTimestamp)&&e.jsxs("div",{className:t.contextRow,children:[e.jsx("span",{className:t.contextKey,children:n("changelog.detail.verification.timestamp","Recorded at")}),e.jsx("span",{className:t.contextValue,children:a.verificationSummary.testTimestamp})]})]})]}),e.jsxs("div",{className:t.section,children:[e.jsx("div",{className:t.sectionTitle,children:e.jsx(m,{text:n("changelog.detail.changeTimeline.tooltip","Chronological list of extracted game changes for this session."),children:e.jsx("span",{children:n("changelog.detail.changeTimeline","Change Timeline")})})}),e.jsxs("div",{className:t.timelineFilter,children:[e.jsx("span",{className:t.filterLabel,children:e.jsx(G,{label:`${n("changelog.detail.filterCategory","Category")}:`,tooltip:n("changelog.detail.filterCategory.tooltip","Filter the timeline to a single change category.")})}),e.jsxs("select",{className:t.filterSelect,value:d,onChange:i=>u(i.target.value),children:[e.jsx("option",{value:"all",children:n("tools.filter.all","All")}),$.map(i=>e.jsxs("option",{value:i.key,children:[i.icon," ",n(i.labelKey,i.key)]},i.key))]})]}),y.length===0?e.jsx("div",{className:t.empty,children:n("changelog.detail.noChanges","No changes in this category")}):e.jsx("div",{className:t.timeline,children:y.map((i,c)=>{const o=q===c;return e.jsxs("div",{children:[e.jsxs("div",{className:t.timelineEntry,onClick:()=>w(o?null:c),children:[e.jsx("span",{className:t.timelineTime,children:Le(i.timestamp)}),e.jsx("span",{className:t.timelineIcon,children:H(i.category)}),e.jsxs("div",{className:t.timelineBody,children:[e.jsxs("div",{className:t.timelineSummary,children:[i.summary,e.jsx(m,{text:Re(n,i.confidence),children:e.jsx("span",{className:`${t.timelineConfidence} ${Ae(i.confidence)}`,children:Ke(n,i.confidence)})})]}),e.jsx("div",{className:t.timelineTarget,children:i.target})]})]}),o&&e.jsx("div",{className:t.timelineExpanded,children:e.jsx(D,{change:i})})]},c)})})]})]})}export{Ge as Component};
@@ -1 +1 @@
1
- import{r,a as M,D as P,u as D,j as e,i as V,c as O,m as K,n as G,T as H}from"./index-1ZlHj3-1.js";import{P as U}from"./PageHeader-ueZvp6K9.js";import{C as Z}from"./ConfirmModal-DSKr5eS9.js";import{T as $}from"./TooltipText-DazmfUnr.js";import{T as q}from"./Tabs-BgJY0tsU.js";const z=10;function J(){const[s,d]=r.useState([]),[t,n]=r.useState(0),[a,m]=r.useState(!1),[g,f]=r.useState(!0),[i,v]=r.useState(0),[h,x]=r.useState("all"),N=r.useRef(null),_=r.useCallback(async(p,y)=>{f(!0);try{const j={limit:String(z),offset:String(p)};y!=="all"&&(j.status=y);const b=await M.get("/api/dashboard/changelog",j);d(b.entries),n(b.total),m(b.hasMore)}catch{d([]),n(0),m(!1)}finally{f(!1)}},[]),C=r.useCallback(()=>{_(i,h)},[_,i,h]),c=r.useCallback(async()=>{await M.post("/api/dashboard/changelog/clear"),d([]),n(0),m(!1)},[]);return r.useEffect(()=>{_(i,h)},[_,i,h]),r.useEffect(()=>{const p=new P;N.current=p,p.connect();const y=p.on("command",()=>{_(i,h)});return()=>{y(),p.disconnect(),N.current=null}},[_,i,h]),{entries:s,total:t,hasMore:a,loading:g,offset:i,statusFilter:h,setOffset:v,setStatusFilter:x,refresh:C,clear:c}}const Q="_card_1n89u_2",W="_header_1n89u_17",X="_statusBadge_1n89u_24",Y="_statusDot_1n89u_35",ee="_active_1n89u_41",te="_completed_1n89u_50",se="_timeRange_1n89u_58",ae="_summaryList_1n89u_65",ne="_summaryItem_1n89u_71",oe="_summaryIcon_1n89u_80",ce="_summaryText_1n89u_86",ie="_progressBar_1n89u_91",le="_progressFill_1n89u_99",re="_emptySummary_1n89u_112",ge="_contextBlock_1n89u_120",de="_contextLabel_1n89u_129",me="_contextValue_1n89u_137",o={card:Q,header:W,statusBadge:X,statusDot:Y,active:ee,completed:te,timeRange:se,summaryList:ae,summaryItem:ne,summaryIcon:oe,summaryText:ce,progressBar:ie,progressFill:le,emptySummary:re,contextBlock:ge,contextLabel:de,contextValue:me};function R(s){if(!s)return"--:--";const d=new Date(s);return`${String(d.getHours()).padStart(2,"0")}:${String(d.getMinutes()).padStart(2,"0")}`}function he({entry:s,onClick:d}){var j,b,I,k,B,L,A,w,E,F;const{t}=D(),n=s.changeSummary,a=s.status==="active",m=s.isBootstrapOnly===!0,g=[],f=n.scriptsModified+n.scriptsCreated;if(f>0){const u=[];n.scriptsModified>0&&u.push(`${n.scriptsModified} ${t("changelog.card.modified","modified")}`),n.scriptsCreated>0&&u.push(`${n.scriptsCreated} ${t("changelog.card.created","created")}`);const S=`${f} ${t("changelog.card.scripts","scripts")} ${u.join(", ")}`;g.push({icon:"📝",text:S,tooltip:t("changelog.card.scripts.tooltip","Script changes made in this session.")})}const i=n.instancesCreated+n.instancesDeleted+n.instancesMoved;if(i>0){const u=[];n.instancesCreated>0&&u.push(`${n.instancesCreated} ${t("changelog.card.created","created")}`),n.instancesDeleted>0&&u.push(`${n.instancesDeleted} ${t("changelog.card.deleted","deleted")}`),n.instancesMoved>0&&u.push(`${n.instancesMoved} ${t("changelog.card.moved","moved")}`);const S=`${i} ${t("changelog.card.instances","instances")} ${u.join(", ")}`;g.push({icon:"🧱",text:S,tooltip:t("changelog.card.instances.tooltip","Instance create, delete, move, or clone changes in this session.")})}n.propertiesChanged>0&&g.push({icon:"🎨",text:`${n.propertiesChanged} ${t("changelog.card.propertiesChanged","properties changed")}`,tooltip:t("changelog.card.propertiesChanged.tooltip","Property value changes recorded for this session.")}),n.lightingChanged&&g.push({icon:"🌅",text:t("changelog.card.lightingConfigured","Lighting configured"),tooltip:t("changelog.card.lightingConfigured.tooltip","Lighting or atmosphere settings changed in this session.")}),n.terrainChanged&&g.push({icon:"⛰️",text:t("changelog.card.terrainConfigured","Terrain configured"),tooltip:t("changelog.card.terrainConfigured.tooltip","Terrain data or terrain settings changed in this session.")}),n.assetsInserted>0&&g.push({icon:"📦",text:`${n.assetsInserted} ${t("changelog.card.assetsInserted","assets inserted")}`,tooltip:t("changelog.card.assetsInserted.tooltip","Assets inserted into the place during this session.")});const v=R(s.startTime),h=a?t("changelog.card.inProgress","in progress"):s.endTime?R(s.endTime):"--:--",x=m?t("changelog.card.bootstrapStatus","Bootstrap"):a?t("changelog.card.active","Active"):t("changelog.card.completed","Completed"),N=m?t("changelog.card.bootstrapStatus.tooltip","This session only contains the initial sync bootstrap snapshot."):a?t("changelog.card.active.tooltip","This session is still receiving new game changes."):t("changelog.card.completed.tooltip","This session has ended and no more changes are expected."),_=m?t("changelog.card.bootstrapSummary","Initial sync snapshot"):t("changelog.card.noChanges","No changes yet"),C=m?t("changelog.card.bootstrapSummary.tooltip","Initial file sync writes are collapsed into a single bootstrap snapshot row."):t("changelog.card.noChanges.tooltip","No game changes have been extracted for this session yet."),c=(b=(j=s.contextSummary)==null?void 0:j.intent)==null?void 0:b.trim(),p=((L=(B=(k=(I=s.contextSummary)==null?void 0:I.affectedAreas)==null?void 0:k[0])==null?void 0:B.label)==null?void 0:L.trim())||((w=(A=s.contextSummary)==null?void 0:A.testScenario)==null?void 0:w.trim()),y=(F=(E=s.verificationSummary)==null?void 0:E.label)==null?void 0:F.trim();return e.jsxs("div",{className:o.card,onClick:d,children:[e.jsxs("div",{className:o.header,children:[e.jsx($,{text:N,children:e.jsxs("span",{className:`${o.statusBadge} ${a?o.active:o.completed}`,children:[e.jsx("span",{className:o.statusDot}),x]})}),e.jsxs("span",{className:o.timeRange,children:[v,"~",h]})]}),e.jsx("div",{className:o.summaryList,children:g.length>0?g.map((u,S)=>e.jsxs("div",{className:o.summaryItem,children:[e.jsx("span",{className:o.summaryIcon,children:u.icon}),e.jsx($,{text:u.tooltip,children:e.jsx("span",{className:o.summaryText,children:u.text})})]},S)):e.jsx($,{text:C,children:e.jsx("span",{className:o.emptySummary,style:{display:"block"},children:_})})}),c&&e.jsxs("div",{className:o.contextBlock,children:[e.jsx("span",{className:o.contextLabel,children:t("changelog.card.sessionIntent","Session intent")}),e.jsx("span",{className:o.contextValue,children:c})]}),!c&&p&&e.jsxs("div",{className:o.contextBlock,children:[e.jsx("span",{className:o.contextLabel,children:t("changelog.card.representativeArea","Representative area")}),e.jsx("span",{className:o.contextValue,children:p})]}),y&&e.jsxs("div",{className:o.contextBlock,children:[e.jsx("span",{className:o.contextLabel,children:t("changelog.card.verification","Verification")}),e.jsx("span",{className:o.contextValue,children:y})]}),a&&e.jsx("div",{className:o.progressBar,children:e.jsx("div",{className:o.progressFill})})]})}const pe="_page_1tggr_2",ue="_limitNotice_1tggr_9",_e="_limitNoticeContent_1tggr_23",fe="_limitNoticeTitle_1tggr_28",xe="_limitNoticeText_1tggr_35",ye="_primaryAction_1tggr_41",ve="_clearButton_1tggr_67",Ne="_list_1tggr_88",be="_empty_1tggr_95",Ce="_loading_1tggr_104",je="_pagination_1tggr_113",Se="_pageInfo_1tggr_121",Te="_btn_1tggr_127",l={page:pe,limitNotice:ue,limitNoticeContent:_e,limitNoticeTitle:fe,limitNoticeText:xe,primaryAction:ye,clearButton:ve,list:Ne,empty:be,loading:Ce,pagination:je,pageInfo:Se,btn:Te},T=10,$e=[{key:"all",labelKey:"changelog.filter.all"},{key:"active",labelKey:"changelog.filter.active"},{key:"completed",labelKey:"changelog.filter.completed"}];function we(){const{t:s}=D(),{trackEvent:d,trackPageView:t}=V(),n=O(),a=J(),m=K(),{show:g}=G(),[f,i]=r.useState(!1),[v,h]=r.useState(!1),x=!m.loading&&m.tier==="basic",N=x?a.entries.slice(0,3):a.entries,_=!x&&a.total>T,C=async()=>{h(!0);try{await a.clear(),g(s("toast.clearSuccess","Cleared successfully"),"success"),i(!1)}catch{g(s("toast.clearFailed","Failed to clear data"),"error")}finally{h(!1)}};return e.jsxs("div",{className:l.page,children:[e.jsx(U,{title:s("page.changelog.title","Changelog"),description:s("page.changelog.description","Review game-change sessions captured from AI actions and sync events."),helpTopicId:"changelog",helpState:{tier:m.tier}}),e.jsx(q,{items:$e.map(c=>({key:c.key,label:s(c.labelKey,c.key.charAt(0).toUpperCase()+c.key.slice(1))})),value:a.statusFilter,onChange:c=>{const p=`changelog_${c}`;d("dashboard_click_event",{click_target:`changelog_tab_${c}`,page:"changelog",tab:p}),t({page:"changelog",tab:p}),a.setStatusFilter(c),a.setOffset(0)},rightActions:e.jsx("button",{className:l.clearButton,onClick:()=>{d("dashboard_click_event",{click_target:"changelog_clear",page:"changelog",tab:`changelog_${a.statusFilter}`}),i(!0)},children:s("common.clear","Clear")})}),a.loading&&a.entries.length===0&&e.jsx("div",{className:l.loading,children:s("common.loading","Loading...")}),!a.loading&&a.entries.length===0?e.jsx("div",{className:l.empty,children:s("changelog.empty","No changelog entries yet")}):e.jsx("div",{className:l.list,children:N.map(c=>e.jsx(he,{entry:c,onClick:()=>n(`/changelog/${c.entryId}`)},c.entryId))}),_&&e.jsxs("div",{className:l.pagination,children:[e.jsx("button",{className:l.btn,disabled:a.offset===0,onClick:()=>a.setOffset(Math.max(0,a.offset-T)),children:s("tools.page.prev","Prev")}),e.jsxs("span",{className:l.pageInfo,children:[a.offset+1,"–",Math.min(a.offset+T,a.total)," / ",a.total]}),e.jsx("button",{className:l.btn,disabled:!a.hasMore,onClick:()=>a.setOffset(a.offset+T),children:s("tools.page.next","Next")})]}),x&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.limitNotice,children:[e.jsxs("div",{className:l.limitNoticeContent,children:[e.jsx("div",{className:l.limitNoticeTitle,children:s("changelog.basic.limit.title","Basic preview shows the latest 3 sessions")}),e.jsx("div",{className:l.limitNoticeText,children:s("changelog.basic.limit.body","Full changelog timeline browsing is available with Pro.")})]}),e.jsx("a",{className:l.primaryAction,href:H.changelog,target:"_blank",rel:"noreferrer",onClick:()=>d("dashboard_click_event",{click_target:"upgrade_cta",placement:"changelog_limit_notice",page:"changelog",tab:`changelog_${a.statusFilter}`}),children:s("tier.upgrade","View Pro")})]})}),e.jsx(Z,{open:f,title:s("changelog.clear.title","Clear changelog?"),message:s("changelog.clear.message","This permanently removes the stored changelog for the current place."),cancelLabel:s("common.cancel","Cancel"),confirmLabel:s("common.clear","Clear"),loading:v,onCancel:()=>!v&&i(!1),onConfirm:C})]})}export{we as Component};
1
+ import{r,a as M,D as P,u as D,j as e,i as V,c as O,m as K,n as G,T as H}from"./index-DG2RrKOl.js";import{P as U}from"./PageHeader-CThGgsAt.js";import{C as Z}from"./ConfirmModal-CpImpY9c.js";import{T as $}from"./TooltipText-H3YSCbob.js";import{T as q}from"./Tabs-BhkhdCvF.js";const z=10;function J(){const[s,d]=r.useState([]),[t,n]=r.useState(0),[a,m]=r.useState(!1),[g,f]=r.useState(!0),[i,v]=r.useState(0),[h,x]=r.useState("all"),N=r.useRef(null),_=r.useCallback(async(p,y)=>{f(!0);try{const j={limit:String(z),offset:String(p)};y!=="all"&&(j.status=y);const b=await M.get("/api/dashboard/changelog",j);d(b.entries),n(b.total),m(b.hasMore)}catch{d([]),n(0),m(!1)}finally{f(!1)}},[]),C=r.useCallback(()=>{_(i,h)},[_,i,h]),c=r.useCallback(async()=>{await M.post("/api/dashboard/changelog/clear"),d([]),n(0),m(!1)},[]);return r.useEffect(()=>{_(i,h)},[_,i,h]),r.useEffect(()=>{const p=new P;N.current=p,p.connect();const y=p.on("command",()=>{_(i,h)});return()=>{y(),p.disconnect(),N.current=null}},[_,i,h]),{entries:s,total:t,hasMore:a,loading:g,offset:i,statusFilter:h,setOffset:v,setStatusFilter:x,refresh:C,clear:c}}const Q="_card_1n89u_2",W="_header_1n89u_17",X="_statusBadge_1n89u_24",Y="_statusDot_1n89u_35",ee="_active_1n89u_41",te="_completed_1n89u_50",se="_timeRange_1n89u_58",ae="_summaryList_1n89u_65",ne="_summaryItem_1n89u_71",oe="_summaryIcon_1n89u_80",ce="_summaryText_1n89u_86",ie="_progressBar_1n89u_91",le="_progressFill_1n89u_99",re="_emptySummary_1n89u_112",ge="_contextBlock_1n89u_120",de="_contextLabel_1n89u_129",me="_contextValue_1n89u_137",o={card:Q,header:W,statusBadge:X,statusDot:Y,active:ee,completed:te,timeRange:se,summaryList:ae,summaryItem:ne,summaryIcon:oe,summaryText:ce,progressBar:ie,progressFill:le,emptySummary:re,contextBlock:ge,contextLabel:de,contextValue:me};function R(s){if(!s)return"--:--";const d=new Date(s);return`${String(d.getHours()).padStart(2,"0")}:${String(d.getMinutes()).padStart(2,"0")}`}function he({entry:s,onClick:d}){var j,b,I,k,B,L,A,w,E,F;const{t}=D(),n=s.changeSummary,a=s.status==="active",m=s.isBootstrapOnly===!0,g=[],f=n.scriptsModified+n.scriptsCreated;if(f>0){const u=[];n.scriptsModified>0&&u.push(`${n.scriptsModified} ${t("changelog.card.modified","modified")}`),n.scriptsCreated>0&&u.push(`${n.scriptsCreated} ${t("changelog.card.created","created")}`);const S=`${f} ${t("changelog.card.scripts","scripts")} ${u.join(", ")}`;g.push({icon:"📝",text:S,tooltip:t("changelog.card.scripts.tooltip","Script changes made in this session.")})}const i=n.instancesCreated+n.instancesDeleted+n.instancesMoved;if(i>0){const u=[];n.instancesCreated>0&&u.push(`${n.instancesCreated} ${t("changelog.card.created","created")}`),n.instancesDeleted>0&&u.push(`${n.instancesDeleted} ${t("changelog.card.deleted","deleted")}`),n.instancesMoved>0&&u.push(`${n.instancesMoved} ${t("changelog.card.moved","moved")}`);const S=`${i} ${t("changelog.card.instances","instances")} ${u.join(", ")}`;g.push({icon:"🧱",text:S,tooltip:t("changelog.card.instances.tooltip","Instance create, delete, move, or clone changes in this session.")})}n.propertiesChanged>0&&g.push({icon:"🎨",text:`${n.propertiesChanged} ${t("changelog.card.propertiesChanged","properties changed")}`,tooltip:t("changelog.card.propertiesChanged.tooltip","Property value changes recorded for this session.")}),n.lightingChanged&&g.push({icon:"🌅",text:t("changelog.card.lightingConfigured","Lighting configured"),tooltip:t("changelog.card.lightingConfigured.tooltip","Lighting or atmosphere settings changed in this session.")}),n.terrainChanged&&g.push({icon:"⛰️",text:t("changelog.card.terrainConfigured","Terrain configured"),tooltip:t("changelog.card.terrainConfigured.tooltip","Terrain data or terrain settings changed in this session.")}),n.assetsInserted>0&&g.push({icon:"📦",text:`${n.assetsInserted} ${t("changelog.card.assetsInserted","assets inserted")}`,tooltip:t("changelog.card.assetsInserted.tooltip","Assets inserted into the place during this session.")});const v=R(s.startTime),h=a?t("changelog.card.inProgress","in progress"):s.endTime?R(s.endTime):"--:--",x=m?t("changelog.card.bootstrapStatus","Bootstrap"):a?t("changelog.card.active","Active"):t("changelog.card.completed","Completed"),N=m?t("changelog.card.bootstrapStatus.tooltip","This session only contains the initial sync bootstrap snapshot."):a?t("changelog.card.active.tooltip","This session is still receiving new game changes."):t("changelog.card.completed.tooltip","This session has ended and no more changes are expected."),_=m?t("changelog.card.bootstrapSummary","Initial sync snapshot"):t("changelog.card.noChanges","No changes yet"),C=m?t("changelog.card.bootstrapSummary.tooltip","Initial file sync writes are collapsed into a single bootstrap snapshot row."):t("changelog.card.noChanges.tooltip","No game changes have been extracted for this session yet."),c=(b=(j=s.contextSummary)==null?void 0:j.intent)==null?void 0:b.trim(),p=((L=(B=(k=(I=s.contextSummary)==null?void 0:I.affectedAreas)==null?void 0:k[0])==null?void 0:B.label)==null?void 0:L.trim())||((w=(A=s.contextSummary)==null?void 0:A.testScenario)==null?void 0:w.trim()),y=(F=(E=s.verificationSummary)==null?void 0:E.label)==null?void 0:F.trim();return e.jsxs("div",{className:o.card,onClick:d,children:[e.jsxs("div",{className:o.header,children:[e.jsx($,{text:N,children:e.jsxs("span",{className:`${o.statusBadge} ${a?o.active:o.completed}`,children:[e.jsx("span",{className:o.statusDot}),x]})}),e.jsxs("span",{className:o.timeRange,children:[v,"~",h]})]}),e.jsx("div",{className:o.summaryList,children:g.length>0?g.map((u,S)=>e.jsxs("div",{className:o.summaryItem,children:[e.jsx("span",{className:o.summaryIcon,children:u.icon}),e.jsx($,{text:u.tooltip,children:e.jsx("span",{className:o.summaryText,children:u.text})})]},S)):e.jsx($,{text:C,children:e.jsx("span",{className:o.emptySummary,style:{display:"block"},children:_})})}),c&&e.jsxs("div",{className:o.contextBlock,children:[e.jsx("span",{className:o.contextLabel,children:t("changelog.card.sessionIntent","Session intent")}),e.jsx("span",{className:o.contextValue,children:c})]}),!c&&p&&e.jsxs("div",{className:o.contextBlock,children:[e.jsx("span",{className:o.contextLabel,children:t("changelog.card.representativeArea","Representative area")}),e.jsx("span",{className:o.contextValue,children:p})]}),y&&e.jsxs("div",{className:o.contextBlock,children:[e.jsx("span",{className:o.contextLabel,children:t("changelog.card.verification","Verification")}),e.jsx("span",{className:o.contextValue,children:y})]}),a&&e.jsx("div",{className:o.progressBar,children:e.jsx("div",{className:o.progressFill})})]})}const pe="_page_1tggr_2",ue="_limitNotice_1tggr_9",_e="_limitNoticeContent_1tggr_23",fe="_limitNoticeTitle_1tggr_28",xe="_limitNoticeText_1tggr_35",ye="_primaryAction_1tggr_41",ve="_clearButton_1tggr_67",Ne="_list_1tggr_88",be="_empty_1tggr_95",Ce="_loading_1tggr_104",je="_pagination_1tggr_113",Se="_pageInfo_1tggr_121",Te="_btn_1tggr_127",l={page:pe,limitNotice:ue,limitNoticeContent:_e,limitNoticeTitle:fe,limitNoticeText:xe,primaryAction:ye,clearButton:ve,list:Ne,empty:be,loading:Ce,pagination:je,pageInfo:Se,btn:Te},T=10,$e=[{key:"all",labelKey:"changelog.filter.all"},{key:"active",labelKey:"changelog.filter.active"},{key:"completed",labelKey:"changelog.filter.completed"}];function we(){const{t:s}=D(),{trackEvent:d,trackPageView:t}=V(),n=O(),a=J(),m=K(),{show:g}=G(),[f,i]=r.useState(!1),[v,h]=r.useState(!1),x=!m.loading&&m.tier==="basic",N=x?a.entries.slice(0,3):a.entries,_=!x&&a.total>T,C=async()=>{h(!0);try{await a.clear(),g(s("toast.clearSuccess","Cleared successfully"),"success"),i(!1)}catch{g(s("toast.clearFailed","Failed to clear data"),"error")}finally{h(!1)}};return e.jsxs("div",{className:l.page,children:[e.jsx(U,{title:s("page.changelog.title","Changelog"),description:s("page.changelog.description","Review game-change sessions captured from AI actions and sync events."),helpTopicId:"changelog",helpState:{tier:m.tier}}),e.jsx(q,{items:$e.map(c=>({key:c.key,label:s(c.labelKey,c.key.charAt(0).toUpperCase()+c.key.slice(1))})),value:a.statusFilter,onChange:c=>{const p=`changelog_${c}`;d("dashboard_click_event",{click_target:`changelog_tab_${c}`,page:"changelog",tab:p}),t({page:"changelog",tab:p}),a.setStatusFilter(c),a.setOffset(0)},rightActions:e.jsx("button",{className:l.clearButton,onClick:()=>{d("dashboard_click_event",{click_target:"changelog_clear",page:"changelog",tab:`changelog_${a.statusFilter}`}),i(!0)},children:s("common.clear","Clear")})}),a.loading&&a.entries.length===0&&e.jsx("div",{className:l.loading,children:s("common.loading","Loading...")}),!a.loading&&a.entries.length===0?e.jsx("div",{className:l.empty,children:s("changelog.empty","No changelog entries yet")}):e.jsx("div",{className:l.list,children:N.map(c=>e.jsx(he,{entry:c,onClick:()=>n(`/changelog/${c.entryId}`)},c.entryId))}),_&&e.jsxs("div",{className:l.pagination,children:[e.jsx("button",{className:l.btn,disabled:a.offset===0,onClick:()=>a.setOffset(Math.max(0,a.offset-T)),children:s("tools.page.prev","Prev")}),e.jsxs("span",{className:l.pageInfo,children:[a.offset+1,"–",Math.min(a.offset+T,a.total)," / ",a.total]}),e.jsx("button",{className:l.btn,disabled:!a.hasMore,onClick:()=>a.setOffset(a.offset+T),children:s("tools.page.next","Next")})]}),x&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.limitNotice,children:[e.jsxs("div",{className:l.limitNoticeContent,children:[e.jsx("div",{className:l.limitNoticeTitle,children:s("changelog.basic.limit.title","Basic preview shows the latest 3 sessions")}),e.jsx("div",{className:l.limitNoticeText,children:s("changelog.basic.limit.body","Full changelog timeline browsing is available with Pro.")})]}),e.jsx("a",{className:l.primaryAction,href:H.changelog,target:"_blank",rel:"noreferrer",onClick:()=>d("dashboard_click_event",{click_target:"upgrade_cta",placement:"changelog_limit_notice",page:"changelog",tab:`changelog_${a.statusFilter}`}),children:s("tier.upgrade","View Pro")})]})}),e.jsx(Z,{open:f,title:s("changelog.clear.title","Clear changelog?"),message:s("changelog.clear.message","This permanently removes the stored changelog for the current place."),cancelLabel:s("common.cancel","Cancel"),confirmLabel:s("common.clear","Clear"),loading:v,onCancel:()=>!v&&i(!1),onConfirm:C})]})}export{we as Component};
@@ -1 +1 @@
1
- import{r as x,j as s,x as a}from"./index-1ZlHj3-1.js";function j({open:t,title:r,message:c,cancelLabel:o,confirmLabel:n,loading:e=!1,onCancel:l,onConfirm:d}){const i=x.useId();return t?s.jsx("div",{className:a.backdrop,onClick:e?void 0:l,children:s.jsxs("div",{className:a.modal,role:"dialog","aria-modal":"true","aria-labelledby":i,onClick:m=>m.stopPropagation(),children:[s.jsx("h2",{id:i,className:a.title,children:r}),s.jsx("p",{className:a.message,children:c}),s.jsxs("div",{className:a.actions,children:[s.jsx("button",{className:a.cancelButton,onClick:l,disabled:e,children:o}),s.jsx("button",{className:a.confirmButton,onClick:d,disabled:e,children:e?"...":n})]})]})}):null}export{j as C};
1
+ import{r as u,j as s,y as a}from"./index-DG2RrKOl.js";function j({open:t,title:r,message:c,cancelLabel:o,confirmLabel:n,loading:e=!1,onCancel:l,onConfirm:d}){const i=u.useId();return t?s.jsx("div",{className:a.backdrop,onClick:e?void 0:l,children:s.jsxs("div",{className:a.modal,role:"dialog","aria-modal":"true","aria-labelledby":i,onClick:m=>m.stopPropagation(),children:[s.jsx("h2",{id:i,className:a.title,children:r}),s.jsx("p",{className:a.message,children:c}),s.jsxs("div",{className:a.actions,children:[s.jsx("button",{className:a.cancelButton,onClick:l,disabled:e,children:o}),s.jsx("button",{className:a.confirmButton,onClick:d,disabled:e,children:e?"...":n})]})]})}):null}export{j as C};
@@ -1 +1 @@
1
- import{u as L,r as a,j as e,d as B,a as w,D as T,i as H,n as D}from"./index-1ZlHj3-1.js";import{I as r}from"./InfoLabel-CldY9uOT.js";import{P as F}from"./PageHeader-ueZvp6K9.js";import{S as U}from"./StatusBadge-DxlagIzF.js";import{T as K}from"./TooltipText-DazmfUnr.js";import{C as $}from"./ConfirmModal-DSKr5eS9.js";import{u as G,f as O}from"./useLiveUptime-Dg607eVr.js";const V="_container_1h084_2",q="_entry_1h084_14",X="_timestamp_1h084_21",z="_message_1h084_27",J="_warn_1h084_34",Q="_error_1h084_39",W="_empty_1h084_44",v={container:V,entry:q,timestamp:X,message:z,warn:J,error:Q,empty:W};function Y(n){const i=new Date(n);return Number.isNaN(i.getTime())?n:`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`}function Z({entries:n}){const{t:i}=L(),t=a.useRef(null);return a.useEffect(()=>{const o=t.current;o&&(o.scrollTop=o.scrollHeight)},[n.length]),e.jsx("div",{ref:t,className:v.container,children:n.length===0?e.jsx("div",{className:v.empty,children:i("connection.log.empty","No events yet")}):n.map((o,u)=>e.jsxs("div",{className:`${v.entry} ${o.type?v[o.type]:""}`,children:[e.jsx("span",{className:v.timestamp,children:Y(o.timestamp)}),e.jsx("span",{className:v.message,children:o.message})]},u))})}const A=50;function ee(){const n=new Date;return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function ne(){const{level:n,status:i,error:t}=B(),[o,u]=a.useState(null),[C,j]=a.useState([]),y=a.useRef(null),g=a.useCallback((l,x)=>{j(p=>{const d=[...p,{timestamp:ee(),message:l,type:x}];return d.length>A?d.slice(-A):d})},[]),m=a.useCallback(async()=>{try{const l=await w.get("/connection-info");u(l)}catch{u(null)}},[]),S=a.useCallback(async()=>{try{const l=await w.get("/api/dashboard/connection-log");j(l.entries??[])}catch{j([])}},[]),k=a.useCallback(async()=>{await w.post("/api/dashboard/connection-log/clear"),j([])},[]),f=a.useCallback(async l=>{await w.post("/api/dashboard/kill-agent",{instanceId:l}),await m()},[m]);return a.useEffect(()=>{n!=="disconnected"&&i&&m(),S()},[n,i,m,S]),a.useEffect(()=>{const l=new T;y.current=l,l.connect();const x=l.on("connection",d=>{const h=d,_=h.status==="connected"?"connected":"disconnected";g(`Plugin ${_} — ${h.clientId}`,h.status==="connected"?"info":"warn")}),p=l.on("mcp_status",d=>{const h=d,_=h.status==="registered"?"registered":"unregistered";g(`MCP ${_} — ${h.aiClientName}`,h.status==="registered"?"info":"warn"),m()});return()=>{x(),p(),l.disconnect(),y.current=null}},[g,m]),{status:i,connectionInfo:o,connectionLog:C,level:n,error:t,clearConnectionLog:k,killAgent:f}}const te="_page_15jrd_2",se="_card_15jrd_10",ce="_disabled_15jrd_18",oe="_cardHeader_15jrd_24",ie="_clearButton_15jrd_37",ae="_serverGrid_15jrd_47",le="_statusRow_15jrd_65",re="_metaItem_15jrd_72",de="_table_15jrd_79",me="_toggleBtn_15jrd_104",pe="_disconnected_15jrd_119",he="_disconnectedActions_15jrd_136",ge="_btn_15jrd_143",ue="_activity_active_15jrd_161",je="_activity_stale_15jrd_162",xe="_activity_unknown_15jrd_163",_e="_killBtn_15jrd_187",ve="_emptyRow_15jrd_207",s={page:te,card:se,disabled:ce,cardHeader:oe,clearButton:ie,serverGrid:ae,statusRow:le,metaItem:re,table:de,toggleBtn:me,disconnected:pe,disconnectedActions:he,btn:ge,activity_active:ue,activity_stale:je,activity_unknown:xe,killBtn:_e,emptyRow:ve};function N(n,i){const t=Math.max(0,Math.floor((Date.now()-n)/1e3));return t<60?`${t}${i("connection.time.secondsAgo","s ago")}`:t<3600?`${Math.floor(t/60)}${i("connection.time.minutesAgo","m ago")}`:`${Math.floor(t/3600)}${i("connection.time.hoursAgo","h ago")}`}function fe(n){return n?Date.now()-n<3e4?"active":"stale":"unknown"}function Ie(){var I;const{t:n}=L(),{trackEvent:i}=H(),{status:t,connectionInfo:o,connectionLog:u,level:C,clearConnectionLog:j,killAgent:y}=ne(),{show:g}=D(),[m,S]=a.useState(!0),[k,f]=a.useState(!1),[l,x]=a.useState(!1),[p,d]=a.useState(null),[h,_]=a.useState(!1),R=G(t==null?void 0:t.uptime),b=C==="disconnected",M=b?"offline":"online",E=async()=>{if(p){_(!0);try{await y(p.instanceId),g(n("connection.agents.killed","Agent killed"),"success"),d(null)}catch{g(n("connection.agents.killFailed","Failed to kill agent"),"error")}finally{_(!1)}}},P=async()=>{x(!0);try{await j(),g(n("toast.clearSuccess","Cleared successfully"),"success"),f(!1)}catch{g(n("toast.clearFailed","Failed to clear data"),"error")}finally{x(!1)}};return e.jsxs("div",{className:s.page,children:[e.jsx(F,{title:n("page.connection.title","Connection"),description:n("page.connection.description","Inspect MCP server, AI agent, Studio plugin, and connection log status."),helpTopicId:"connection",helpState:{connectionLevel:C}}),e.jsxs("div",{className:s.card,children:[e.jsx("div",{className:s.cardHeader,children:n("connection.server.title","Server Status")}),b?e.jsxs("div",{className:s.disconnected,children:[e.jsx("h3",{children:n("level.l0.title")}),e.jsx("p",{children:n("level.l0.message")}),e.jsx("p",{children:n("common.reconnecting")}),e.jsxs("div",{className:s.disconnectedActions,children:[e.jsx("button",{className:s.btn,onClick:()=>window.location.reload(),children:n("connection.reconnect","Reconnect")}),e.jsx("button",{className:s.btn,onClick:()=>{window.location.hash="#/settings"},children:n("connection.checkSettings","Check Settings")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:s.statusRow,children:e.jsx(U,{status:M})}),e.jsxs("dl",{className:s.serverGrid,children:[(t==null?void 0:t.version)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.version","Version"),tooltip:n("connection.server.version.tooltip","Installed MCP server version")})}),e.jsx("dd",{children:e.jsx(K,{text:n("connection.server.version.tooltip","Installed MCP server version"),children:`v${t.version}`})})]}),(t==null?void 0:t.pid)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.pid","PID"),tooltip:n("connection.server.pid.tooltip","Operating system process identifier")})}),e.jsx("dd",{children:t.pid})]}),(t==null?void 0:t.uptime)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.uptime","Uptime"),tooltip:n("connection.server.uptime.tooltip","Time elapsed since the MCP server started")})}),e.jsx("dd",{children:O(R??t.uptime)})]}),(t==null?void 0:t.sessionId)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.session","Session"),tooltip:n("connection.server.session.tooltip","Current MCP session identifier")})}),e.jsx("dd",{children:t.sessionId.slice(0,8)})]}),(o==null?void 0:o.serverExecutable)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.exec","Exec"),tooltip:n("connection.server.exec.tooltip","Executable path used to launch the MCP server")})}),e.jsx("dd",{children:o.serverExecutable})]})]})]})]}),e.jsxs("div",{className:`${s.card} ${b?s.disabled:""}`,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[n("connection.agents.title","AI Agents")," ","(",(o==null?void 0:o.mcpInstanceCount)??0,")"]}),e.jsx("button",{className:s.toggleBtn,onClick:()=>S(c=>!c),"aria-label":m?n("common.collapse","Collapse"):n("common.expand","Expand"),children:m?"▾":"▸"})]}),m&&e.jsxs("table",{className:s.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("connection.agents.name","Agent")}),e.jsx("th",{children:e.jsx(r,{label:n("connection.server.pid","PID"),tooltip:n("connection.server.pid.tooltip","Operating system process identifier")})}),e.jsx("th",{children:e.jsx(r,{label:n("connection.agents.projectRoot","Project Root"),tooltip:n("connection.agents.projectRoot.tooltip","Authoritative project root for sync ownership")})}),e.jsx("th",{children:n("connection.agents.connected","Connected")}),e.jsx("th",{children:e.jsx(r,{label:n("connection.agents.lastSeen","Last Seen"),tooltip:n("connection.agents.lastSeen.tooltip","Most recent heartbeat or activity from this agent")})}),e.jsx("th",{children:e.jsx(r,{label:n("connection.agents.lastCommand","Last Command"),tooltip:n("connection.agents.lastCommand.tooltip","Most recent tool call executed by this agent")})}),e.jsx("th",{})]})}),e.jsx("tbody",{children:o!=null&&o.mcpInstances&&o.mcpInstances.length>0?o.mcpInstances.map(c=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("span",{className:s[`activity_${fe(c.lastSeen)}`]}),c.aiClientName??n("connection.agents.unknown","Unknown")]}),e.jsx("td",{children:c.pid}),e.jsx("td",{children:c.projectRoot??c.cwd??n("connection.agents.projectRoot.unresolved","Unresolved")}),e.jsx("td",{children:N(c.connectedAt,n)}),e.jsx("td",{children:c.lastSeen?N(c.lastSeen,n):"-"}),e.jsx("td",{children:c.lastCommandAt?N(c.lastCommandAt,n):"-"}),e.jsx("td",{children:!c.isServer&&e.jsx("button",{className:s.killBtn,onClick:()=>{i("dashboard_click_event",{click_target:"connection_kill_agent",page:"connection"}),d({instanceId:c.instanceId,name:c.aiClientName??c.instanceId.slice(0,8)})},children:n("connection.agents.kill","Kill")})})]},c.instanceId)):e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:s.emptyRow,children:n("connection.agents.none","No agents connected")})})})]})]}),e.jsxs("div",{className:`${s.card} ${b?s.disabled:""}`,children:[e.jsxs("div",{className:s.cardHeader,children:[n("connection.plugins.title","Plugins")," ","(",((I=t==null?void 0:t.pluginClients)==null?void 0:I.length)??0,")"]}),e.jsxs("table",{className:s.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("connection.plugins.place","Place")}),e.jsx("th",{children:e.jsx(r,{label:n("connection.plugins.clientId","Client ID"),tooltip:n("connection.plugins.clientId.tooltip","Unique plugin client identifier for this Studio connection")})}),e.jsx("th",{children:e.jsx(r,{label:n("connection.plugins.lastSeen","Last Seen"),tooltip:n("connection.plugins.lastSeen.tooltip","Most recent heartbeat received from the plugin")})}),e.jsx("th",{children:e.jsx(r,{label:n("connection.plugins.version","Ver"),tooltip:n("connection.plugins.version.tooltip","Installed plugin version reported by Studio")})})]})}),e.jsx("tbody",{children:t!=null&&t.pluginClients&&t.pluginClients.length>0?t.pluginClients.map(c=>e.jsxs("tr",{children:[e.jsx("td",{children:c.placeName??c.projectName??"-"}),e.jsx("td",{children:c.clientId.slice(0,10)}),e.jsx("td",{children:N(c.lastSeen,n)}),e.jsx("td",{children:c.pluginVersion??"-"})]},c.clientId)):e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:s.emptyRow,children:n("connection.plugins.none","No plugins connected")})})})]})]}),e.jsxs("div",{className:`${s.card} ${b?s.disabled:""}`,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsx("span",{children:n("connection.log.title","Connection Log")}),e.jsx("button",{className:s.clearButton,onClick:()=>{i("dashboard_click_event",{click_target:"connection_clear_log",page:"connection"}),f(!0)},children:n("common.clear","Clear")})]}),e.jsx(Z,{entries:u})]}),e.jsx($,{open:k,title:n("connection.clear.title","Clear connection log?"),message:n("connection.clear.message","This permanently removes the stored connection log for the current project."),cancelLabel:n("common.cancel","Cancel"),confirmLabel:n("common.clear","Clear"),loading:l,onCancel:()=>!l&&f(!1),onConfirm:P}),e.jsx($,{open:!!p,title:n("connection.agents.kill.title","Kill agent?"),message:`"${p==null?void 0:p.name}" 프로세스를 강제 종료합니다. 해당 에이전트의 진행 중인 작업이 중단됩니다.`,cancelLabel:n("common.cancel","Cancel"),confirmLabel:n("connection.agents.kill","Kill"),loading:h,onCancel:()=>!h&&d(null),onConfirm:E})]})}export{Ie as Component};
1
+ import{u as L,r as a,j as e,d as B,a as w,D as T,i as H,n as D}from"./index-DG2RrKOl.js";import{I as r}from"./InfoLabel-Cyz7d4Kc.js";import{P as F}from"./PageHeader-CThGgsAt.js";import{S as U}from"./StatusBadge-CkLieULy.js";import{T as K}from"./TooltipText-H3YSCbob.js";import{C as $}from"./ConfirmModal-CpImpY9c.js";import{u as G,f as O}from"./useLiveUptime-BHqJirBV.js";const V="_container_1h084_2",q="_entry_1h084_14",X="_timestamp_1h084_21",z="_message_1h084_27",J="_warn_1h084_34",Q="_error_1h084_39",W="_empty_1h084_44",v={container:V,entry:q,timestamp:X,message:z,warn:J,error:Q,empty:W};function Y(n){const i=new Date(n);return Number.isNaN(i.getTime())?n:`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`}function Z({entries:n}){const{t:i}=L(),t=a.useRef(null);return a.useEffect(()=>{const o=t.current;o&&(o.scrollTop=o.scrollHeight)},[n.length]),e.jsx("div",{ref:t,className:v.container,children:n.length===0?e.jsx("div",{className:v.empty,children:i("connection.log.empty","No events yet")}):n.map((o,u)=>e.jsxs("div",{className:`${v.entry} ${o.type?v[o.type]:""}`,children:[e.jsx("span",{className:v.timestamp,children:Y(o.timestamp)}),e.jsx("span",{className:v.message,children:o.message})]},u))})}const A=50;function ee(){const n=new Date;return`${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`}function ne(){const{level:n,status:i,error:t}=B(),[o,u]=a.useState(null),[C,j]=a.useState([]),y=a.useRef(null),g=a.useCallback((l,x)=>{j(p=>{const d=[...p,{timestamp:ee(),message:l,type:x}];return d.length>A?d.slice(-A):d})},[]),m=a.useCallback(async()=>{try{const l=await w.get("/connection-info");u(l)}catch{u(null)}},[]),S=a.useCallback(async()=>{try{const l=await w.get("/api/dashboard/connection-log");j(l.entries??[])}catch{j([])}},[]),k=a.useCallback(async()=>{await w.post("/api/dashboard/connection-log/clear"),j([])},[]),f=a.useCallback(async l=>{await w.post("/api/dashboard/kill-agent",{instanceId:l}),await m()},[m]);return a.useEffect(()=>{n!=="disconnected"&&i&&m(),S()},[n,i,m,S]),a.useEffect(()=>{const l=new T;y.current=l,l.connect();const x=l.on("connection",d=>{const h=d,_=h.status==="connected"?"connected":"disconnected";g(`Plugin ${_} — ${h.clientId}`,h.status==="connected"?"info":"warn")}),p=l.on("mcp_status",d=>{const h=d,_=h.status==="registered"?"registered":"unregistered";g(`MCP ${_} — ${h.aiClientName}`,h.status==="registered"?"info":"warn"),m()});return()=>{x(),p(),l.disconnect(),y.current=null}},[g,m]),{status:i,connectionInfo:o,connectionLog:C,level:n,error:t,clearConnectionLog:k,killAgent:f}}const te="_page_15jrd_2",se="_card_15jrd_10",ce="_disabled_15jrd_18",oe="_cardHeader_15jrd_24",ie="_clearButton_15jrd_37",ae="_serverGrid_15jrd_47",le="_statusRow_15jrd_65",re="_metaItem_15jrd_72",de="_table_15jrd_79",me="_toggleBtn_15jrd_104",pe="_disconnected_15jrd_119",he="_disconnectedActions_15jrd_136",ge="_btn_15jrd_143",ue="_activity_active_15jrd_161",je="_activity_stale_15jrd_162",xe="_activity_unknown_15jrd_163",_e="_killBtn_15jrd_187",ve="_emptyRow_15jrd_207",s={page:te,card:se,disabled:ce,cardHeader:oe,clearButton:ie,serverGrid:ae,statusRow:le,metaItem:re,table:de,toggleBtn:me,disconnected:pe,disconnectedActions:he,btn:ge,activity_active:ue,activity_stale:je,activity_unknown:xe,killBtn:_e,emptyRow:ve};function N(n,i){const t=Math.max(0,Math.floor((Date.now()-n)/1e3));return t<60?`${t}${i("connection.time.secondsAgo","s ago")}`:t<3600?`${Math.floor(t/60)}${i("connection.time.minutesAgo","m ago")}`:`${Math.floor(t/3600)}${i("connection.time.hoursAgo","h ago")}`}function fe(n){return n?Date.now()-n<3e4?"active":"stale":"unknown"}function Ie(){var I;const{t:n}=L(),{trackEvent:i}=H(),{status:t,connectionInfo:o,connectionLog:u,level:C,clearConnectionLog:j,killAgent:y}=ne(),{show:g}=D(),[m,S]=a.useState(!0),[k,f]=a.useState(!1),[l,x]=a.useState(!1),[p,d]=a.useState(null),[h,_]=a.useState(!1),R=G(t==null?void 0:t.uptime),b=C==="disconnected",M=b?"offline":"online",E=async()=>{if(p){_(!0);try{await y(p.instanceId),g(n("connection.agents.killed","Agent killed"),"success"),d(null)}catch{g(n("connection.agents.killFailed","Failed to kill agent"),"error")}finally{_(!1)}}},P=async()=>{x(!0);try{await j(),g(n("toast.clearSuccess","Cleared successfully"),"success"),f(!1)}catch{g(n("toast.clearFailed","Failed to clear data"),"error")}finally{x(!1)}};return e.jsxs("div",{className:s.page,children:[e.jsx(F,{title:n("page.connection.title","Connection"),description:n("page.connection.description","Inspect MCP server, AI agent, Studio plugin, and connection log status."),helpTopicId:"connection",helpState:{connectionLevel:C}}),e.jsxs("div",{className:s.card,children:[e.jsx("div",{className:s.cardHeader,children:n("connection.server.title","Server Status")}),b?e.jsxs("div",{className:s.disconnected,children:[e.jsx("h3",{children:n("level.l0.title")}),e.jsx("p",{children:n("level.l0.message")}),e.jsx("p",{children:n("common.reconnecting")}),e.jsxs("div",{className:s.disconnectedActions,children:[e.jsx("button",{className:s.btn,onClick:()=>window.location.reload(),children:n("connection.reconnect","Reconnect")}),e.jsx("button",{className:s.btn,onClick:()=>{window.location.hash="#/settings"},children:n("connection.checkSettings","Check Settings")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:s.statusRow,children:e.jsx(U,{status:M})}),e.jsxs("dl",{className:s.serverGrid,children:[(t==null?void 0:t.version)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.version","Version"),tooltip:n("connection.server.version.tooltip","Installed MCP server version")})}),e.jsx("dd",{children:e.jsx(K,{text:n("connection.server.version.tooltip","Installed MCP server version"),children:`v${t.version}`})})]}),(t==null?void 0:t.pid)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.pid","PID"),tooltip:n("connection.server.pid.tooltip","Operating system process identifier")})}),e.jsx("dd",{children:t.pid})]}),(t==null?void 0:t.uptime)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.uptime","Uptime"),tooltip:n("connection.server.uptime.tooltip","Time elapsed since the MCP server started")})}),e.jsx("dd",{children:O(R??t.uptime)})]}),(t==null?void 0:t.sessionId)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.session","Session"),tooltip:n("connection.server.session.tooltip","Current MCP session identifier")})}),e.jsx("dd",{children:t.sessionId.slice(0,8)})]}),(o==null?void 0:o.serverExecutable)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(r,{label:n("connection.server.exec","Exec"),tooltip:n("connection.server.exec.tooltip","Executable path used to launch the MCP server")})}),e.jsx("dd",{children:o.serverExecutable})]})]})]})]}),e.jsxs("div",{className:`${s.card} ${b?s.disabled:""}`,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[n("connection.agents.title","AI Agents")," ","(",(o==null?void 0:o.mcpInstanceCount)??0,")"]}),e.jsx("button",{className:s.toggleBtn,onClick:()=>S(c=>!c),"aria-label":m?n("common.collapse","Collapse"):n("common.expand","Expand"),children:m?"▾":"▸"})]}),m&&e.jsxs("table",{className:s.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("connection.agents.name","Agent")}),e.jsx("th",{children:e.jsx(r,{label:n("connection.server.pid","PID"),tooltip:n("connection.server.pid.tooltip","Operating system process identifier")})}),e.jsx("th",{children:e.jsx(r,{label:n("connection.agents.projectRoot","Project Root"),tooltip:n("connection.agents.projectRoot.tooltip","Authoritative project root for sync ownership")})}),e.jsx("th",{children:n("connection.agents.connected","Connected")}),e.jsx("th",{children:e.jsx(r,{label:n("connection.agents.lastSeen","Last Seen"),tooltip:n("connection.agents.lastSeen.tooltip","Most recent heartbeat or activity from this agent")})}),e.jsx("th",{children:e.jsx(r,{label:n("connection.agents.lastCommand","Last Command"),tooltip:n("connection.agents.lastCommand.tooltip","Most recent tool call executed by this agent")})}),e.jsx("th",{})]})}),e.jsx("tbody",{children:o!=null&&o.mcpInstances&&o.mcpInstances.length>0?o.mcpInstances.map(c=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("span",{className:s[`activity_${fe(c.lastSeen)}`]}),c.aiClientName??n("connection.agents.unknown","Unknown")]}),e.jsx("td",{children:c.pid}),e.jsx("td",{children:c.projectRoot??c.cwd??n("connection.agents.projectRoot.unresolved","Unresolved")}),e.jsx("td",{children:N(c.connectedAt,n)}),e.jsx("td",{children:c.lastSeen?N(c.lastSeen,n):"-"}),e.jsx("td",{children:c.lastCommandAt?N(c.lastCommandAt,n):"-"}),e.jsx("td",{children:!c.isServer&&e.jsx("button",{className:s.killBtn,onClick:()=>{i("dashboard_click_event",{click_target:"connection_kill_agent",page:"connection"}),d({instanceId:c.instanceId,name:c.aiClientName??c.instanceId.slice(0,8)})},children:n("connection.agents.kill","Kill")})})]},c.instanceId)):e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:s.emptyRow,children:n("connection.agents.none","No agents connected")})})})]})]}),e.jsxs("div",{className:`${s.card} ${b?s.disabled:""}`,children:[e.jsxs("div",{className:s.cardHeader,children:[n("connection.plugins.title","Plugins")," ","(",((I=t==null?void 0:t.pluginClients)==null?void 0:I.length)??0,")"]}),e.jsxs("table",{className:s.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:n("connection.plugins.place","Place")}),e.jsx("th",{children:e.jsx(r,{label:n("connection.plugins.clientId","Client ID"),tooltip:n("connection.plugins.clientId.tooltip","Unique plugin client identifier for this Studio connection")})}),e.jsx("th",{children:e.jsx(r,{label:n("connection.plugins.lastSeen","Last Seen"),tooltip:n("connection.plugins.lastSeen.tooltip","Most recent heartbeat received from the plugin")})}),e.jsx("th",{children:e.jsx(r,{label:n("connection.plugins.version","Ver"),tooltip:n("connection.plugins.version.tooltip","Installed plugin version reported by Studio")})})]})}),e.jsx("tbody",{children:t!=null&&t.pluginClients&&t.pluginClients.length>0?t.pluginClients.map(c=>e.jsxs("tr",{children:[e.jsx("td",{children:c.placeName??c.projectName??"-"}),e.jsx("td",{children:c.clientId.slice(0,10)}),e.jsx("td",{children:N(c.lastSeen,n)}),e.jsx("td",{children:c.pluginVersion??"-"})]},c.clientId)):e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:s.emptyRow,children:n("connection.plugins.none","No plugins connected")})})})]})]}),e.jsxs("div",{className:`${s.card} ${b?s.disabled:""}`,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsx("span",{children:n("connection.log.title","Connection Log")}),e.jsx("button",{className:s.clearButton,onClick:()=>{i("dashboard_click_event",{click_target:"connection_clear_log",page:"connection"}),f(!0)},children:n("common.clear","Clear")})]}),e.jsx(Z,{entries:u})]}),e.jsx($,{open:k,title:n("connection.clear.title","Clear connection log?"),message:n("connection.clear.message","This permanently removes the stored connection log for the current project."),cancelLabel:n("common.cancel","Cancel"),confirmLabel:n("common.clear","Clear"),loading:l,onCancel:()=>!l&&f(!1),onConfirm:P}),e.jsx($,{open:!!p,title:n("connection.agents.kill.title","Kill agent?"),message:`"${p==null?void 0:p.name}" 프로세스를 강제 종료합니다. 해당 에이전트의 진행 중인 작업이 중단됩니다.`,cancelLabel:n("common.cancel","Cancel"),confirmLabel:n("connection.agents.kill","Kill"),loading:h,onCancel:()=>!h&&d(null),onConfirm:E})]})}export{Ie as Component};
@@ -1,4 +1,4 @@
1
- import{u as _,r as x,j as e}from"./index-1ZlHj3-1.js";const N="_container_uv8oc_2",j="_header_uv8oc_10",v="_modeBtn_uv8oc_18",g="_modeBtnActive_uv8oc_33",w="_unifiedView_uv8oc_40",L="_diffLine_uv8oc_46",b="_lineNum_uv8oc_55",C="_lineContent_uv8oc_64",S="_lineAdded_uv8oc_68",V="_lineRemoved_uv8oc_73",B="_lineContext_uv8oc_78",$="_sideBySide_uv8oc_83",A="_sidePane_uv8oc_90",P="_sideLabel_uv8oc_100",R="_sideContent_uv8oc_112",D="_empty_uv8oc_117",s={container:N,header:j,modeBtn:v,modeBtnActive:g,unifiedView:w,diffLine:L,lineNum:b,lineContent:C,lineAdded:S,lineRemoved:V,lineContext:B,sideBySide:$,sidePane:A,sideLabel:P,sideContent:R,empty:D};function k(n,i){const l=n.split(`
1
+ import{u as _,r as x,j as e}from"./index-DG2RrKOl.js";const N="_container_uv8oc_2",j="_header_uv8oc_10",v="_modeBtn_uv8oc_18",g="_modeBtnActive_uv8oc_33",w="_unifiedView_uv8oc_40",L="_diffLine_uv8oc_46",b="_lineNum_uv8oc_55",C="_lineContent_uv8oc_64",S="_lineAdded_uv8oc_68",V="_lineRemoved_uv8oc_73",B="_lineContext_uv8oc_78",$="_sideBySide_uv8oc_83",A="_sidePane_uv8oc_90",P="_sideLabel_uv8oc_100",R="_sideContent_uv8oc_112",D="_empty_uv8oc_117",s={container:N,header:j,modeBtn:v,modeBtnActive:g,unifiedView:w,diffLine:L,lineNum:b,lineContent:C,lineAdded:S,lineRemoved:V,lineContext:B,sideBySide:$,sidePane:A,sideLabel:P,sideContent:R,empty:D};function k(n,i){const l=n.split(`
2
2
  `),d=i.split(`
3
3
  `),a=[],f=Math.max(l.length,d.length);let t=0,r=0;for(;(t<l.length||r<d.length)&&(t<l.length&&r<d.length?l[t]===d[r]?(a.push({type:"context",content:l[t],lineNum:r+1}),t++,r++):(a.push({type:"removed",content:l[t],lineNum:t+1}),t++,t<l.length&&l[t]===d[r]?(a.push({type:"added",content:d[r],lineNum:r+1}),r++):r<d.length&&(a.push({type:"added",content:d[r],lineNum:r+1}),r++)):t<l.length?(a.push({type:"removed",content:l[t],lineNum:t+1}),t++):r<d.length&&(a.push({type:"added",content:d[r],lineNum:r+1}),r++),!(a.length>f*3)););return a}function O({before:n,after:i}){const{t:l}=_(),[d,a]=x.useState("unified"),f=typeof n=="string"?n:n!=null?JSON.stringify(n,null,2):"",t=typeof i=="string"?i:i!=null?JSON.stringify(i,null,2):"",r=x.useMemo(()=>k(f,t),[f,t]);if(!f&&!t)return e.jsx("div",{className:s.container,children:e.jsx("div",{className:s.empty,children:l("changelog.diff.empty","No diff available")})});if(!f&&t){const c=t.split(`
4
4
  `);return e.jsx("div",{className:s.container,children:e.jsx("div",{className:s.unifiedView,children:c.map((u,m)=>e.jsxs("div",{className:`${s.diffLine} ${s.lineAdded}`,children:[e.jsx("span",{className:s.lineNum,children:m+1}),e.jsxs("span",{className:s.lineContent,children:["+ ",u]})]},m))})})}return e.jsxs("div",{className:s.container,children:[e.jsxs("div",{className:s.header,children:[e.jsx("button",{className:`${s.modeBtn} ${d==="unified"?s.modeBtnActive:""}`,onClick:()=>a("unified"),children:l("changelog.diff.unified","Unified")}),e.jsx("button",{className:`${s.modeBtn} ${d==="side-by-side"?s.modeBtnActive:""}`,onClick:()=>a("side-by-side"),children:l("changelog.diff.sideBySide","Side by Side")})]}),d==="unified"?e.jsx("div",{className:s.unifiedView,children:r.map((c,u)=>e.jsxs("div",{className:`${s.diffLine} ${c.type==="added"?s.lineAdded:c.type==="removed"?s.lineRemoved:s.lineContext}`,children:[e.jsx("span",{className:s.lineNum,children:c.lineNum??""}),e.jsxs("span",{className:s.lineContent,children:[c.type==="added"?"+ ":c.type==="removed"?"- ":" ",c.content]})]},u))}):e.jsxs("div",{className:s.sideBySide,children:[e.jsxs("div",{className:s.sidePane,children:[e.jsx("div",{className:s.sideLabel,children:l("changelog.diff.before","Before")}),e.jsx("div",{className:s.sideContent,children:f.split(`
@@ -1 +1 @@
1
- import{j as r,p as e}from"./index-1ZlHj3-1.js";function s({label:t,tooltip:o}){return r.jsx(e,{text:o,children:t})}export{s as I};
1
+ import{j as r,p as e}from"./index-DG2RrKOl.js";function s({label:t,tooltip:o}){return r.jsx(e,{text:o,children:t})}export{s as I};
@@ -1 +1 @@
1
- import{j as t,u as R,r as v,d as L,m as F,a as M,D as V}from"./index-1ZlHj3-1.js";import{I as A}from"./InfoLabel-CldY9uOT.js";import{P as U}from"./PageHeader-ueZvp6K9.js";import{S as z}from"./StatusBadge-DxlagIzF.js";import{T as O}from"./TooltipText-DazmfUnr.js";import{G as X}from"./GameChangeDetail-BmXlRT3i.js";import{u as q,f as J}from"./useLiveUptime-Dg607eVr.js";const K="_page_1xgxh_2",Q="_card_1xgxh_10",W="_cardHeader_1xgxh_17",Y="_disconnectCard_1xgxh_28",Z="_disconnectIcon_1xgxh_36",ee="_disconnectTitle_1xgxh_41",te="_disconnectMessage_1xgxh_48",se="_reconnectGuide_1xgxh_55",ne="_guideStep_1xgxh_64",ie="_stepNumber_1xgxh_72",ce="_reconnectIndicator_1xgxh_88",re="_reconnectDot_1xgxh_98",ae="_pulse_1xgxh_1",oe="_disconnectActions_1xgxh_112",le="_btn_1xgxh_118",de="_btnSecondary_1xgxh_134",me="_metricRow_1xgxh_152",ge="_metricGrid_1xgxh_158",he="_metricCard_1xgxh_164",xe="_metric_ok_1xgxh_174",ue="_metric_warn_1xgxh_179",ve="_metric_error_1xgxh_184",_e="_metricHeader_1xgxh_189",pe="_metricIcon_1xgxh_200",fe="_metricTitle_1xgxh_204",Ce="_metricValue_1xgxh_208",je="_metricSubtitle_1xgxh_215",we="_guideCard_1xgxh_225",Ne="_guideTitle_1xgxh_232",ye="_checklist_1xgxh_239",Te="_feedEmpty_1xgxh_263",Se="_feedList_1xgxh_270",Ie="_feedItem_1xgxh_278",be="_feedTime_1xgxh_291",ke="_feedIcon_1xgxh_298",Me="_feedSummary_1xgxh_304",De="_feedText_1xgxh_313",Be="_feedContext_1xgxh_321",He="_feedItemClickable_1xgxh_330",Ee="_feedChevron_1xgxh_338",Pe="_feedDetail_1xgxh_347",$e="_feedDetailPre_1xgxh_356",Re="_feedDetailText_1xgxh_365",Ge="_changelogSummary_1xgxh_372",Le="_changeTag_1xgxh_381",Fe="_tierBar_1xgxh_393",Ve="_tierBarTrack_1xgxh_399",Ae="_tierBarFillBasic_1xgxh_407",Ue="_tierBarFillPro_1xgxh_412",ze="_tierLabels_1xgxh_417",s={page:K,card:Q,cardHeader:W,disconnectCard:Y,disconnectIcon:Z,disconnectTitle:ee,disconnectMessage:te,reconnectGuide:se,guideStep:ne,stepNumber:ie,reconnectIndicator:ce,reconnectDot:re,pulse:ae,disconnectActions:oe,btn:le,btnSecondary:de,metricRow:me,metricGrid:ge,metricCard:he,metric_ok:xe,metric_warn:ue,metric_error:ve,metricHeader:_e,metricIcon:pe,metricTitle:fe,metricValue:Ce,metricSubtitle:je,guideCard:we,guideTitle:Ne,checklist:ye,feedEmpty:Te,feedList:Se,feedItem:Ie,feedTime:be,feedIcon:ke,feedSummary:Me,feedText:De,feedContext:Be,feedItemClickable:He,feedChevron:Ee,feedDetail:Pe,feedDetailPre:$e,feedDetailText:Re,changelogSummary:Ge,changeTag:Le,tierBar:Fe,tierBarTrack:Ve,tierBarFillBasic:Ae,tierBarFillPro:Ue,tierLabels:ze};function N({title:e,value:i,icon:c,subtitle:r,status:a,children:n}){const l=a?s[`metric_${a}`]:"";return t.jsxs("div",{className:`${s.metricCard} ${l}`,children:[t.jsxs("div",{className:s.metricHeader,children:[c&&t.jsx("span",{className:s.metricIcon,children:c}),t.jsx("span",{className:s.metricTitle,children:e})]}),t.jsx("div",{className:s.metricValue,children:i}),r&&t.jsx("div",{className:s.metricSubtitle,children:r}),n]})}function Oe(e){var c,r;const i=e==null?void 0:e.contextSummary;return(i==null?void 0:i.intent)??((r=(c=i==null?void 0:i.affectedAreas)==null?void 0:c[0])==null?void 0:r.label)??(i==null?void 0:i.testScenario)??null}function H({changes:e}){const{t:i}=R(),[c,r]=v.useState(null);return e.length===0?t.jsx("div",{className:s.feedEmpty,children:i("overview.feed.empty")}):t.jsx("div",{className:s.feedList,children:e.map((a,n)=>{const l=c===n,g=a.raw,h=g&&(g.before!=null||g.after!=null||g.details!=null),_=Oe(g);return t.jsxs("div",{children:[t.jsxs("div",{className:`${s.feedItem} ${h?s.feedItemClickable:""}`,onClick:()=>h&&r(l?null:n),children:[t.jsx("span",{className:s.feedTime,children:a.timestamp}),t.jsx("span",{className:s.feedIcon,children:a.icon}),t.jsxs("span",{className:s.feedText,children:[t.jsx("span",{className:s.feedSummary,children:a.summary}),_&&t.jsx("span",{className:s.feedContext,children:_})]}),h&&t.jsx("span",{className:s.feedChevron,children:l?"▴":"▾"})]}),l&&g&&t.jsx("div",{className:s.feedDetail,children:t.jsx(X,{change:g})})]},n)})})}const E=20;function G(e){return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}function P(){return G(new Date)}function $(e){switch(e){case"script":return"📝";case"instance":return"🧱";case"property":return"🎨";case"lighting":return"💡";case"terrain":return"⛰️";case"asset":return"📦";default:return"🔧"}}function Xe(){const{level:e,status:i}=L(),c=F(),[r,a]=v.useState(null),[n,l]=v.useState(null),[g,h]=v.useState(null),[_,x]=v.useState([]),y=v.useRef(null),T=v.useCallback(async()=>{try{const o=await M.get("/connection-info");a(o)}catch{a(null)}},[]),S=v.useCallback(async()=>{try{const o=await M.get("/api/dashboard/changelog/active");if(h(o),o.recentChanges&&o.recentChanges.length>0){const p=o.recentChanges.map(u=>({timestamp:u.timestamp?G(new Date(u.timestamp)):P(),icon:$(u.category),summary:u.summary,category:u.category,raw:u}));x(p)}}catch{h(null)}},[]),f=v.useCallback(async()=>{try{const o=await M.get("/sync/status");l(o)}catch{l(null)}},[]);return v.useEffect(()=>{e!=="disconnected"?(T(),S(),f()):(a(null),l(null),h(null));const o=new V;y.current=o,o.connect();const p=o.on("game_change",C=>{const d=C,j={timestamp:P(),icon:$(d.category),summary:d.summary,category:d.category};x(k=>{const w=[j,...k];return w.length>E?w.slice(0,E):w}),S()}),u=o.on("sync",C=>{const d=C;l(j=>({...j,state:d.status,...d.placeId?{placeId:d.placeId}:{}}))});return()=>{p(),u(),o.disconnect(),y.current=null}},[e,T,S,f]),{level:e,status:i,connectionInfo:r,syncStatus:n,changeSummary:g,recentChanges:_,tier:c}}function D(e){return e.scriptsModified+e.scriptsCreated+e.instancesCreated+e.instancesDeleted+e.instancesMoved+e.propertiesChanged+e.assetsInserted+(e.lightingChanged?1:0)+(e.terrainChanged?1:0)}function qe(e,i){switch(e){case"syncing":return i("status.syncing","Syncing");case"initializing":return i("status.initializing","Initializing");case"error":return i("status.error","Error");default:return i("status.idle","Idle")}}function Je(e){switch(e){case"syncing":return"ok";case"initializing":return"warn";case"error":return"error";default:return"ok"}}function b(e,i,c,r){return t.jsxs("div",{className:e.metricSubtitle,children:[t.jsx(A,{label:i,tooltip:c}),": ",r]},i)}function m(e,i){return t.jsx(O,{text:i,children:e})}function st(){var w,B;const{t:e}=R(),{level:i,status:c,connectionInfo:r,syncStatus:a,changeSummary:n,recentChanges:l}=Xe(),g=q(c==null?void 0:c.uptime),h=t.jsx(U,{title:e("page.overview.title","Overview"),description:e("page.overview.description","Check server, plugin, agent, sync, and recent game-change status in one place."),helpTopicId:"overview",helpState:{connectionLevel:i}});if(i==="disconnected")return t.jsxs("div",{className:s.page,children:[h,t.jsxs("div",{className:s.disconnectCard,children:[t.jsx("div",{className:s.disconnectIcon,children:"⚠️"}),t.jsx("h2",{className:s.disconnectTitle,children:e("overview.l0.title")}),t.jsx("p",{className:s.disconnectMessage,children:e("overview.l0.message")}),t.jsxs("div",{className:s.reconnectGuide,children:[t.jsxs("div",{className:s.guideStep,children:[t.jsx("span",{className:s.stepNumber,children:"1"}),t.jsx("span",{children:e("overview.l0.step1")})]}),t.jsxs("div",{className:s.guideStep,children:[t.jsx("span",{className:s.stepNumber,children:"2"}),t.jsx("span",{children:e("overview.l0.step2")})]})]}),t.jsxs("div",{className:s.reconnectIndicator,children:[t.jsx("span",{className:s.reconnectDot}),e("overview.l0.reconnecting")]}),t.jsxs("div",{className:s.disconnectActions,children:[t.jsx("button",{className:s.btn,onClick:()=>window.location.reload(),children:e("overview.l0.reconnectBtn")}),t.jsx("button",{className:s.btnSecondary,onClick:()=>{window.location.hash="#/settings"},children:e("overview.l0.settingsBtn")})]})]})]});const _=(r==null?void 0:r.mcpInstanceCount)??0,x=((w=r==null?void 0:r.mcpInstances)==null?void 0:w.find(I=>!I.isServer&&I.aiClientName))??((B=r==null?void 0:r.mcpInstances)==null?void 0:B.find(I=>!!I.aiClientName))??null,y=(c==null?void 0:c.pluginClients)??[],T=y.length>0,S=(c==null?void 0:c.sessionId)??(r==null?void 0:r.sessionId)??"-",f=e("overview.metric.server.tooltip","MCP server runtime and process status"),o=e("overview.metric.plugin.tooltip","Roblox Studio plugin connection and version status"),p=e("overview.metric.agent.tooltip","Connected AI coding agents and their runtime state"),u=e("overview.metric.sync.tooltip","Current Studio to local sync activity"),C=c?[b(s,e("overview.meta.version","Version"),e("overview.meta.version.tooltip","Installed MCP server version"),`v${c.version}`),b(s,e("overview.meta.session","Session"),e("overview.meta.session.tooltip","Current MCP session identifier"),S),b(s,e("overview.meta.pid","PID"),e("overview.meta.pid.tooltip","Operating system process identifier"),String(c.pid??"-")),b(s,e("overview.meta.uptime","Uptime"),e("overview.meta.uptime.tooltip","Time elapsed since the MCP server started"),J(g??c.uptime))]:[];if(i==="serverOnly")return t.jsxs("div",{className:s.page,children:[h,t.jsxs("div",{className:s.metricRow,children:[t.jsx(N,{title:m(e("overview.metric.server"),f),value:m(e("status.online"),f),icon:"🖥️",status:"ok",children:t.jsxs(t.Fragment,{children:[C,t.jsx(z,{status:"online"})]})}),t.jsx(N,{title:m(e("overview.metric.agent"),p),value:m((x==null?void 0:x.aiClientName)??e("overview.metric.noAgent"),p),icon:"🤖",subtitle:_>1?`${_} ${e("overview.metric.agent.instancesUnit","instances")}`:void 0,status:x?"ok":"warn"})]}),t.jsxs("div",{className:s.guideCard,children:[t.jsx("h3",{className:s.guideTitle,children:e("overview.l1.pluginGuide")}),t.jsxs("ul",{className:s.checklist,children:[t.jsx("li",{children:e("overview.l1.check1")}),t.jsx("li",{children:e("overview.l1.check2")})]})]}),t.jsxs("div",{className:s.card,children:[t.jsx("div",{className:s.cardHeader,children:e("overview.feed.title")}),l.length>0?t.jsx(H,{changes:l}):t.jsx("div",{className:s.feedEmpty,children:e("overview.l1.feedHint")})]}),n&&D(n)>0&&t.jsxs("div",{className:s.card,children:[t.jsx("div",{className:s.cardHeader,children:e("overview.changelog.title")}),t.jsxs("div",{className:s.changelogSummary,children:[t.jsxs("span",{children:[e("overview.changelog.entries","Entries"),": ",D(n)]}),n.scriptsModified>0&&t.jsxs("span",{className:s.changeTag,children:["📝"," ",n.scriptsModified," ",e("overview.changelog.scripts")]}),n.instancesCreated>0&&t.jsxs("span",{className:s.changeTag,children:["🧱"," ",n.instancesCreated," ",e("overview.changelog.instances")]}),n.propertiesChanged>0&&t.jsxs("span",{className:s.changeTag,children:["🎨"," ",n.propertiesChanged," ",e("overview.changelog.properties")]}),n.assetsInserted>0&&t.jsxs("span",{className:s.changeTag,children:["📦"," ",n.assetsInserted," ",e("overview.changelog.assets")]})]})]})]});const d=y[0],j=n?D(n):0,k=!!n&&j>0;return t.jsxs("div",{className:s.page,children:[h,t.jsxs("div",{className:s.metricGrid,children:[t.jsx(N,{title:m(e("overview.metric.server"),f),value:m(e("status.online"),f),icon:"🖥️",status:"ok",children:t.jsx(t.Fragment,{children:C})}),t.jsx(N,{title:m(e("overview.metric.plugin"),o),value:m(e(T?"status.online":"status.offline"),o),icon:"🔌",subtitle:d?`${d.placeName??d.projectName??"-"} / v${d.pluginVersion??"-"}`:void 0,status:T?"ok":"error"}),t.jsx(N,{title:m(e("overview.metric.agent"),p),value:m((x==null?void 0:x.aiClientName)??e("overview.metric.noAgent"),p),icon:"🤖",subtitle:_>1?`${_} ${e("overview.metric.agent.instancesUnit","instances")}`:void 0,status:x?"ok":"warn"}),t.jsx(N,{title:m(e("overview.metric.sync"),u),value:m(qe(a==null?void 0:a.state,e),u),icon:"🔄",status:Je(a==null?void 0:a.state)})]}),t.jsxs("div",{className:s.card,children:[t.jsx("div",{className:s.cardHeader,children:e("overview.feed.title")}),t.jsx(H,{changes:l})]}),k&&t.jsxs("div",{className:s.card,children:[t.jsx("div",{className:s.cardHeader,children:e("overview.changelog.title")}),t.jsxs("div",{className:s.changelogSummary,children:[t.jsxs("span",{children:[e("overview.changelog.entries","Entries"),": ",j]}),n.scriptsModified>0&&t.jsxs("span",{className:s.changeTag,children:["📝"," ",n.scriptsModified," ",e("overview.changelog.scripts")]}),n.instancesCreated>0&&t.jsxs("span",{className:s.changeTag,children:["🧱"," ",n.instancesCreated," ",e("overview.changelog.instances")]}),n.propertiesChanged>0&&t.jsxs("span",{className:s.changeTag,children:["🎨"," ",n.propertiesChanged," ",e("overview.changelog.properties")]}),n.assetsInserted>0&&t.jsxs("span",{className:s.changeTag,children:["📦"," ",n.assetsInserted," ",e("overview.changelog.assets")]})]})]})]})}export{st as Component};
1
+ import{j as t,u as R,r as v,d as L,m as F,a as M,D as V}from"./index-DG2RrKOl.js";import{I as A}from"./InfoLabel-Cyz7d4Kc.js";import{P as U}from"./PageHeader-CThGgsAt.js";import{S as z}from"./StatusBadge-CkLieULy.js";import{T as O}from"./TooltipText-H3YSCbob.js";import{G as X}from"./GameChangeDetail-CghOvUm8.js";import{u as q,f as J}from"./useLiveUptime-BHqJirBV.js";const K="_page_1xgxh_2",Q="_card_1xgxh_10",W="_cardHeader_1xgxh_17",Y="_disconnectCard_1xgxh_28",Z="_disconnectIcon_1xgxh_36",ee="_disconnectTitle_1xgxh_41",te="_disconnectMessage_1xgxh_48",se="_reconnectGuide_1xgxh_55",ne="_guideStep_1xgxh_64",ie="_stepNumber_1xgxh_72",ce="_reconnectIndicator_1xgxh_88",re="_reconnectDot_1xgxh_98",ae="_pulse_1xgxh_1",oe="_disconnectActions_1xgxh_112",le="_btn_1xgxh_118",de="_btnSecondary_1xgxh_134",me="_metricRow_1xgxh_152",ge="_metricGrid_1xgxh_158",he="_metricCard_1xgxh_164",xe="_metric_ok_1xgxh_174",ue="_metric_warn_1xgxh_179",ve="_metric_error_1xgxh_184",_e="_metricHeader_1xgxh_189",pe="_metricIcon_1xgxh_200",fe="_metricTitle_1xgxh_204",Ce="_metricValue_1xgxh_208",je="_metricSubtitle_1xgxh_215",we="_guideCard_1xgxh_225",Ne="_guideTitle_1xgxh_232",ye="_checklist_1xgxh_239",Te="_feedEmpty_1xgxh_263",Se="_feedList_1xgxh_270",Ie="_feedItem_1xgxh_278",be="_feedTime_1xgxh_291",ke="_feedIcon_1xgxh_298",Me="_feedSummary_1xgxh_304",De="_feedText_1xgxh_313",Be="_feedContext_1xgxh_321",He="_feedItemClickable_1xgxh_330",Ee="_feedChevron_1xgxh_338",Pe="_feedDetail_1xgxh_347",$e="_feedDetailPre_1xgxh_356",Re="_feedDetailText_1xgxh_365",Ge="_changelogSummary_1xgxh_372",Le="_changeTag_1xgxh_381",Fe="_tierBar_1xgxh_393",Ve="_tierBarTrack_1xgxh_399",Ae="_tierBarFillBasic_1xgxh_407",Ue="_tierBarFillPro_1xgxh_412",ze="_tierLabels_1xgxh_417",s={page:K,card:Q,cardHeader:W,disconnectCard:Y,disconnectIcon:Z,disconnectTitle:ee,disconnectMessage:te,reconnectGuide:se,guideStep:ne,stepNumber:ie,reconnectIndicator:ce,reconnectDot:re,pulse:ae,disconnectActions:oe,btn:le,btnSecondary:de,metricRow:me,metricGrid:ge,metricCard:he,metric_ok:xe,metric_warn:ue,metric_error:ve,metricHeader:_e,metricIcon:pe,metricTitle:fe,metricValue:Ce,metricSubtitle:je,guideCard:we,guideTitle:Ne,checklist:ye,feedEmpty:Te,feedList:Se,feedItem:Ie,feedTime:be,feedIcon:ke,feedSummary:Me,feedText:De,feedContext:Be,feedItemClickable:He,feedChevron:Ee,feedDetail:Pe,feedDetailPre:$e,feedDetailText:Re,changelogSummary:Ge,changeTag:Le,tierBar:Fe,tierBarTrack:Ve,tierBarFillBasic:Ae,tierBarFillPro:Ue,tierLabels:ze};function N({title:e,value:i,icon:c,subtitle:r,status:a,children:n}){const l=a?s[`metric_${a}`]:"";return t.jsxs("div",{className:`${s.metricCard} ${l}`,children:[t.jsxs("div",{className:s.metricHeader,children:[c&&t.jsx("span",{className:s.metricIcon,children:c}),t.jsx("span",{className:s.metricTitle,children:e})]}),t.jsx("div",{className:s.metricValue,children:i}),r&&t.jsx("div",{className:s.metricSubtitle,children:r}),n]})}function Oe(e){var c,r;const i=e==null?void 0:e.contextSummary;return(i==null?void 0:i.intent)??((r=(c=i==null?void 0:i.affectedAreas)==null?void 0:c[0])==null?void 0:r.label)??(i==null?void 0:i.testScenario)??null}function H({changes:e}){const{t:i}=R(),[c,r]=v.useState(null);return e.length===0?t.jsx("div",{className:s.feedEmpty,children:i("overview.feed.empty")}):t.jsx("div",{className:s.feedList,children:e.map((a,n)=>{const l=c===n,g=a.raw,h=g&&(g.before!=null||g.after!=null||g.details!=null),_=Oe(g);return t.jsxs("div",{children:[t.jsxs("div",{className:`${s.feedItem} ${h?s.feedItemClickable:""}`,onClick:()=>h&&r(l?null:n),children:[t.jsx("span",{className:s.feedTime,children:a.timestamp}),t.jsx("span",{className:s.feedIcon,children:a.icon}),t.jsxs("span",{className:s.feedText,children:[t.jsx("span",{className:s.feedSummary,children:a.summary}),_&&t.jsx("span",{className:s.feedContext,children:_})]}),h&&t.jsx("span",{className:s.feedChevron,children:l?"▴":"▾"})]}),l&&g&&t.jsx("div",{className:s.feedDetail,children:t.jsx(X,{change:g})})]},n)})})}const E=20;function G(e){return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`}function P(){return G(new Date)}function $(e){switch(e){case"script":return"📝";case"instance":return"🧱";case"property":return"🎨";case"lighting":return"💡";case"terrain":return"⛰️";case"asset":return"📦";default:return"🔧"}}function Xe(){const{level:e,status:i}=L(),c=F(),[r,a]=v.useState(null),[n,l]=v.useState(null),[g,h]=v.useState(null),[_,x]=v.useState([]),y=v.useRef(null),T=v.useCallback(async()=>{try{const o=await M.get("/connection-info");a(o)}catch{a(null)}},[]),S=v.useCallback(async()=>{try{const o=await M.get("/api/dashboard/changelog/active");if(h(o),o.recentChanges&&o.recentChanges.length>0){const p=o.recentChanges.map(u=>({timestamp:u.timestamp?G(new Date(u.timestamp)):P(),icon:$(u.category),summary:u.summary,category:u.category,raw:u}));x(p)}}catch{h(null)}},[]),f=v.useCallback(async()=>{try{const o=await M.get("/sync/status");l(o)}catch{l(null)}},[]);return v.useEffect(()=>{e!=="disconnected"?(T(),S(),f()):(a(null),l(null),h(null));const o=new V;y.current=o,o.connect();const p=o.on("game_change",C=>{const d=C,j={timestamp:P(),icon:$(d.category),summary:d.summary,category:d.category};x(k=>{const w=[j,...k];return w.length>E?w.slice(0,E):w}),S()}),u=o.on("sync",C=>{const d=C;l(j=>({...j,state:d.status,...d.placeId?{placeId:d.placeId}:{}}))});return()=>{p(),u(),o.disconnect(),y.current=null}},[e,T,S,f]),{level:e,status:i,connectionInfo:r,syncStatus:n,changeSummary:g,recentChanges:_,tier:c}}function D(e){return e.scriptsModified+e.scriptsCreated+e.instancesCreated+e.instancesDeleted+e.instancesMoved+e.propertiesChanged+e.assetsInserted+(e.lightingChanged?1:0)+(e.terrainChanged?1:0)}function qe(e,i){switch(e){case"syncing":return i("status.syncing","Syncing");case"initializing":return i("status.initializing","Initializing");case"error":return i("status.error","Error");default:return i("status.idle","Idle")}}function Je(e){switch(e){case"syncing":return"ok";case"initializing":return"warn";case"error":return"error";default:return"ok"}}function b(e,i,c,r){return t.jsxs("div",{className:e.metricSubtitle,children:[t.jsx(A,{label:i,tooltip:c}),": ",r]},i)}function m(e,i){return t.jsx(O,{text:i,children:e})}function st(){var w,B;const{t:e}=R(),{level:i,status:c,connectionInfo:r,syncStatus:a,changeSummary:n,recentChanges:l}=Xe(),g=q(c==null?void 0:c.uptime),h=t.jsx(U,{title:e("page.overview.title","Overview"),description:e("page.overview.description","Check server, plugin, agent, sync, and recent game-change status in one place."),helpTopicId:"overview",helpState:{connectionLevel:i}});if(i==="disconnected")return t.jsxs("div",{className:s.page,children:[h,t.jsxs("div",{className:s.disconnectCard,children:[t.jsx("div",{className:s.disconnectIcon,children:"⚠️"}),t.jsx("h2",{className:s.disconnectTitle,children:e("overview.l0.title")}),t.jsx("p",{className:s.disconnectMessage,children:e("overview.l0.message")}),t.jsxs("div",{className:s.reconnectGuide,children:[t.jsxs("div",{className:s.guideStep,children:[t.jsx("span",{className:s.stepNumber,children:"1"}),t.jsx("span",{children:e("overview.l0.step1")})]}),t.jsxs("div",{className:s.guideStep,children:[t.jsx("span",{className:s.stepNumber,children:"2"}),t.jsx("span",{children:e("overview.l0.step2")})]})]}),t.jsxs("div",{className:s.reconnectIndicator,children:[t.jsx("span",{className:s.reconnectDot}),e("overview.l0.reconnecting")]}),t.jsxs("div",{className:s.disconnectActions,children:[t.jsx("button",{className:s.btn,onClick:()=>window.location.reload(),children:e("overview.l0.reconnectBtn")}),t.jsx("button",{className:s.btnSecondary,onClick:()=>{window.location.hash="#/settings"},children:e("overview.l0.settingsBtn")})]})]})]});const _=(r==null?void 0:r.mcpInstanceCount)??0,x=((w=r==null?void 0:r.mcpInstances)==null?void 0:w.find(I=>!I.isServer&&I.aiClientName))??((B=r==null?void 0:r.mcpInstances)==null?void 0:B.find(I=>!!I.aiClientName))??null,y=(c==null?void 0:c.pluginClients)??[],T=y.length>0,S=(c==null?void 0:c.sessionId)??(r==null?void 0:r.sessionId)??"-",f=e("overview.metric.server.tooltip","MCP server runtime and process status"),o=e("overview.metric.plugin.tooltip","Roblox Studio plugin connection and version status"),p=e("overview.metric.agent.tooltip","Connected AI coding agents and their runtime state"),u=e("overview.metric.sync.tooltip","Current Studio to local sync activity"),C=c?[b(s,e("overview.meta.version","Version"),e("overview.meta.version.tooltip","Installed MCP server version"),`v${c.version}`),b(s,e("overview.meta.session","Session"),e("overview.meta.session.tooltip","Current MCP session identifier"),S),b(s,e("overview.meta.pid","PID"),e("overview.meta.pid.tooltip","Operating system process identifier"),String(c.pid??"-")),b(s,e("overview.meta.uptime","Uptime"),e("overview.meta.uptime.tooltip","Time elapsed since the MCP server started"),J(g??c.uptime))]:[];if(i==="serverOnly")return t.jsxs("div",{className:s.page,children:[h,t.jsxs("div",{className:s.metricRow,children:[t.jsx(N,{title:m(e("overview.metric.server"),f),value:m(e("status.online"),f),icon:"🖥️",status:"ok",children:t.jsxs(t.Fragment,{children:[C,t.jsx(z,{status:"online"})]})}),t.jsx(N,{title:m(e("overview.metric.agent"),p),value:m((x==null?void 0:x.aiClientName)??e("overview.metric.noAgent"),p),icon:"🤖",subtitle:_>1?`${_} ${e("overview.metric.agent.instancesUnit","instances")}`:void 0,status:x?"ok":"warn"})]}),t.jsxs("div",{className:s.guideCard,children:[t.jsx("h3",{className:s.guideTitle,children:e("overview.l1.pluginGuide")}),t.jsxs("ul",{className:s.checklist,children:[t.jsx("li",{children:e("overview.l1.check1")}),t.jsx("li",{children:e("overview.l1.check2")})]})]}),t.jsxs("div",{className:s.card,children:[t.jsx("div",{className:s.cardHeader,children:e("overview.feed.title")}),l.length>0?t.jsx(H,{changes:l}):t.jsx("div",{className:s.feedEmpty,children:e("overview.l1.feedHint")})]}),n&&D(n)>0&&t.jsxs("div",{className:s.card,children:[t.jsx("div",{className:s.cardHeader,children:e("overview.changelog.title")}),t.jsxs("div",{className:s.changelogSummary,children:[t.jsxs("span",{children:[e("overview.changelog.entries","Entries"),": ",D(n)]}),n.scriptsModified>0&&t.jsxs("span",{className:s.changeTag,children:["📝"," ",n.scriptsModified," ",e("overview.changelog.scripts")]}),n.instancesCreated>0&&t.jsxs("span",{className:s.changeTag,children:["🧱"," ",n.instancesCreated," ",e("overview.changelog.instances")]}),n.propertiesChanged>0&&t.jsxs("span",{className:s.changeTag,children:["🎨"," ",n.propertiesChanged," ",e("overview.changelog.properties")]}),n.assetsInserted>0&&t.jsxs("span",{className:s.changeTag,children:["📦"," ",n.assetsInserted," ",e("overview.changelog.assets")]})]})]})]});const d=y[0],j=n?D(n):0,k=!!n&&j>0;return t.jsxs("div",{className:s.page,children:[h,t.jsxs("div",{className:s.metricGrid,children:[t.jsx(N,{title:m(e("overview.metric.server"),f),value:m(e("status.online"),f),icon:"🖥️",status:"ok",children:t.jsx(t.Fragment,{children:C})}),t.jsx(N,{title:m(e("overview.metric.plugin"),o),value:m(e(T?"status.online":"status.offline"),o),icon:"🔌",subtitle:d?`${d.placeName??d.projectName??"-"} / v${d.pluginVersion??"-"}`:void 0,status:T?"ok":"error"}),t.jsx(N,{title:m(e("overview.metric.agent"),p),value:m((x==null?void 0:x.aiClientName)??e("overview.metric.noAgent"),p),icon:"🤖",subtitle:_>1?`${_} ${e("overview.metric.agent.instancesUnit","instances")}`:void 0,status:x?"ok":"warn"}),t.jsx(N,{title:m(e("overview.metric.sync"),u),value:m(qe(a==null?void 0:a.state,e),u),icon:"🔄",status:Je(a==null?void 0:a.state)})]}),t.jsxs("div",{className:s.card,children:[t.jsx("div",{className:s.cardHeader,children:e("overview.feed.title")}),t.jsx(H,{changes:l})]}),k&&t.jsxs("div",{className:s.card,children:[t.jsx("div",{className:s.cardHeader,children:e("overview.changelog.title")}),t.jsxs("div",{className:s.changelogSummary,children:[t.jsxs("span",{children:[e("overview.changelog.entries","Entries"),": ",j]}),n.scriptsModified>0&&t.jsxs("span",{className:s.changeTag,children:["📝"," ",n.scriptsModified," ",e("overview.changelog.scripts")]}),n.instancesCreated>0&&t.jsxs("span",{className:s.changeTag,children:["🧱"," ",n.instancesCreated," ",e("overview.changelog.instances")]}),n.propertiesChanged>0&&t.jsxs("span",{className:s.changeTag,children:["🎨"," ",n.propertiesChanged," ",e("overview.changelog.properties")]}),n.assetsInserted>0&&t.jsxs("span",{className:s.changeTag,children:["📦"," ",n.assetsInserted," ",e("overview.changelog.assets")]})]})]})]})}export{st as Component};