@weppy/roblox-mcp 2.17.5 → 2.17.7

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 (47) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +2 -2
  3. package/dashboard/dist/assets/{AiPromptExamples-B3LZ06_M.js → AiPromptExamples-FjV57hJp.js} +1 -1
  4. package/dashboard/dist/assets/AssetsPage-Bdcj6AyD.css +1 -0
  5. package/dashboard/dist/assets/AssetsPage-DvCSWpoy.js +61 -0
  6. package/dashboard/dist/assets/{ChangelogPage-D_G_HjiK.js → ChangelogPage-BrNOX2vc.js} +1 -1
  7. package/dashboard/dist/assets/{ConfirmModal-CL0Z5xwJ.js → ConfirmModal-Ddk0UX_P.js} +1 -1
  8. package/dashboard/dist/assets/{ConnectionPage-DaYME7QT.js → ConnectionPage-B62B5vSh.js} +1 -1
  9. package/dashboard/dist/assets/{ControlsPage-gnKyi48F.js → ControlsPage-Cl_mQpzx.js} +1 -1
  10. package/dashboard/dist/assets/CurrentPlaceScope-B6NllTmu.css +1 -0
  11. package/dashboard/dist/assets/CurrentPlaceScope-Y25KxsHT.js +1 -0
  12. package/dashboard/dist/assets/{GameChangeDetail-CbYXbvWl.js → GameChangeDetail-br9EgICc.js} +1 -1
  13. package/dashboard/dist/assets/{InfoLabel-BaayM8hW.js → InfoLabel-CAGC3efT.js} +1 -1
  14. package/dashboard/dist/assets/{OverviewPage-DuPB7VBe.js → OverviewPage-DxRlbjwz.js} +1 -1
  15. package/dashboard/dist/assets/{PageHeader-C1A4pFFD.js → PageHeader-Dc41DgFB.js} +1 -1
  16. package/dashboard/dist/assets/PlaceSelectOptions-DCv8Lnxo.css +1 -0
  17. package/dashboard/dist/assets/PlaceSelectOptions-Gd2pK9DL.js +1 -0
  18. package/dashboard/dist/assets/{PlaytestAiPromptExamples-Bf494cNk.js → PlaytestAiPromptExamples-CkR6t6Na.js} +1 -1
  19. package/dashboard/dist/assets/PlaytestPage-ShadLIAO.js +127 -0
  20. package/dashboard/dist/assets/{SettingsPage-Om-hGqIQ.js → SettingsPage-CGGHBxbL.js} +1 -1
  21. package/dashboard/dist/assets/{StatusBadge-CiHSf_o_.js → StatusBadge-Cdfb5vyE.js} +1 -1
  22. package/dashboard/dist/assets/{SyncPage-BTADHgCn.js → SyncPage-CT2ECSYt.js} +1 -1
  23. package/dashboard/dist/assets/{Tabs-C0QQfjUl.js → Tabs-Dl0dNd8V.js} +1 -1
  24. package/dashboard/dist/assets/{TierPromoPanel-DI3EP06A.js → TierPromoPanel-B0BctivD.js} +1 -1
  25. package/dashboard/dist/assets/{ToolsPage-CCsd60Kh.js → ToolsPage-CsFjwKOz.js} +1 -1
  26. package/dashboard/dist/assets/{TooltipText-INE_h7BS.js → TooltipText-C0DmdntK.js} +1 -1
  27. package/dashboard/dist/assets/{UiStudioPage-TfbhZvt5.js → UiStudioPage-DzG_JVxv.js} +1 -1
  28. package/dashboard/dist/assets/{WhatsNewPage-BPKMcfVs.js → WhatsNewPage-BpSGOLxW.js} +1 -1
  29. package/dashboard/dist/assets/{bot-TMxhORyF.js → bot-BCKWpJd_.js} +1 -1
  30. package/dashboard/dist/assets/{check-C5Uo2cs_.js → check-DvBWmDvn.js} +1 -1
  31. package/dashboard/dist/assets/{copy-BENnfclm.js → copy-vqzBh0XB.js} +1 -1
  32. package/dashboard/dist/assets/{index-ZP3F-qh6.js → index-CG4GxcAc.js} +96 -64
  33. package/dashboard/dist/assets/{sample-requests-DVllzgEu.js → sample-requests-BqgMpTlQ.js} +1 -1
  34. package/dashboard/dist/assets/{trash-2-C7bZq3Km.js → trash-2-zj182u9_.js} +1 -1
  35. package/dashboard/dist/assets/{useLiveUptime-CBpmama-.js → useLiveUptime-yZ9iKJ1B.js} +1 -1
  36. package/dashboard/dist/assets/useSettings-Cme-nLG9.js +1 -0
  37. package/dashboard/dist/index.html +1 -1
  38. package/dist/index.js +154 -154
  39. package/package.json +1 -1
  40. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  41. package/dashboard/dist/assets/AssetsPage-DBMNmn9Z.js +0 -61
  42. package/dashboard/dist/assets/AssetsPage-DX8NUPQo.css +0 -1
  43. package/dashboard/dist/assets/CurrentPlaceScope-CHRh7s-z.js +0 -1
  44. package/dashboard/dist/assets/CurrentPlaceScope-COd50R0N.css +0 -1
  45. package/dashboard/dist/assets/PlaceSelectOptions-DU7Ka-gE.js +0 -1
  46. package/dashboard/dist/assets/PlaytestPage-JPS-_xPE.js +0 -127
  47. package/dashboard/dist/assets/useSettings-Ug_fLuUn.js +0 -1
@@ -1 +1 @@
1
- import{u as X,a as le,r,j as e,b as I,g as me,c as ye,T as je,A as xe,S as fe}from"./index-ZP3F-qh6.js";import{C as be,P as ve}from"./PageHeader-C1A4pFFD.js";import{I as R}from"./InfoLabel-BaayM8hW.js";import{T as m}from"./TooltipText-INE_h7BS.js";import{s as a,u as Se}from"./useSettings-Ug_fLuUn.js";import{C as ce}from"./ConfirmModal-CL0Z5xwJ.js";import{D as de,f as ue,r as Ce,s as Ne,a as pe,d as se,S as ae,b as _e}from"./sample-requests-DVllzgEu.js";import"./ConfirmModal.module-DJksQHBd.js";const ke="_card_jz1ya_4",Pe="_cardEmbedded_jz1ya_14",Le="_cardTitle_jz1ya_21",Re="_storageConsoleGrid_jz1ya_31",we="_storageUsageColumn_jz1ya_38",He="_storagePolicyColumn_jz1ya_39",Be="_usageRow_jz1ya_44",Me="_usageTotal_jz1ya_50",Ae="_usageBreakdown_jz1ya_57",$e="_usageCounts_jz1ya_63",ze="_storageFooter_jz1ya_70",De="_lastRunRow_jz1ya_79",Ee="_lastRunLabel_jz1ya_89",Te="_errorIcon_jz1ya_95",Ie="_tooltip_jz1ya_103",Ue="_cleanupRow_jz1ya_126",Fe="_cleanupLabel_jz1ya_133",Oe="_cleanupBtn_jz1ya_140",Ge="_cleanupBtnDanger_jz1ya_169",qe="_retentionSection_jz1ya_182",We="_retentionTitle_jz1ya_188",Ye="_retentionFieldset_jz1ya_196",Ke="_proOverlay_jz1ya_211",Ve="_modeSegments_jz1ya_223",Je="_radioLabel_jz1ya_244",Qe="_radioLabelActive_jz1ya_265",Ze="_presetGroup_jz1ya_279",Xe="_presetBtn_jz1ya_287",et="_presetBtnActive_jz1ya_310",tt="_freeInput_jz1ya_317",st="_inputError_jz1ya_334",at="_inputUnit_jz1ya_338",it="_cascadeRow_jz1ya_345",nt="_retentionActions_jz1ya_361",ot="_saveBtn_jz1ya_367",rt="_runNowBtn_jz1ya_395",lt="_errorMsg_jz1ya_439",ct="_freeInputHitArea_jz1ya_501",o={card:ke,cardEmbedded:Pe,cardTitle:Le,storageConsoleGrid:Re,storageUsageColumn:we,storagePolicyColumn:He,usageRow:Be,usageTotal:Me,usageBreakdown:Ae,usageCounts:$e,storageFooter:ze,lastRunRow:De,lastRunLabel:Ee,errorIcon:Te,tooltip:Ie,cleanupRow:Ue,cleanupLabel:Fe,cleanupBtn:Oe,cleanupBtnDanger:Ge,retentionSection:qe,retentionTitle:We,retentionFieldset:Ye,proOverlay:Ke,modeSegments:Ve,radioLabel:Je,radioLabelActive:Qe,presetGroup:Ze,presetBtn:Xe,presetBtnActive:et,freeInput:tt,inputError:st,inputUnit:at,cascadeRow:it,retentionActions:nt,saveBtn:ot,runNowBtn:rt,errorMsg:lt,freeInputHitArea:ct};function dt(t,s){return!!(t.mode==="off"&&s.mode!=="off"||t.mode==="age"&&s.mode==="age"&&(s.ageDays??0)<(t.ageDays??0)||t.mode==="size"&&s.mode==="size"&&(s.sizeMb??0)<(t.sizeMb??0)||!t.cascadeSnapshots&&s.cascadeSnapshots)}function ie(t){return t.mode==="age"?Number.isInteger(t.ageDays)&&t.ageDays>=1&&t.ageDays<=365:t.mode==="size"?Number.isInteger(t.sizeMb)&&t.sizeMb>=50&&t.sizeMb<=1e4:!0}function ut(t,s){return t.mode===s.mode&&t.ageDays===s.ageDays&&t.sizeMb===s.sizeMb&&t.cascadeSnapshots===s.cascadeSnapshots}function Y(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function pt({placeId:t,tier:s,currentPolicy:l,onSaved:d}){const{t:n}=X(),{trackEvent:b}=le(),[i,g]=r.useState(l),[p,_]=r.useState(()=>[7,14,30,90].includes(l.ageDays??-1)?"":String(l.ageDays??30)),[v,k]=r.useState(()=>[100,500,1e3].includes(l.sizeMb??-1)?"":String(l.sizeMb??500)),[P,z]=r.useState(null),[x,f]=r.useState(!1),[D,w]=r.useState(!1),[y,H]=r.useState(!1),[L,A]=r.useState(null);r.useEffect(()=>{g(l);const h=[7,14,30,90],M=[100,500,1e3];_(h.includes(l.ageDays??-1)?"":String(l.ageDays??30)),k(M.includes(l.sizeMb??-1)?"":String(l.sizeMb??500))},[l]);const $=s==="basic",N=ie(i),j=ut(l,i),E=N&&!j&&!D,S=h=>{g(M=>{const O={...M,mode:h};return h==="age"&&(O.ageDays=parseInt(p,10)||30),h==="size"&&(O.sizeMb=parseInt(v,10)||500),O})},B=h=>{_(""),g(M=>({...M,ageDays:h}))},U=h=>{k(""),g(M=>({...M,sizeMb:h}))},F=h=>{_(h);const M=parseInt(h,10);Number.isNaN(M)||g(O=>({...O,ageDays:M}))},c=h=>{k(h);const M=parseInt(h,10);Number.isNaN(M)||g(O=>({...O,sizeMb:M}))},T=async()=>{if(A(null),b("dashboard_click_event",{click_target:"ui_studio_cleanup_save",page:"settings"}),dt(l,i)){try{const h=await ue(t,{mode:i.mode,ageDays:i.ageDays,sizeMb:i.sizeMb,cascadeSnapshots:i.cascadeSnapshots});z(h.dryRun),f(!0)}catch(h){A(h.message)}return}await W()},W=async()=>{w(!0);try{await Ne(t,i),f(!1),d()}catch(h){throw A(h.message),h}finally{w(!1)}},u=async()=>{A(null),b("dashboard_click_event",{click_target:"ui_studio_cleanup_run_now",page:"settings"}),H(!0);try{await Ce(t),d()}catch(h){A(h.message)}finally{H(!1)}},C=P?`${n("uiStudio.cleanup.policy.confirm.messageStrict","이 정책으로 즉시")} ${P.wouldRemoveRequests}${n("uiStudio.cleanup.policy.confirm.requests","건")} / ${P.wouldRemoveSnapshots}${n("uiStudio.cleanup.policy.confirm.snapshots","개 화면 캡처")} / ${Y(P.wouldFreeBytes)} ${n("uiStudio.cleanup.policy.confirm.freed","가 삭제됩니다 — 적용?")}`:"",K=i.mode==="age"&&!ie(i),q=i.mode==="size"&&!ie(i);return e.jsxs("div",{className:o.retentionSection,children:[e.jsx("h3",{className:o.retentionTitle,children:e.jsx(R,{label:n("uiStudio.cleanup.policy.title","자동 삭제 정책"),tooltip:n("uiStudio.cleanup.policy.title.tooltip","Rules that automatically remove old or large captures.")})}),e.jsxs("div",{style:{position:"relative"},children:[$&&e.jsx("div",{className:o.proOverlay,title:n("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능"),children:e.jsx("div",{className:o.tooltip,children:n("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능")})}),e.jsxs("fieldset",{className:o.retentionFieldset,disabled:$,"aria-label":n("uiStudio.cleanup.policy.title","자동 삭제 정책"),style:$?{opacity:.45,pointerEvents:"none"}:void 0,children:[e.jsxs("div",{className:o.modeSegments,"data-testid":"cleanup-mode-segments",children:[e.jsx(m,{text:n("uiStudio.cleanup.policy.modeOff.tooltip","Turn off auto-cleanup. Data stays until you remove it manually."),children:e.jsxs("label",{className:`${o.radioLabel} ${i.mode==="off"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"off",checked:i.mode==="off",onChange:()=>S("off")}),n("uiStudio.cleanup.policy.modeOff","사용 안 함 (off)")]})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.modeAge.tooltip","Automatically delete data older than the configured number of days."),children:e.jsxs("label",{className:`${o.radioLabel} ${i.mode==="age"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"age",checked:i.mode==="age",onChange:()=>S("age")}),n("uiStudio.cleanup.policy.modeAge","기간 기반 (age)")]})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.modeSize.tooltip","When total usage exceeds the limit, the oldest data is removed first."),children:e.jsxs("label",{className:`${o.radioLabel} ${i.mode==="size"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"size",checked:i.mode==="size",onChange:()=>S("size")}),n("uiStudio.cleanup.policy.modeSize","용량 기반 (size)")]})})]}),i.mode==="age"&&e.jsxs("div",{className:o.presetGroup,children:[[7,14,30,90].map(h=>e.jsx(m,{text:n("uiStudio.cleanup.policy.agePreset.tooltip","Delete data older than this many days."),children:e.jsxs("button",{type:"button",className:`${o.presetBtn} ${i.ageDays===h&&p===""?o.presetBtnActive:""}`,onClick:()=>B(h),children:[h,n("uiStudio.cleanup.policy.daysUnit","일")]})},h)),e.jsx(m,{text:n("uiStudio.cleanup.policy.ageInput.tooltip","Enter any value between 1 and 365 days."),children:e.jsx("label",{className:o.freeInputHitArea,children:e.jsx("input",{type:"number",className:`${o.freeInput} ${K?o.inputError:""}`,value:p,min:1,max:365,onChange:h=>F(h.target.value)})})}),e.jsxs("span",{className:o.inputUnit,children:["1–365",n("uiStudio.cleanup.policy.daysUnit","일")]})]}),i.mode==="size"&&e.jsxs("div",{className:o.presetGroup,children:[[100,500,1e3].map(h=>e.jsx(m,{text:n("uiStudio.cleanup.policy.sizePreset.tooltip","Keep total usage under this size."),children:e.jsxs("button",{type:"button",className:`${o.presetBtn} ${i.sizeMb===h&&v===""?o.presetBtnActive:""}`,onClick:()=>U(h),children:[h,n("uiStudio.cleanup.policy.mbUnit","MB")]})},h)),e.jsx(m,{text:n("uiStudio.cleanup.policy.sizeInput.tooltip","Enter any value between 50 MB and 10000 MB (10 GB)."),children:e.jsx("label",{className:o.freeInputHitArea,children:e.jsx("input",{type:"number",className:`${o.freeInput} ${q?o.inputError:""}`,value:v,min:50,max:1e4,onChange:h=>c(h.target.value)})})}),e.jsxs("span",{className:o.inputUnit,children:["50–10000",n("uiStudio.cleanup.policy.mbUnit","MB")]})]}),e.jsx(m,{text:n("uiStudio.cleanup.policy.cascade.tooltip","Also delete the capture images linked to those records. If off, the images stay."),children:e.jsxs("label",{className:o.cascadeRow,children:[e.jsx(be,{checked:i.cascadeSnapshots,onChange:h=>g(M=>({...M,cascadeSnapshots:h.target.checked}))}),n("uiStudio.cleanup.policy.cascade","연결된 화면 캡처도 함께 삭제")]})}),e.jsxs("div",{className:o.retentionActions,children:[e.jsx(m,{text:n("uiStudio.cleanup.policy.save.tooltip","Save the current cleanup rule. It runs in the background from then on."),children:e.jsx("button",{type:"button",className:o.saveBtn,onClick:()=>void T(),disabled:!E,children:n("uiStudio.cleanup.policy.save","정책 저장")})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.runNow.tooltip","저장된 정리 정책을 다음 자동 실행까지 기다리지 않고 지금 한 번 실행합니다."),children:e.jsx("button",{type:"button",className:o.runNowBtn,onClick:()=>void u(),disabled:y,children:n("uiStudio.cleanup.policy.runNow","저장된 정책으로 정리")})})]}),L&&e.jsx("div",{className:o.errorMsg,children:L})]})]}),x&&P&&e.jsx(de,{title:n("uiStudio.cleanup.policy.confirm.title","정책 적용 확인"),message:C,danger:!0,confirmLabel:n("uiStudio.cleanup.policy.save","정책 저장"),busy:D,onConfirm:W,onClose:()=>f(!1)})]})}function gt({placeId:t,tier:s,onChanged:l,sampleUsage:d,sampleRetention:n,embedded:b=!1}){const{t:i}=X(),g=s==="basic"&&d!=null&&n!=null,[p,_]=r.useState(g?d:null),[v,k]=r.useState(g?n:null),[P,z]=r.useState(null),[x,f]=r.useState(null),[D,w]=r.useState(null),y=r.useCallback(async()=>{if(!g&&t!=null){z(null);try{const[S,B]=await Promise.all([pe(t),ue(t)]);_(S),k(B.policy)}catch(S){z(S.message)}}},[t,g]);r.useEffect(()=>{y()},[y]);const H=r.useCallback(()=>{y(),l==null||l()},[y,l]),L=r.useCallback(async()=>{if(x&&t!=null){w(null);try{x.kind==="keep7"?await se(t,{olderThanDays:7,alsoSnapshots:!0}):x.kind==="keep30"?await se(t,{olderThanDays:30,alsoSnapshots:!0}):await se(t,{all:!0,alsoSnapshots:!0}),f(null),y(),l==null||l()}catch(S){throw w(S.message),S}}},[x,t,y,l]);function A(S){const B=i("uiStudio.cleanup.studioPreservedNote","This deletes saved change records and screenshots on disk only; Roblox Studio instances are not affected.");return S.kind==="keep7"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep7","7일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`:S.kind==="keep30"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep30","30일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`:`${((p==null?void 0:p.requestCount)??0)+((p==null?void 0:p.snapshotCount)??0)}${i("uiStudio.cleanup.cleanupConfirmMessage.all","개의 저장된 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`}if(t==null&&!g)return null;if(P)return e.jsx("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:e.jsx("p",{className:o.errorMsg,children:P})});if(!p||!v)return e.jsx("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:0},children:i("uiStudio.storage.loading","로딩 중...")})});const $=v.lastRunAt,N=v.lastRunStats,j=$?new Date($).toLocaleString():null,E=t??0;return e.jsxs("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:[!b&&e.jsx("h3",{className:o.cardTitle,children:e.jsx(R,{label:i("uiStudio.storage.title","UI Studio 저장 데이터"),tooltip:i("uiStudio.storage.title.tooltip","Disk usage of UI Studio change records and screenshots.")})}),e.jsxs("div",{className:o.storageConsoleGrid,"data-testid":"ui-studio-storage-console-grid",children:[e.jsx("section",{className:o.storageUsageColumn,children:e.jsxs("div",{className:o.usageRow,children:[e.jsx(m,{text:i("uiStudio.storage.usageLabel.tooltip","Disk space currently used by UI Studio for this project."),children:e.jsxs("div",{className:o.usageTotal,children:[i("uiStudio.storage.usageLabel","사용 중")," ",Y(p.totalBytes)]})}),e.jsxs("div",{className:o.usageBreakdown,children:[e.jsx(m,{text:i("uiStudio.storage.historyBytes.tooltip","Space taken by change record data (JSON)."),children:e.jsxs("span",{children:[i("uiStudio.storage.historyBytes","변경 이력")," ",Y(p.historyBytes)]})})," · ",e.jsx(m,{text:i("uiStudio.storage.snapshotBytes.tooltip","Space taken by captured PNG image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotBytes","화면 캡처")," ",Y(p.snapshotBytes)]})})]}),e.jsxs("div",{className:o.usageCounts,children:[e.jsx(m,{text:i("uiStudio.storage.requestCount.tooltip","Number of actions where AI changed the UI."),children:e.jsxs("span",{children:[i("uiStudio.storage.requestCount","변경 기록")," ",p.requestCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(m,{text:i("uiStudio.storage.mutationCount.tooltip","Number of detail changes inside actions (one property edit = 1)."),children:e.jsxs("span",{children:[i("uiStudio.storage.mutationCount","변경 상세")," ",p.mutationCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(m,{text:i("uiStudio.storage.snapshotCount.tooltip","Number of saved capture image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotCount","화면 캡처")," ",p.snapshotCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})]})]})}),e.jsx("section",{className:o.storagePolicyColumn,children:e.jsx(pt,{placeId:E,tier:s,currentPolicy:v,onSaved:H})})]}),e.jsxs("div",{className:o.storageFooter,"data-testid":"ui-studio-storage-footer",children:[e.jsxs("div",{className:o.lastRunRow,children:[e.jsx("span",{className:o.lastRunLabel,children:e.jsx(R,{label:i("uiStudio.storage.lastRun","마지막 자동 정리"),tooltip:i("uiStudio.storage.lastRun.tooltip","When the auto-cleanup policy last ran, and what it removed.")})}),j?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:j}),N&&e.jsxs("span",{children:["· ",i("uiStudio.storage.requestCount","변경 기록")," ",N.removedRequests,i("uiStudio.storage.countSuffix","개")," / ",i("uiStudio.storage.snapshotCount","화면 캡처")," ",N.removedSnapshots,i("uiStudio.storage.countSuffix","개")," / ",Y(N.freedBytes)," ",i("uiStudio.storage.lastRunFreed","회수")]}),N&&N.errors>0&&e.jsxs("span",{className:o.errorIcon,title:`${i("uiStudio.storage.lastRunErrors","오류")} ${N.errors}건`,children:["⚠",e.jsxs("span",{className:o.tooltip,children:[i("uiStudio.storage.lastRunErrors","오류")," ",N.errors,i("uiStudio.storage.countSuffix","건")]})]})]}):e.jsx("span",{children:i("uiStudio.storage.lastRunNever","—")})]}),e.jsxs("div",{className:o.cleanupRow,children:[e.jsx("span",{className:o.cleanupLabel,children:e.jsx(R,{label:i("uiStudio.cleanup.label","수동 정리"),tooltip:i("uiStudio.cleanup.label.tooltip","Manually clean up change records and captures whenever you want.")})}),e.jsx(m,{text:i("uiStudio.cleanup.keep7.tooltip","Delete change records and captures older than 7 days."),children:e.jsx("button",{type:"button",className:o.cleanupBtn,onClick:()=>f({kind:"keep7"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 7일만 남기기").replace("{n}","7")})}),e.jsx(m,{text:i("uiStudio.cleanup.keep30.tooltip","Delete change records and captures older than 30 days."),children:e.jsx("button",{type:"button",className:o.cleanupBtn,onClick:()=>f({kind:"keep30"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 30일만 남기기").replace("{n}","30")})}),!b&&e.jsx(m,{text:i("uiStudio.cleanup.deleteAll.tooltip","Delete every change record and capture for this project. The actual UI in Roblox Studio is not affected."),children:e.jsx("button",{type:"button",className:`${o.cleanupBtn} ${o.cleanupBtnDanger}`,onClick:()=>f({kind:"all"}),disabled:s==="basic",children:i("uiStudio.cleanup.deleteAll","전체 삭제…")})})]})]}),D&&e.jsx("div",{className:o.errorMsg,children:D}),x&&e.jsx(de,{title:i("uiStudio.cleanup.cleanupConfirmTitle","정리 확인"),message:A(x),danger:!0,confirmLabel:i("common.delete","삭제"),onConfirm:L,onClose:()=>{f(null),w(null)}})]})}function ne(t,s){const l={placeId:String(t)};return s&&(l["preview.mode"]=s.mode,s.mode==="size"&&(l["preview.sizeMb"]=String(s.sizeMb))),I.get("/api/dashboard/changelog/cleanup",l)}function oe(t){return I.put("/api/dashboard/changelog/cleanup",t)}function ht(t){return I.post(`/api/dashboard/changelog/cleanup/run?placeId=${encodeURIComponent(t)}`)}const mt=[100,500,1e3];function re(t,s){return t.mode!==s.mode?!1:t.mode==="off"||s.mode==="size"&&t.sizeMb===s.sizeMb}function yt(t,s){return t.mode==="off"?!1:s.mode==="off"||t.sizeMb<s.sizeMb}function J(t){return t<1e3?`${t} B`:t<1e6?`${(t/1e3).toFixed(1)} KB`:t<1e9?`${(t/1e6).toFixed(1)} MB`:`${(t/1e9).toFixed(2)} GB`}function jt({placeId:t,onChanged:s}){const{locale:l,t:d}=X(),[n,b]=r.useState(null),[i,g]=r.useState({mode:"size",sizeMb:500}),[p,_]=r.useState(t!==null),[v,k]=r.useState(!1),[P,z]=r.useState(!1),[x,f]=r.useState(!1),[D,w]=r.useState(!1),[y,H]=r.useState(null),L=r.useCallback(async()=>{if(t===null){b(null),_(!1);return}z(!1);try{const u=await ne(t);b(u),g(u.policy)}catch{z(!0)}finally{_(!1)}},[t]);r.useEffect(()=>{_(t!==null),L()},[L,t]);const A=r.useCallback(async u=>{k(!0),f(!1),w(!1);try{await oe(u),H(null),await L(),w(!0),s==null||s()}catch{f(!0)}finally{k(!1)}},[L,s]),$=r.useCallback(async()=>{if(!(!n||t===null||re(i,n.policy))){k(!0),f(!1),w(!1);try{if(yt(i,n.policy)){const u=await ne(t,i);if(u.preview.affectedPlaceCount>0){H({policy:i,preview:u});return}}await oe(i),await L(),w(!0),s==null||s()}catch{f(!0)}finally{k(!1)}}},[n,i,L,s,t]),N=r.useCallback(async()=>{if(t!==null){k(!0),f(!1),w(!1);try{await ht(t),await L(),s==null||s()}catch{f(!0)}finally{k(!1)}}},[L,s,t]),j=n==null?void 0:n.selectedPlace.currentUsage,E=(n==null?void 0:n.policy.mode)==="size"?n.policy.sizeMb*1e6:null,S=E??Math.max((j==null?void 0:j.bytes)??0,1),B=Math.min(100,((j==null?void 0:j.sessionBytes)??0)/S*100),U=Math.min(Math.max(0,100-B),((j==null?void 0:j.contextBytes)??0)/S*100),F=n?!re(i,n.policy):!1,c=u=>u.mode==="off"?d("settings.projectChanges.cleanup.unlimited","Unlimited"):`${u.sizeMb} MB`,T=r.useMemo(()=>{if(!y)return"";const u=y.preview.preview,C=d("settings.projectChanges.cleanup.confirm.message","{places} Places · {sessions} sessions · {bytes} expected to be freed.").replace("{places}",u.affectedPlaceCount.toLocaleString()).replace("{sessions}",u.deleteSessionCount.toLocaleString()).replace("{bytes}",J(u.estimatedFreedBytes));return u.wouldRemainOverLimitPlaceCount===0?C:`${C} ${d("settings.projectChanges.cleanup.confirm.protected","{places} Place may remain over the limit because active data is protected.").replace("{places}",u.wouldRemainOverLimitPlaceCount.toLocaleString())}`},[y,d]);if(t===null)return e.jsx("div",{className:a.projectChangesPanel,children:e.jsx("p",{className:a.projectChangesEmpty,children:d("settings.projectChanges.cleanup.noPlace","Select a Place to manage saved project changes.")})});if(p)return e.jsx("div",{className:a.projectChangesPanel,children:e.jsx("p",{className:a.projectChangesEmpty,children:d("settings.projectChanges.cleanup.loading","Loading storage settings…")})});if(P||!n||!j)return e.jsxs("div",{className:a.projectChangesPanel,children:[e.jsx("p",{className:a.projectChangesError,role:"alert",children:d("settings.projectChanges.cleanup.loadFailed","Could not load storage settings.")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",onClick:()=>{_(!0),L()},children:d("common.retry","Retry")})]});const W=E===null?d("settings.projectChanges.cleanup.usageUnlimited","{used} used · Unlimited").replace("{used}",J(j.bytes)):d("settings.projectChanges.cleanup.usageLimited","{used} used of {limit}").replace("{used}",J(j.bytes)).replace("{limit}",c(n.policy));return e.jsxs("div",{className:a.projectChangesPanel,children:[e.jsxs("div",{className:a.projectChangesConsoleGrid,"data-testid":"project-storage-console-grid",children:[e.jsxs("section",{className:a.projectChangesUsageColumn,children:[e.jsx("h3",{className:a.projectChangesPanelTitle,children:e.jsx(R,{label:d("settings.projectChanges.cleanup.title","Storage management"),tooltip:d("settings.projectChanges.cleanup.title.tooltip","Set how much Project Change Summary history each Place can keep.")})}),e.jsxs("div",{className:a.projectChangesUsageBlock,children:[e.jsx("div",{className:a.projectChangesUsageSummary,children:W}),e.jsxs("div",{className:a.projectChangesQuotaRail,role:"meter","aria-label":d("settings.projectChanges.cleanup.usageAria","Place storage usage"),"aria-valuemin":0,"aria-valuenow":j.bytes,"aria-valuemax":E??j.bytes,children:[e.jsx("span",{className:a.projectChangesSessionRail,style:{width:`${B}%`}}),e.jsx("span",{className:a.projectChangesContextRail,style:{width:`${U}%`}})]}),e.jsxs("div",{className:a.projectChangesUsageLegend,children:[e.jsxs("span",{children:[d("settings.projectChanges.cleanup.sessions","Sessions")," ",e.jsx("strong",{children:J(j.sessionBytes)})]}),e.jsxs("span",{children:[d("settings.projectChanges.cleanup.contexts","Contexts")," ",e.jsx("strong",{children:J(j.contextBytes)})]})]})]})]}),e.jsxs("section",{className:a.projectChangesPolicyColumn,children:[e.jsx("p",{className:a.projectChangesScope,children:d("settings.projectChanges.cleanup.scope","One setting applies the selected limit separately to every Place.")}),e.jsxs("fieldset",{className:a.projectChangesPolicyFieldset,disabled:v,children:[e.jsx("legend",{className:a.projectChangesPolicyLegend,children:d("settings.projectChanges.cleanup.limit","Limit per Place")}),e.jsxs("div",{className:a.projectChangesPresetGroup,children:[mt.map(u=>{const C=i.mode==="size"&&i.sizeMb===u;return e.jsx("button",{className:`${a.projectChangesPresetButton} ${C?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":C,onClick:()=>g({mode:"size",sizeMb:u}),children:d("settings.projectChanges.cleanup.preset","{sizeMb}MB").replace("{sizeMb}",String(u))},u)}),e.jsx("button",{className:`${a.projectChangesPresetButton} ${i.mode==="off"?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":i.mode==="off",onClick:()=>g({mode:"off"}),children:d("settings.projectChanges.cleanup.unlimited","Unlimited")})]})]}),e.jsxs("div",{className:a.projectChangesActions,children:[e.jsx("button",{className:a.projectChangesSaveButton,type:"button",disabled:!F||v,onClick:()=>void $(),children:d("common.save","Save")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",disabled:v,onClick:()=>void N(),children:d("settings.projectChanges.cleanup.runNow","Run saved policy")}),D&&e.jsx("span",{className:a.projectChangesSaved,role:"status",children:d("settings.projectChanges.cleanup.saved","Saved")})]})]})]}),n.selectedPlace.dryRun.wouldRemainOverLimit&&e.jsx("p",{className:a.projectChangesWarning,children:d("settings.projectChanges.cleanup.protectedWarning","Active changes are protected, so this Place may stay over the limit.")}),e.jsxs("div",{className:a.projectChangesLastRun,"data-testid":"project-storage-footer",children:[e.jsx("span",{className:a.projectChangesLastRunLabel,children:d("settings.projectChanges.cleanup.lastRun","Last cleanup")}),n.selectedPlace.lastRun?e.jsxs("span",{children:[new Date(n.selectedPlace.lastRun.ranAt).toLocaleString(l)," · ",d("settings.projectChanges.cleanup.lastRunSummary","{sessions} sessions · {bytes} freed").replace("{sessions}",n.selectedPlace.lastRun.deletedSessionCount.toLocaleString()).replace("{bytes}",J(n.selectedPlace.lastRun.freedBytes))]}):e.jsx("span",{children:d("settings.projectChanges.cleanup.neverRun","Not run yet")})]}),x&&e.jsx("p",{className:a.projectChangesError,role:"alert",children:d("settings.projectChanges.cleanup.actionFailed","Could not update storage settings.")}),e.jsx(ce,{open:y!==null,title:d("settings.projectChanges.cleanup.confirm.title","Apply this limit and clean saved changes?"),message:T,cancelLabel:d("common.cancel","Cancel"),confirmLabel:d("settings.projectChanges.cleanup.confirm.apply","Apply and clean"),loading:v,onCancel:()=>!v&&H(null),onConfirm:()=>{y&&A(y.policy)}})]})}const xt={toolsActivity:null,toolStats:null,toolSessions:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null},ft={toolsActivity:null,toolStats:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null};function bt(t){var s;return t?t.pluginConnected?t.activePlaceId:t.lastActivePlaceId??((s=t.places[0])==null?void 0:s.placeId)??null:null}async function G(t){try{return await t}catch{return null}}function ee(t){return t?typeof t.total=="number"?t.total:Array.isArray(t.entries)?t.entries.length:null:null}function te(t,s,l,d){return s===null?t("settings.dataHistory.metric.unavailable","Unavailable"):`${s.toLocaleString()} ${t(l,d)}`}function Q(t,s,l){const d=l===null?t("settings.dataHistory.metric.sizeUnavailable","size unavailable"):Y(l);return`${s} · ${d}`}function Z(t,s){var d;const l=(d=t==null?void 0:t[s])==null?void 0:d.bytes;return typeof l=="number"&&Number.isFinite(l)?l:null}function vt(t,s){return s?[`${s.requestCount.toLocaleString()} ${t("uiStudio.storage.requestCount","change records")}`,`${s.snapshotCount.toLocaleString()} ${t("uiStudio.storage.snapshotCount","screenshots")}`,Y(s.totalBytes)].join(" · "):t("settings.dataHistory.metric.unavailable","Unavailable")}function St({tier:t}){const{t:s}=X(),[l,d]=r.useState(xt),[n,b]=r.useState(ft),[i,g]=r.useState(t==="basic"?ae:null),[p,_]=r.useState(null),[v,k]=r.useState(!0),[P,z]=r.useState(!0),[x,f]=r.useState(null),[D,w]=r.useState(()=>new Set),[y,H]=r.useState(null),[L,A]=r.useState(!1),[$,N]=r.useState(null),j=r.useCallback(async()=>{k(!0);const u=await G(me()),C=bt(u);_(C);const[K,q,h,M,O,ge,V]=await Promise.all([G(I.get("/api/dashboard/history",{limit:"1",offset:"0"})),G(I.get("/api/dashboard/tool-stats")),G(I.get("/sync/history",{limit:"1",offset:"0"})),G(I.get("/api/dashboard/playtest/history")),G(I.get("/api/dashboard/changelog",{limit:"1",offset:"0"})),G(I.get("/api/dashboard/connection-log")),G(I.get("/api/dashboard/storage-summary"))]),he=t==="basic"?ae:C===null?null:await G(pe(C));d({toolsActivity:ee(K),toolStats:(q==null?void 0:q.totalCalls)??null,toolSessions:(q==null?void 0:q.totalSessions)??null,syncLog:ee(h),playtestReports:ee(M),projectChanges:ee(O),connectionLog:ee(ge)}),b({toolsActivity:Z(V,"toolsActivity"),toolStats:Z(V,"toolStats"),syncLog:Z(V,"syncLog"),playtestReports:Z(V,"playtestReports"),projectChanges:Z(V,"projectChanges"),connectionLog:Z(V,"connectionLog")}),g(he),k(!1)},[t]);r.useEffect(()=>{j()},[j]);const E=r.useCallback(u=>{w(C=>{if(C.has(u))return C;const K=new Set(C);return K.add(u),K}),f(C=>C===u?null:u)},[]),S=r.useMemo(()=>[{key:"toolsActivity",title:s("settings.dataHistory.toolsActivity.title","Tool activity"),description:s("settings.dataHistory.toolsActivity.description","Saved tool runs shown on the Tools page."),metric:Q(s,te(s,l.toolsActivity,"settings.dataHistory.metric.records","records"),n.toolsActivity),metricTooltip:s("settings.dataHistory.toolsActivity.metric.tooltip","Number of saved tool runs and the disk space they use."),route:"/tools",clearEndpoint:"/api/dashboard/tools/history/clear"},{key:"toolStats",title:s("settings.dataHistory.toolStats.title","Tool usage statistics"),description:s("settings.dataHistory.toolStats.description","Aggregated tool counts and status totals."),metric:Q(s,l.toolStats===null?s("settings.dataHistory.metric.unavailable","Unavailable"):`${l.toolStats.toLocaleString()} ${s("settings.dataHistory.metric.runs","runs")} · ${(l.toolSessions??0).toLocaleString()} ${s("settings.dataHistory.metric.sessions","sessions")}`,n.toolStats),metricTooltip:s("settings.dataHistory.toolStats.metric.tooltip","Aggregated total runs and session counts."),route:"/tools",clearEndpoint:"/api/dashboard/tools/statistics/clear"},{key:"syncLog",title:s("settings.dataHistory.syncLog.title","Sync log"),description:s("settings.dataHistory.syncLog.description","Saved file sync events for the active place."),metric:Q(s,te(s,l.syncLog,"settings.dataHistory.metric.records","records"),n.syncLog),metricTooltip:s("settings.dataHistory.syncLog.metric.tooltip","Number of saved sync events and the disk space they use."),route:"/sync",clearEndpoint:"/api/dashboard/sync/history/clear"},{key:"playtestReports",title:s("settings.dataHistory.playtest.title","Playtest reports"),description:s("settings.dataHistory.playtest.description","Saved automated playtest reports and logs."),metric:Q(s,te(s,l.playtestReports,"settings.dataHistory.metric.reports","reports"),n.playtestReports),metricTooltip:s("settings.dataHistory.playtestReports.metric.tooltip","Number of saved playtest reports and the disk space they use."),route:"/playtest",clearEndpoint:"/api/dashboard/playtest/history/clear"},{key:"projectChanges",title:s("settings.dataHistory.projectChanges.title","Project change summary"),description:s("settings.dataHistory.projectChanges.description","Saved summaries of project changes."),metric:Q(s,te(s,l.projectChanges,"settings.dataHistory.metric.records","records"),n.projectChanges),metricTooltip:s("settings.dataHistory.projectChanges.metric.tooltip","Number of saved project change summaries and the disk space they use."),route:"/changelog",clearEndpoint:"/api/dashboard/changelog/clear"},{key:"connectionLog",title:s("settings.dataHistory.connectionLog.title","Connection log"),description:s("settings.dataHistory.connectionLog.description","Saved MCP and Studio connection events."),metric:Q(s,te(s,l.connectionLog,"settings.dataHistory.metric.records","records"),n.connectionLog),metricTooltip:s("settings.dataHistory.connectionLog.metric.tooltip","Number of saved connection events and the disk space they use."),route:"/connection",clearEndpoint:"/api/dashboard/connection-log/clear"}],[l,n,s]),B=async()=>{if(y){A(!0),N(null);try{if(y.kind==="uiStudio"){if(t!=="pro"||p===null)throw new Error("UI Studio place is unavailable");await se(p,{all:!0,alsoSnapshots:!0}),N(s("settings.dataHistory.uiStudio.clear.success","UI Studio saved data cleared."))}else{const u=y.row.key==="projectChanges";if(u&&p===null)throw new Error("Project changes place is unavailable");let C=y.row.clearEndpoint;u&&p!==null&&(C=`${C}?placeId=${encodeURIComponent(p)}`),await I.post(C),N(u?s("settings.dataHistory.projectChanges.clear.success","Project change summaries cleared."):s("settings.dataHistory.clear.success","Saved data cleared."))}H(null),await j()}catch{N(y.kind==="uiStudio"?s("settings.dataHistory.uiStudio.clear.failed","Failed to clear UI Studio saved data."):s("settings.dataHistory.clear.failed","Failed to clear saved data."))}finally{A(!1)}}},U=t==="pro"?p:0,F=t==="pro"&&p!==null,c=(y==null?void 0:y.kind)==="uiStudio",T=(y==null?void 0:y.kind)==="row"&&y.row.key==="projectChanges",W=s("settings.dataHistory.title","Data & History");return e.jsxs(e.Fragment,{children:[e.jsxs("section",{id:"data-history",className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:s("settings.dataHistory.title","Data & History"),tooltip:s("settings.dataHistory.title.tooltip","Manage saved dashboard data in one place.")}),e.jsxs("div",{className:a.cardHeaderActions,children:[e.jsx(m,{text:s("settings.dataHistory.scope.tooltip","Clear actions apply to the current project and active place where applicable."),children:e.jsx("span",{className:a.headerBadge,children:v?s("common.loading","Loading"):s("settings.dataHistory.scope","Current project")})}),e.jsx(m,{text:s("settings.dataHistory.toggle.tooltip","Collapse or expand this section."),children:e.jsx("button",{className:a.collapseButton,type:"button","aria-expanded":P,"aria-controls":"settings-data-history-body","aria-label":P?s("settings.dataHistory.collapse","Collapse {title}").replace("{title}",W):s("settings.dataHistory.expand","Expand {title}").replace("{title}",W),onClick:()=>z(u=>!u),children:P?"▾":"▸"})})]})]}),P&&e.jsxs("div",{id:"settings-data-history-body",children:[e.jsx("p",{className:a.dataHistoryIntro,children:s("settings.dataHistory.intro","Review saved dashboard data, open the related page, or clear stored records from one place.")}),e.jsxs("div",{className:a.dataHistoryList,children:[S.map(u=>e.jsxs(r.Fragment,{children:[e.jsxs("div",{className:`${a.dataHistoryRow} ${u.key==="projectChanges"&&x==="projectChanges"?a.dataHistoryRowExpanded:""}`,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:u.title}),e.jsx("div",{className:a.dataHistoryDescription,children:u.description})]}),e.jsx(m,{text:u.metricTooltip,children:e.jsx("div",{className:a.dataHistoryMetric,children:u.metric})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(m,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:`#${u.route}`,children:s("settings.dataHistory.open","Open")})}),u.key==="projectChanges"&&e.jsx(m,{text:s("settings.dataHistory.manageStorage.tooltip","Show or hide storage policy and cleanup controls."),children:e.jsxs("button",{className:a.manageStorageButton,type:"button","aria-expanded":x==="projectChanges","aria-controls":"settings-project-changes-storage","aria-label":s("settings.dataHistory.manageStorage.projectChanges.aria","Manage Project change summary storage"),onClick:()=>E("projectChanges"),children:[s("settings.dataHistory.manageStorage","Manage storage"),e.jsx("span",{"aria-hidden":"true",children:x==="projectChanges"?"▴":"▾"})]})}),e.jsx(m,{text:s("settings.dataHistory.clear.tooltip","Delete only the records saved for this item. Roblox Studio data is not changed."),children:e.jsx("button",{className:a.dangerButton,type:"button",disabled:u.key==="projectChanges"&&p===null,onClick:()=>H({kind:"row",row:u}),children:u.key==="projectChanges"?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear")})})]})]}),u.key==="projectChanges"&&D.has("projectChanges")&&e.jsx("div",{id:"settings-project-changes-storage",className:`${a.dataHistoryDetail} ${a.projectChangesDataHistoryDetail}`,hidden:x!=="projectChanges",children:e.jsx(jt,{placeId:p,onChanged:j})})]},u.key)),e.jsxs("div",{className:`${a.dataHistoryRow} ${x==="uiStudio"?a.dataHistoryRowExpanded:""}`,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:s("settings.dataHistory.uiStudio.title","UI Studio history and screenshots")}),e.jsx("div",{className:a.dataHistoryDescription,children:s("settings.dataHistory.uiStudio.description","Saved UI Studio change records, screenshots, and cleanup policy.")})]}),e.jsx(m,{text:s("settings.dataHistory.uiStudio.metric.tooltip","UI Studio change record and capture counts, plus total disk usage."),children:e.jsx("div",{className:a.dataHistoryMetric,children:vt(s,i)})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(m,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:"#/ui-studio?tab=history",children:s("settings.dataHistory.open","Open")})}),e.jsx(m,{text:s("settings.dataHistory.manageStorage.tooltip","Show or hide storage policy and cleanup controls."),children:e.jsxs("button",{className:a.manageStorageButton,type:"button","aria-expanded":x==="uiStudio","aria-controls":"settings-ui-studio-storage","aria-label":s("settings.dataHistory.manageStorage.uiStudio.aria","Manage UI Studio history and screenshots storage"),onClick:()=>E("uiStudio"),children:[s("settings.dataHistory.manageStorage","Manage storage"),e.jsx("span",{"aria-hidden":"true",children:x==="uiStudio"?"▴":"▾"})]})}),e.jsx(m,{text:s("settings.dataHistory.clear.tooltip","Delete only the records saved for this item. Roblox Studio data is not changed."),children:e.jsx("button",{className:a.dangerButton,type:"button",disabled:!F,onClick:()=>H({kind:"uiStudio"}),children:s("settings.dataHistory.clearAll","Clear all")})})]})]}),D.has("uiStudio")&&e.jsx("div",{id:"settings-ui-studio-storage",className:`${a.dataHistoryDetail} ${a.uiStudioDataHistoryDetail}`,hidden:x!=="uiStudio",children:e.jsx(gt,{placeId:U,tier:t,onChanged:j,embedded:!0,...t==="basic"?{sampleUsage:ae,sampleRetention:_e}:{}})})]}),$&&e.jsx("p",{className:a.inlineStatus,children:$})]})]}),e.jsx(ce,{open:y!==null,title:c?s("settings.dataHistory.uiStudio.clear.title","Clear UI Studio saved data?"):T?s("settings.dataHistory.projectChanges.clear.title","Clear project change summaries?"):s("settings.dataHistory.clear.title","Clear saved data?"),message:c?s("settings.dataHistory.uiStudio.clear.message","This deletes saved UI Studio change records and screenshots only. Roblox Studio instances and project objects are not changed."):T?s("settings.dataHistory.projectChanges.clear.message","This deletes completed sessions and ended context history for the selected Place. Active work and Roblox Studio project data stay intact."):s("settings.dataHistory.clear.message","This deletes saved dashboard records only. Roblox Studio instances and project objects are not changed."),cancelLabel:s("common.cancel","Cancel"),confirmLabel:T||c?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear"),loading:L,onCancel:()=>!L&&H(null),onConfirm:()=>void B()})]})}const Ct=r.forwardRef(function({autoOpen:s,settingsFilePath:l,saving:d,targeted:n,updateDashboardPreferences:b},i){const{t:g}=X(),[p,_]=r.useState("idle"),v="settings-dashboard-auto-open-label",k=d||p==="saving",P=async x=>{_("saving");try{await b({autoOpen:x}),_("saved")}catch{_("error")}},z=p==="saving"?g("settings.dashboard.autoOpen.saving","Saving…"):p==="saved"?g("settings.dashboard.autoOpen.saved","Saved for the next server start."):p==="error"?g("settings.dashboard.autoOpen.error","Could not save. The previous setting was restored."):" ";return e.jsxs("div",{id:"settings-dashboard",ref:i,tabIndex:-1,"data-testid":"settings-dashboard-card",className:[a.card,a.dashboardCard,n?a.dashboardCardTarget:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:g("settings.dashboard.title","Dashboard"),tooltip:g("settings.dashboard.title.tooltip","Choose how WEPPY Dashboard behaves when the MCP Server starts.")}),e.jsx(m,{text:g("settings.dashboard.autoOpen.nextStart","Applies the next time the MCP Server starts."),children:e.jsx("span",{className:a.headerBadge,children:g("settings.dashboard.nextStartBadge","Next Start")})})]}),e.jsxs("div",{className:a.dashboardSettingRow,children:[e.jsxs("div",{className:a.dashboardSettingCopy,children:[e.jsx("span",{id:v,className:a.dashboardSettingLabel,children:g("settings.dashboard.autoOpen.label","Open Dashboard when WEPPY starts")}),e.jsx("span",{className:a.dashboardSettingDescription,children:g("settings.dashboard.autoOpen.description","Automatically opens this Dashboard after the MCP Server starts.")}),e.jsx("span",{className:a.dashboardSettingMeta,children:g("settings.dashboard.autoOpen.nextStart","Applies the next time the MCP Server starts.")})]}),e.jsxs("label",{className:`${a.toggleSwitch} ${a.dashboardToggleTarget}`,children:[e.jsx("input",{className:a.toggleInput,type:"checkbox",role:"switch","aria-labelledby":v,checked:s,disabled:k,onChange:x=>{P(x.target.checked)}}),e.jsx("span",{className:a.toggleTrack,"aria-hidden":"true",children:e.jsx("span",{className:a.toggleThumb})})]})]}),e.jsxs("dl",{className:a.dashboardDetails,children:[e.jsxs("div",{className:a.dashboardDetailRow,children:[e.jsx("dt",{children:g("settings.dashboard.settingsFile.label","Settings file")}),e.jsx("dd",{children:e.jsx("code",{className:a.dashboardSettingsFilePath,children:l})})]}),e.jsxs("div",{className:a.dashboardDetailRow,children:[e.jsx("dt",{children:g("settings.dashboard.agentExample.label","Ask your Agent")}),e.jsx("dd",{className:a.dashboardAgentPrompt,children:g("settings.dashboard.agentExample.prompt","“Turn off Dashboard auto-open.”")})]})]}),e.jsx("p",{className:`${a.dashboardSaveFeedback} ${p==="error"?a.dashboardSaveFeedbackError:""}`,"aria-live":"polite",children:z})]})}),Nt={en:"English",ko:"한국어",es:"Español","pt-br":"Português (BR)",ja:"日本語",id:"Bahasa Indonesia",de:"Deutsch","fr-fr":"Français"};function _t(t){return t==="active"?a.statusActive:t==="grace"?a.statusGrace:t==="invalid"||t==="revoked"?a.statusError:a.statusInactive}function kt(t){return t?t.refreshBlockedReason==="missing_session_token"?!0:t.status==="active"||t.status==="grace"||t.status==="invalid"||t.status==="revoked"||t.status==="unknown":!1}function Pt(t,s){return t.refreshBlockedReason==="missing_session_token"?{label:s("settings.license.status.activationRequired","Activation Required"),tooltip:s("settings.license.status.activationRequired.tooltip","Manual license activation is required before WEPPY Dashboard can refresh this status."),detail:s("settings.license.detail.missingSessionToken","Refresh is blocked because the current session token is missing."),detailTone:a.licenseNoticeWarning}:t.statusDetail==="active_cancel_pending"?{label:s("settings.license.active","Active"),tooltip:s("settings.license.status.activeCancelPending.tooltip","Cancellation is pending, but Pro access remains active until the current billing period ends."),detail:s("settings.license.detail.cancelPending","Cancellation is scheduled. Pro access remains active until the current billing period ends."),detailTone:a.licenseNoticeInfo}:t.statusDetail==="grace_provider_unavailable"?{label:s("settings.license.status.grace","Grace"),tooltip:s("settings.license.status.grace.tooltip","Provider verification is temporarily unavailable, but Pro access remains active during the grace period."),detail:s("settings.license.detail.graceProviderUnavailable","Provider unavailable. Pro access remains active during grace mode."),detailTone:a.licenseNoticeInfo}:t.statusDetail==="grace_expired"||t.statusDetail==="grace_payment_failed"?{label:s("settings.license.status.grace","Grace"),tooltip:s("settings.license.status.graceBilling.tooltip","Pro access is still available during a billing-related grace period."),detail:s("settings.license.detail.graceBilling","Pro access remains available during a billing grace period."),detailTone:a.licenseNoticeInfo}:{label:s(`settings.license.${t.status}`,t.status),tooltip:s(`settings.license.${t.status}.tooltip`,"Current license activation state."),detail:t.refreshRequired?s("settings.license.detail.refreshRecommended","License verification should be refreshed soon."):null,detailTone:a.licenseNoticeMuted}}function zt(){const{t,selectedLocale:s,setLocale:l}=X(),{trackEvent:d}=le(),{search:n}=ye(),{settings:b,license:i,licenseControlsDisabled:g,licenseSubmitting:p,licenseMessage:_,activateLicense:v,refreshLicense:k,resetLicense:P,saving:z,updateDashboardPreferences:x,loading:f}=Se(),[D,w]=r.useState(""),y=i?Pt(i,t):null,H=kt(i),L=H&&(i==null?void 0:i.refreshBlockedReason)!=="missing_session_token",A=H,$=H?i==null?void 0:i.maskedKey:void 0,N=i!=null&&i.provider&&i.provider!=="auto"?i.provider:void 0,j=(i==null?void 0:i.tier)==="pro"?"pro":"basic",E=r.useRef(null),S=r.useRef(null),B=r.useRef(null),U=r.useMemo(()=>new URLSearchParams(n).get("section")==="license",[n]),F=r.useMemo(()=>new URLSearchParams(n).get("section")==="dashboard",[n]);return r.useEffect(()=>{var T;if(!U||f)return;const c=E.current;if((T=c==null?void 0:c.scrollIntoView)==null||T.call(c,{block:"start",behavior:"smooth"}),B.current&&!B.current.disabled){B.current.focus();return}c==null||c.focus()},[f,g,p,U]),r.useEffect(()=>{var T;if(!F||f)return;const c=S.current;(T=c==null?void 0:c.scrollIntoView)==null||T.call(c,{block:"start",behavior:"smooth"}),c==null||c.focus()},[f,F]),f?e.jsx("div",{className:a.page,children:e.jsx("div",{className:a.loading,children:t("common.loading")})}):e.jsxs("div",{className:a.page,children:[e.jsx(ve,{title:t("page.settings.title","Settings"),description:t("page.settings.description","Manage license, saved data, server environment, and language."),helpTopicId:"settings",helpState:{tier:j}}),e.jsxs("div",{id:"settings-license",ref:E,tabIndex:-1,"data-testid":"settings-license-card",className:[a.card,U?a.licenseCardTarget:"",(i==null?void 0:i.tier)==="pro"?a.licenseCardPro:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:t("settings.license.title","License"),tooltip:t("settings.license.title.tooltip","Current license status and subscription tier.")}),e.jsx(m,{text:g?t("settings.license.disconnected.tooltip","Reconnect to the MCP server to manage license actions from WEPPY Dashboard."):t("settings.license.live.tooltip","License actions are sent to the MCP server immediately."),children:e.jsx("span",{className:`${a.headerBadge} ${g?"":a.headerBadgeLive}`,children:g?t("settings.license.disconnected","Disconnected"):t("settings.general.liveApply","Live Apply")})})]}),e.jsxs(e.Fragment,{children:[i?e.jsxs(e.Fragment,{children:[(()=>{const c=y;return e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.licenseGrid,children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.status","Status"),tooltip:t("settings.license.status.tooltip","Current license activation state.")})}),e.jsxs("dd",{children:[e.jsx("span",{className:`${a.statusDot} ${_t(i.status)}`}),e.jsx(m,{text:(c==null?void 0:c.tooltip)??t(`settings.license.${i.status}.tooltip`,"Current license activation state."),children:(c==null?void 0:c.label)??t(`settings.license.${i.status}`,i.status)})]}),e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.tier","Tier"),tooltip:t("settings.license.tier.tooltip","Current subscription tier for available WEPPY Dashboard features.")})}),e.jsx("dd",{className:i.tier==="pro"?a.proBadge:"",children:e.jsx(m,{text:t(`tier.${i.tier}.tooltip`,"Available feature set for the connected license."),children:i.tier==="pro"?t("tier.pro","Pro"):t("tier.basic","Basic")})}),$&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.key","Key"),tooltip:t("settings.license.key.tooltip","Masked license key currently loaded by the server.")})}),e.jsx("dd",{children:e.jsx(m,{text:t("settings.license.keyValue.tooltip","Masked license key currently loaded by the server."),children:$})})]}),N&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.provider","Provider"),tooltip:t("settings.license.provider.tooltip","License provider used to validate this key.")})}),e.jsx("dd",{children:e.jsx(m,{text:t("settings.license.providerValue.tooltip","License provider used to validate this key."),children:N})})]})]}),(c==null?void 0:c.detail)&&e.jsx("p",{className:`${a.licenseNotice} ${c.detailTone}`,children:i.refreshBlockedReason==="missing_session_token"?t("settings.license.detail.manualActivation","Manual activation required to restore Pro access."):c.detail}),i.refreshBlockedReason==="missing_session_token"&&e.jsx("p",{className:`${a.licenseNotice} ${a.licenseNoticeMuted}`,children:c==null?void 0:c.detail})]})})(),i.tier==="basic"&&e.jsx(m,{text:t("tier.upgrade.tooltip","View Pro features and purchase options."),children:e.jsx("a",{className:a.upgradeLink,href:je.settingsLicense,target:"_blank",rel:"noopener noreferrer",onClick:()=>d("dashboard_click_event",{click_target:"upgrade_cta",placement:"settings_license",page:"settings"}),children:t("tier.upgrade","View Pro")})})]}):e.jsx("div",{className:a.loading,children:t("settings.license.unavailable")}),e.jsxs("div",{className:a.licenseControls,children:[e.jsxs("div",{className:a.licenseControlRow,children:[e.jsx(m,{text:t("settings.license.refresh.tooltip","Re-fetch the current state from the license server. Useful when a billing change hasn't appeared yet."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p||!L,onClick:()=>{k()},children:p?t("common.loading"):t("settings.license.refresh","Refresh License")})}),e.jsx(m,{text:t("settings.license.reset.tooltip","Remove the currently registered license key. Use this before activating with a different key."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p||!A,onClick:()=>{P()},children:p?t("common.loading"):t("settings.license.reset","Reset License")})})]}),e.jsxs("div",{className:a.licenseControlRow,children:[e.jsxs("label",{className:`${a.licenseField} ${a.licenseFieldGrow}`,children:[e.jsx("span",{className:a.controlLabel,children:e.jsx(R,{label:t("settings.license.keyInput","License Key"),tooltip:t("settings.license.key.tooltip","Masked license key currently loaded by the server.")})}),e.jsx("input",{ref:B,"aria-label":t("settings.license.keyInput","License Key"),className:a.textInput,type:"text",value:D,disabled:g||p,onChange:c=>w(c.target.value)})]}),e.jsx(m,{text:t("settings.license.activate.tooltip","Activate Pro features with the entered license key."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p,onClick:()=>{(async()=>await v(D)&&w(""))()},children:p?t("common.loading"):t("settings.license.activate","Activate License")})})]}),_&&e.jsx("p",{className:a.licenseMessage,children:_})]})]})]}),e.jsx(St,{tier:j}),b&&e.jsx(Ct,{ref:S,autoOpen:b.dashboard.autoOpen,settingsFilePath:b.dashboard.settingsFilePath,saving:z,targeted:F,updateDashboardPreferences:x}),e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:t("settings.cold.title","Server Environment"),tooltip:t("settings.cold.title.tooltip","Read-only server environment values loaded at startup.")}),e.jsx(m,{text:t("settings.readOnly.tooltip","This section shows values that cannot be edited from WEPPY Dashboard."),children:e.jsx("span",{className:a.headerBadge,children:t("settings.readOnly","Read-only")})})]}),b?e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.coldGrid,children:[e.jsx("dt",{children:e.jsx(R,{label:"HTTP_PORT",tooltip:t("settings.cold.httpPort.tooltip","Port number used by the MCP WEPPY Dashboard HTTP server.")})}),e.jsx("dd",{children:b.cold.HTTP_PORT}),e.jsx("dt",{children:e.jsx(R,{label:"HTTP_HOST",tooltip:t("settings.cold.httpHost.tooltip","Host interface that the MCP WEPPY Dashboard HTTP server binds to.")})}),e.jsx("dd",{children:b.cold.HTTP_HOST})]}),e.jsx("p",{className:a.coldHint,children:t("settings.cold.hint","Set via environment variables to change these values.")})]}):e.jsx("div",{className:a.loading,children:t("settings.unavailable")})]}),e.jsxs("div",{className:a.card,children:[e.jsx("div",{className:a.cardHeader,children:e.jsx(R,{label:t("settings.language.title","Language"),tooltip:t("settings.language.title.tooltip","Choose how the WEPPY Dashboard interface text is localized.")})}),e.jsxs("div",{className:a.langRow,children:[e.jsx("label",{children:e.jsx(R,{label:t("settings.language.dashboard","WEPPY Dashboard Language"),tooltip:t("settings.language.dashboard.tooltip","Overrides the WEPPY Dashboard language or follows the system language when set to Auto.")})}),e.jsx(m,{text:t("settings.language.auto.tooltip","Follow the operating system's language. Falls back to English when not supported."),children:e.jsxs("select",{className:a.select,value:s,onChange:c=>l(c.target.value),children:[e.jsx("option",{value:xe,children:t("settings.language.auto","Auto")}),fe.map(c=>e.jsx("option",{value:c,children:Nt[c]??c},c))]})})]})]})]})}export{zt as Component};
1
+ import{u as X,a as le,r,j as e,b as I,g as me,c as ye,T as je,A as xe,S as fe}from"./index-CG4GxcAc.js";import{C as be,P as ve}from"./PageHeader-Dc41DgFB.js";import{I as R}from"./InfoLabel-CAGC3efT.js";import{T as m}from"./TooltipText-C0DmdntK.js";import{s as a,u as Se}from"./useSettings-Cme-nLG9.js";import{C as ce}from"./ConfirmModal-Ddk0UX_P.js";import{D as de,f as ue,r as Ce,s as Ne,a as pe,d as se,S as ae,b as _e}from"./sample-requests-BqgMpTlQ.js";import"./ConfirmModal.module-DJksQHBd.js";const ke="_card_jz1ya_4",Pe="_cardEmbedded_jz1ya_14",Le="_cardTitle_jz1ya_21",Re="_storageConsoleGrid_jz1ya_31",we="_storageUsageColumn_jz1ya_38",He="_storagePolicyColumn_jz1ya_39",Be="_usageRow_jz1ya_44",Me="_usageTotal_jz1ya_50",Ae="_usageBreakdown_jz1ya_57",$e="_usageCounts_jz1ya_63",ze="_storageFooter_jz1ya_70",De="_lastRunRow_jz1ya_79",Ee="_lastRunLabel_jz1ya_89",Te="_errorIcon_jz1ya_95",Ie="_tooltip_jz1ya_103",Ue="_cleanupRow_jz1ya_126",Fe="_cleanupLabel_jz1ya_133",Oe="_cleanupBtn_jz1ya_140",Ge="_cleanupBtnDanger_jz1ya_169",qe="_retentionSection_jz1ya_182",We="_retentionTitle_jz1ya_188",Ye="_retentionFieldset_jz1ya_196",Ke="_proOverlay_jz1ya_211",Ve="_modeSegments_jz1ya_223",Je="_radioLabel_jz1ya_244",Qe="_radioLabelActive_jz1ya_265",Ze="_presetGroup_jz1ya_279",Xe="_presetBtn_jz1ya_287",et="_presetBtnActive_jz1ya_310",tt="_freeInput_jz1ya_317",st="_inputError_jz1ya_334",at="_inputUnit_jz1ya_338",it="_cascadeRow_jz1ya_345",nt="_retentionActions_jz1ya_361",ot="_saveBtn_jz1ya_367",rt="_runNowBtn_jz1ya_395",lt="_errorMsg_jz1ya_439",ct="_freeInputHitArea_jz1ya_501",o={card:ke,cardEmbedded:Pe,cardTitle:Le,storageConsoleGrid:Re,storageUsageColumn:we,storagePolicyColumn:He,usageRow:Be,usageTotal:Me,usageBreakdown:Ae,usageCounts:$e,storageFooter:ze,lastRunRow:De,lastRunLabel:Ee,errorIcon:Te,tooltip:Ie,cleanupRow:Ue,cleanupLabel:Fe,cleanupBtn:Oe,cleanupBtnDanger:Ge,retentionSection:qe,retentionTitle:We,retentionFieldset:Ye,proOverlay:Ke,modeSegments:Ve,radioLabel:Je,radioLabelActive:Qe,presetGroup:Ze,presetBtn:Xe,presetBtnActive:et,freeInput:tt,inputError:st,inputUnit:at,cascadeRow:it,retentionActions:nt,saveBtn:ot,runNowBtn:rt,errorMsg:lt,freeInputHitArea:ct};function dt(t,s){return!!(t.mode==="off"&&s.mode!=="off"||t.mode==="age"&&s.mode==="age"&&(s.ageDays??0)<(t.ageDays??0)||t.mode==="size"&&s.mode==="size"&&(s.sizeMb??0)<(t.sizeMb??0)||!t.cascadeSnapshots&&s.cascadeSnapshots)}function ie(t){return t.mode==="age"?Number.isInteger(t.ageDays)&&t.ageDays>=1&&t.ageDays<=365:t.mode==="size"?Number.isInteger(t.sizeMb)&&t.sizeMb>=50&&t.sizeMb<=1e4:!0}function ut(t,s){return t.mode===s.mode&&t.ageDays===s.ageDays&&t.sizeMb===s.sizeMb&&t.cascadeSnapshots===s.cascadeSnapshots}function Y(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:t<1024*1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:`${(t/(1024*1024*1024)).toFixed(2)} GB`}function pt({placeId:t,tier:s,currentPolicy:l,onSaved:d}){const{t:n}=X(),{trackEvent:b}=le(),[i,g]=r.useState(l),[p,_]=r.useState(()=>[7,14,30,90].includes(l.ageDays??-1)?"":String(l.ageDays??30)),[v,k]=r.useState(()=>[100,500,1e3].includes(l.sizeMb??-1)?"":String(l.sizeMb??500)),[P,z]=r.useState(null),[x,f]=r.useState(!1),[D,w]=r.useState(!1),[y,H]=r.useState(!1),[L,A]=r.useState(null);r.useEffect(()=>{g(l);const h=[7,14,30,90],M=[100,500,1e3];_(h.includes(l.ageDays??-1)?"":String(l.ageDays??30)),k(M.includes(l.sizeMb??-1)?"":String(l.sizeMb??500))},[l]);const $=s==="basic",N=ie(i),j=ut(l,i),E=N&&!j&&!D,S=h=>{g(M=>{const O={...M,mode:h};return h==="age"&&(O.ageDays=parseInt(p,10)||30),h==="size"&&(O.sizeMb=parseInt(v,10)||500),O})},B=h=>{_(""),g(M=>({...M,ageDays:h}))},U=h=>{k(""),g(M=>({...M,sizeMb:h}))},F=h=>{_(h);const M=parseInt(h,10);Number.isNaN(M)||g(O=>({...O,ageDays:M}))},c=h=>{k(h);const M=parseInt(h,10);Number.isNaN(M)||g(O=>({...O,sizeMb:M}))},T=async()=>{if(A(null),b("dashboard_click_event",{click_target:"ui_studio_cleanup_save",page:"settings"}),dt(l,i)){try{const h=await ue(t,{mode:i.mode,ageDays:i.ageDays,sizeMb:i.sizeMb,cascadeSnapshots:i.cascadeSnapshots});z(h.dryRun),f(!0)}catch(h){A(h.message)}return}await W()},W=async()=>{w(!0);try{await Ne(t,i),f(!1),d()}catch(h){throw A(h.message),h}finally{w(!1)}},u=async()=>{A(null),b("dashboard_click_event",{click_target:"ui_studio_cleanup_run_now",page:"settings"}),H(!0);try{await Ce(t),d()}catch(h){A(h.message)}finally{H(!1)}},C=P?`${n("uiStudio.cleanup.policy.confirm.messageStrict","이 정책으로 즉시")} ${P.wouldRemoveRequests}${n("uiStudio.cleanup.policy.confirm.requests","건")} / ${P.wouldRemoveSnapshots}${n("uiStudio.cleanup.policy.confirm.snapshots","개 화면 캡처")} / ${Y(P.wouldFreeBytes)} ${n("uiStudio.cleanup.policy.confirm.freed","가 삭제됩니다 — 적용?")}`:"",K=i.mode==="age"&&!ie(i),q=i.mode==="size"&&!ie(i);return e.jsxs("div",{className:o.retentionSection,children:[e.jsx("h3",{className:o.retentionTitle,children:e.jsx(R,{label:n("uiStudio.cleanup.policy.title","자동 삭제 정책"),tooltip:n("uiStudio.cleanup.policy.title.tooltip","Rules that automatically remove old or large captures.")})}),e.jsxs("div",{style:{position:"relative"},children:[$&&e.jsx("div",{className:o.proOverlay,title:n("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능"),children:e.jsx("div",{className:o.tooltip,children:n("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능")})}),e.jsxs("fieldset",{className:o.retentionFieldset,disabled:$,"aria-label":n("uiStudio.cleanup.policy.title","자동 삭제 정책"),style:$?{opacity:.45,pointerEvents:"none"}:void 0,children:[e.jsxs("div",{className:o.modeSegments,"data-testid":"cleanup-mode-segments",children:[e.jsx(m,{text:n("uiStudio.cleanup.policy.modeOff.tooltip","Turn off auto-cleanup. Data stays until you remove it manually."),children:e.jsxs("label",{className:`${o.radioLabel} ${i.mode==="off"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"off",checked:i.mode==="off",onChange:()=>S("off")}),n("uiStudio.cleanup.policy.modeOff","사용 안 함 (off)")]})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.modeAge.tooltip","Automatically delete data older than the configured number of days."),children:e.jsxs("label",{className:`${o.radioLabel} ${i.mode==="age"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"age",checked:i.mode==="age",onChange:()=>S("age")}),n("uiStudio.cleanup.policy.modeAge","기간 기반 (age)")]})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.modeSize.tooltip","When total usage exceeds the limit, the oldest data is removed first."),children:e.jsxs("label",{className:`${o.radioLabel} ${i.mode==="size"?o.radioLabelActive:""}`,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"size",checked:i.mode==="size",onChange:()=>S("size")}),n("uiStudio.cleanup.policy.modeSize","용량 기반 (size)")]})})]}),i.mode==="age"&&e.jsxs("div",{className:o.presetGroup,children:[[7,14,30,90].map(h=>e.jsx(m,{text:n("uiStudio.cleanup.policy.agePreset.tooltip","Delete data older than this many days."),children:e.jsxs("button",{type:"button",className:`${o.presetBtn} ${i.ageDays===h&&p===""?o.presetBtnActive:""}`,onClick:()=>B(h),children:[h,n("uiStudio.cleanup.policy.daysUnit","일")]})},h)),e.jsx(m,{text:n("uiStudio.cleanup.policy.ageInput.tooltip","Enter any value between 1 and 365 days."),children:e.jsx("label",{className:o.freeInputHitArea,children:e.jsx("input",{type:"number",className:`${o.freeInput} ${K?o.inputError:""}`,value:p,min:1,max:365,onChange:h=>F(h.target.value)})})}),e.jsxs("span",{className:o.inputUnit,children:["1–365",n("uiStudio.cleanup.policy.daysUnit","일")]})]}),i.mode==="size"&&e.jsxs("div",{className:o.presetGroup,children:[[100,500,1e3].map(h=>e.jsx(m,{text:n("uiStudio.cleanup.policy.sizePreset.tooltip","Keep total usage under this size."),children:e.jsxs("button",{type:"button",className:`${o.presetBtn} ${i.sizeMb===h&&v===""?o.presetBtnActive:""}`,onClick:()=>U(h),children:[h,n("uiStudio.cleanup.policy.mbUnit","MB")]})},h)),e.jsx(m,{text:n("uiStudio.cleanup.policy.sizeInput.tooltip","Enter any value between 50 MB and 10000 MB (10 GB)."),children:e.jsx("label",{className:o.freeInputHitArea,children:e.jsx("input",{type:"number",className:`${o.freeInput} ${q?o.inputError:""}`,value:v,min:50,max:1e4,onChange:h=>c(h.target.value)})})}),e.jsxs("span",{className:o.inputUnit,children:["50–10000",n("uiStudio.cleanup.policy.mbUnit","MB")]})]}),e.jsx(m,{text:n("uiStudio.cleanup.policy.cascade.tooltip","Also delete the capture images linked to those records. If off, the images stay."),children:e.jsxs("label",{className:o.cascadeRow,children:[e.jsx(be,{checked:i.cascadeSnapshots,onChange:h=>g(M=>({...M,cascadeSnapshots:h.target.checked}))}),n("uiStudio.cleanup.policy.cascade","연결된 화면 캡처도 함께 삭제")]})}),e.jsxs("div",{className:o.retentionActions,children:[e.jsx(m,{text:n("uiStudio.cleanup.policy.save.tooltip","Save the current cleanup rule. It runs in the background from then on."),children:e.jsx("button",{type:"button",className:o.saveBtn,onClick:()=>void T(),disabled:!E,children:n("uiStudio.cleanup.policy.save","정책 저장")})}),e.jsx(m,{text:n("uiStudio.cleanup.policy.runNow.tooltip","저장된 정리 정책을 다음 자동 실행까지 기다리지 않고 지금 한 번 실행합니다."),children:e.jsx("button",{type:"button",className:o.runNowBtn,onClick:()=>void u(),disabled:y,children:n("uiStudio.cleanup.policy.runNow","저장된 정책으로 정리")})})]}),L&&e.jsx("div",{className:o.errorMsg,children:L})]})]}),x&&P&&e.jsx(de,{title:n("uiStudio.cleanup.policy.confirm.title","정책 적용 확인"),message:C,danger:!0,confirmLabel:n("uiStudio.cleanup.policy.save","정책 저장"),busy:D,onConfirm:W,onClose:()=>f(!1)})]})}function gt({placeId:t,tier:s,onChanged:l,sampleUsage:d,sampleRetention:n,embedded:b=!1}){const{t:i}=X(),g=s==="basic"&&d!=null&&n!=null,[p,_]=r.useState(g?d:null),[v,k]=r.useState(g?n:null),[P,z]=r.useState(null),[x,f]=r.useState(null),[D,w]=r.useState(null),y=r.useCallback(async()=>{if(!g&&t!=null){z(null);try{const[S,B]=await Promise.all([pe(t),ue(t)]);_(S),k(B.policy)}catch(S){z(S.message)}}},[t,g]);r.useEffect(()=>{y()},[y]);const H=r.useCallback(()=>{y(),l==null||l()},[y,l]),L=r.useCallback(async()=>{if(x&&t!=null){w(null);try{x.kind==="keep7"?await se(t,{olderThanDays:7,alsoSnapshots:!0}):x.kind==="keep30"?await se(t,{olderThanDays:30,alsoSnapshots:!0}):await se(t,{all:!0,alsoSnapshots:!0}),f(null),y(),l==null||l()}catch(S){throw w(S.message),S}}},[x,t,y,l]);function A(S){const B=i("uiStudio.cleanup.studioPreservedNote","This deletes saved change records and screenshots on disk only; Roblox Studio instances are not affected.");return S.kind==="keep7"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep7","7일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`:S.kind==="keep30"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep30","30일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`:`${((p==null?void 0:p.requestCount)??0)+((p==null?void 0:p.snapshotCount)??0)}${i("uiStudio.cleanup.cleanupConfirmMessage.all","개의 저장된 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${B}`}if(t==null&&!g)return null;if(P)return e.jsx("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:e.jsx("p",{className:o.errorMsg,children:P})});if(!p||!v)return e.jsx("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:0},children:i("uiStudio.storage.loading","로딩 중...")})});const $=v.lastRunAt,N=v.lastRunStats,j=$?new Date($).toLocaleString():null,E=t??0;return e.jsxs("div",{className:`${o.card} ${b?o.cardEmbedded:""}`,children:[!b&&e.jsx("h3",{className:o.cardTitle,children:e.jsx(R,{label:i("uiStudio.storage.title","UI Studio 저장 데이터"),tooltip:i("uiStudio.storage.title.tooltip","Disk usage of UI Studio change records and screenshots.")})}),e.jsxs("div",{className:o.storageConsoleGrid,"data-testid":"ui-studio-storage-console-grid",children:[e.jsx("section",{className:o.storageUsageColumn,children:e.jsxs("div",{className:o.usageRow,children:[e.jsx(m,{text:i("uiStudio.storage.usageLabel.tooltip","Disk space currently used by UI Studio for this project."),children:e.jsxs("div",{className:o.usageTotal,children:[i("uiStudio.storage.usageLabel","사용 중")," ",Y(p.totalBytes)]})}),e.jsxs("div",{className:o.usageBreakdown,children:[e.jsx(m,{text:i("uiStudio.storage.historyBytes.tooltip","Space taken by change record data (JSON)."),children:e.jsxs("span",{children:[i("uiStudio.storage.historyBytes","변경 이력")," ",Y(p.historyBytes)]})})," · ",e.jsx(m,{text:i("uiStudio.storage.snapshotBytes.tooltip","Space taken by captured PNG image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotBytes","화면 캡처")," ",Y(p.snapshotBytes)]})})]}),e.jsxs("div",{className:o.usageCounts,children:[e.jsx(m,{text:i("uiStudio.storage.requestCount.tooltip","Number of actions where AI changed the UI."),children:e.jsxs("span",{children:[i("uiStudio.storage.requestCount","변경 기록")," ",p.requestCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(m,{text:i("uiStudio.storage.mutationCount.tooltip","Number of detail changes inside actions (one property edit = 1)."),children:e.jsxs("span",{children:[i("uiStudio.storage.mutationCount","변경 상세")," ",p.mutationCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(m,{text:i("uiStudio.storage.snapshotCount.tooltip","Number of saved capture image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotCount","화면 캡처")," ",p.snapshotCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})]})]})}),e.jsx("section",{className:o.storagePolicyColumn,children:e.jsx(pt,{placeId:E,tier:s,currentPolicy:v,onSaved:H})})]}),e.jsxs("div",{className:o.storageFooter,"data-testid":"ui-studio-storage-footer",children:[e.jsxs("div",{className:o.lastRunRow,children:[e.jsx("span",{className:o.lastRunLabel,children:e.jsx(R,{label:i("uiStudio.storage.lastRun","마지막 자동 정리"),tooltip:i("uiStudio.storage.lastRun.tooltip","When the auto-cleanup policy last ran, and what it removed.")})}),j?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:j}),N&&e.jsxs("span",{children:["· ",i("uiStudio.storage.requestCount","변경 기록")," ",N.removedRequests,i("uiStudio.storage.countSuffix","개")," / ",i("uiStudio.storage.snapshotCount","화면 캡처")," ",N.removedSnapshots,i("uiStudio.storage.countSuffix","개")," / ",Y(N.freedBytes)," ",i("uiStudio.storage.lastRunFreed","회수")]}),N&&N.errors>0&&e.jsxs("span",{className:o.errorIcon,title:`${i("uiStudio.storage.lastRunErrors","오류")} ${N.errors}건`,children:["⚠",e.jsxs("span",{className:o.tooltip,children:[i("uiStudio.storage.lastRunErrors","오류")," ",N.errors,i("uiStudio.storage.countSuffix","건")]})]})]}):e.jsx("span",{children:i("uiStudio.storage.lastRunNever","—")})]}),e.jsxs("div",{className:o.cleanupRow,children:[e.jsx("span",{className:o.cleanupLabel,children:e.jsx(R,{label:i("uiStudio.cleanup.label","수동 정리"),tooltip:i("uiStudio.cleanup.label.tooltip","Manually clean up change records and captures whenever you want.")})}),e.jsx(m,{text:i("uiStudio.cleanup.keep7.tooltip","Delete change records and captures older than 7 days."),children:e.jsx("button",{type:"button",className:o.cleanupBtn,onClick:()=>f({kind:"keep7"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 7일만 남기기").replace("{n}","7")})}),e.jsx(m,{text:i("uiStudio.cleanup.keep30.tooltip","Delete change records and captures older than 30 days."),children:e.jsx("button",{type:"button",className:o.cleanupBtn,onClick:()=>f({kind:"keep30"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 30일만 남기기").replace("{n}","30")})}),!b&&e.jsx(m,{text:i("uiStudio.cleanup.deleteAll.tooltip","Delete every change record and capture for this project. The actual UI in Roblox Studio is not affected."),children:e.jsx("button",{type:"button",className:`${o.cleanupBtn} ${o.cleanupBtnDanger}`,onClick:()=>f({kind:"all"}),disabled:s==="basic",children:i("uiStudio.cleanup.deleteAll","전체 삭제…")})})]})]}),D&&e.jsx("div",{className:o.errorMsg,children:D}),x&&e.jsx(de,{title:i("uiStudio.cleanup.cleanupConfirmTitle","정리 확인"),message:A(x),danger:!0,confirmLabel:i("common.delete","삭제"),onConfirm:L,onClose:()=>{f(null),w(null)}})]})}function ne(t,s){const l={placeId:String(t)};return s&&(l["preview.mode"]=s.mode,s.mode==="size"&&(l["preview.sizeMb"]=String(s.sizeMb))),I.get("/api/dashboard/changelog/cleanup",l)}function oe(t){return I.put("/api/dashboard/changelog/cleanup",t)}function ht(t){return I.post(`/api/dashboard/changelog/cleanup/run?placeId=${encodeURIComponent(t)}`)}const mt=[100,500,1e3];function re(t,s){return t.mode!==s.mode?!1:t.mode==="off"||s.mode==="size"&&t.sizeMb===s.sizeMb}function yt(t,s){return t.mode==="off"?!1:s.mode==="off"||t.sizeMb<s.sizeMb}function J(t){return t<1e3?`${t} B`:t<1e6?`${(t/1e3).toFixed(1)} KB`:t<1e9?`${(t/1e6).toFixed(1)} MB`:`${(t/1e9).toFixed(2)} GB`}function jt({placeId:t,onChanged:s}){const{locale:l,t:d}=X(),[n,b]=r.useState(null),[i,g]=r.useState({mode:"size",sizeMb:500}),[p,_]=r.useState(t!==null),[v,k]=r.useState(!1),[P,z]=r.useState(!1),[x,f]=r.useState(!1),[D,w]=r.useState(!1),[y,H]=r.useState(null),L=r.useCallback(async()=>{if(t===null){b(null),_(!1);return}z(!1);try{const u=await ne(t);b(u),g(u.policy)}catch{z(!0)}finally{_(!1)}},[t]);r.useEffect(()=>{_(t!==null),L()},[L,t]);const A=r.useCallback(async u=>{k(!0),f(!1),w(!1);try{await oe(u),H(null),await L(),w(!0),s==null||s()}catch{f(!0)}finally{k(!1)}},[L,s]),$=r.useCallback(async()=>{if(!(!n||t===null||re(i,n.policy))){k(!0),f(!1),w(!1);try{if(yt(i,n.policy)){const u=await ne(t,i);if(u.preview.affectedPlaceCount>0){H({policy:i,preview:u});return}}await oe(i),await L(),w(!0),s==null||s()}catch{f(!0)}finally{k(!1)}}},[n,i,L,s,t]),N=r.useCallback(async()=>{if(t!==null){k(!0),f(!1),w(!1);try{await ht(t),await L(),s==null||s()}catch{f(!0)}finally{k(!1)}}},[L,s,t]),j=n==null?void 0:n.selectedPlace.currentUsage,E=(n==null?void 0:n.policy.mode)==="size"?n.policy.sizeMb*1e6:null,S=E??Math.max((j==null?void 0:j.bytes)??0,1),B=Math.min(100,((j==null?void 0:j.sessionBytes)??0)/S*100),U=Math.min(Math.max(0,100-B),((j==null?void 0:j.contextBytes)??0)/S*100),F=n?!re(i,n.policy):!1,c=u=>u.mode==="off"?d("settings.projectChanges.cleanup.unlimited","Unlimited"):`${u.sizeMb} MB`,T=r.useMemo(()=>{if(!y)return"";const u=y.preview.preview,C=d("settings.projectChanges.cleanup.confirm.message","{places} Places · {sessions} sessions · {bytes} expected to be freed.").replace("{places}",u.affectedPlaceCount.toLocaleString()).replace("{sessions}",u.deleteSessionCount.toLocaleString()).replace("{bytes}",J(u.estimatedFreedBytes));return u.wouldRemainOverLimitPlaceCount===0?C:`${C} ${d("settings.projectChanges.cleanup.confirm.protected","{places} Place may remain over the limit because active data is protected.").replace("{places}",u.wouldRemainOverLimitPlaceCount.toLocaleString())}`},[y,d]);if(t===null)return e.jsx("div",{className:a.projectChangesPanel,children:e.jsx("p",{className:a.projectChangesEmpty,children:d("settings.projectChanges.cleanup.noPlace","Select a Place to manage saved project changes.")})});if(p)return e.jsx("div",{className:a.projectChangesPanel,children:e.jsx("p",{className:a.projectChangesEmpty,children:d("settings.projectChanges.cleanup.loading","Loading storage settings…")})});if(P||!n||!j)return e.jsxs("div",{className:a.projectChangesPanel,children:[e.jsx("p",{className:a.projectChangesError,role:"alert",children:d("settings.projectChanges.cleanup.loadFailed","Could not load storage settings.")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",onClick:()=>{_(!0),L()},children:d("common.retry","Retry")})]});const W=E===null?d("settings.projectChanges.cleanup.usageUnlimited","{used} used · Unlimited").replace("{used}",J(j.bytes)):d("settings.projectChanges.cleanup.usageLimited","{used} used of {limit}").replace("{used}",J(j.bytes)).replace("{limit}",c(n.policy));return e.jsxs("div",{className:a.projectChangesPanel,children:[e.jsxs("div",{className:a.projectChangesConsoleGrid,"data-testid":"project-storage-console-grid",children:[e.jsxs("section",{className:a.projectChangesUsageColumn,children:[e.jsx("h3",{className:a.projectChangesPanelTitle,children:e.jsx(R,{label:d("settings.projectChanges.cleanup.title","Storage management"),tooltip:d("settings.projectChanges.cleanup.title.tooltip","Set how much Project Change Summary history each Place can keep.")})}),e.jsxs("div",{className:a.projectChangesUsageBlock,children:[e.jsx("div",{className:a.projectChangesUsageSummary,children:W}),e.jsxs("div",{className:a.projectChangesQuotaRail,role:"meter","aria-label":d("settings.projectChanges.cleanup.usageAria","Place storage usage"),"aria-valuemin":0,"aria-valuenow":j.bytes,"aria-valuemax":E??j.bytes,children:[e.jsx("span",{className:a.projectChangesSessionRail,style:{width:`${B}%`}}),e.jsx("span",{className:a.projectChangesContextRail,style:{width:`${U}%`}})]}),e.jsxs("div",{className:a.projectChangesUsageLegend,children:[e.jsxs("span",{children:[d("settings.projectChanges.cleanup.sessions","Sessions")," ",e.jsx("strong",{children:J(j.sessionBytes)})]}),e.jsxs("span",{children:[d("settings.projectChanges.cleanup.contexts","Contexts")," ",e.jsx("strong",{children:J(j.contextBytes)})]})]})]})]}),e.jsxs("section",{className:a.projectChangesPolicyColumn,children:[e.jsx("p",{className:a.projectChangesScope,children:d("settings.projectChanges.cleanup.scope","One setting applies the selected limit separately to every Place.")}),e.jsxs("fieldset",{className:a.projectChangesPolicyFieldset,disabled:v,children:[e.jsx("legend",{className:a.projectChangesPolicyLegend,children:d("settings.projectChanges.cleanup.limit","Limit per Place")}),e.jsxs("div",{className:a.projectChangesPresetGroup,children:[mt.map(u=>{const C=i.mode==="size"&&i.sizeMb===u;return e.jsx("button",{className:`${a.projectChangesPresetButton} ${C?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":C,onClick:()=>g({mode:"size",sizeMb:u}),children:d("settings.projectChanges.cleanup.preset","{sizeMb}MB").replace("{sizeMb}",String(u))},u)}),e.jsx("button",{className:`${a.projectChangesPresetButton} ${i.mode==="off"?a.projectChangesPresetButtonActive:""}`,type:"button","aria-pressed":i.mode==="off",onClick:()=>g({mode:"off"}),children:d("settings.projectChanges.cleanup.unlimited","Unlimited")})]})]}),e.jsxs("div",{className:a.projectChangesActions,children:[e.jsx("button",{className:a.projectChangesSaveButton,type:"button",disabled:!F||v,onClick:()=>void $(),children:d("common.save","Save")}),e.jsx("button",{className:a.projectChangesSecondaryButton,type:"button",disabled:v,onClick:()=>void N(),children:d("settings.projectChanges.cleanup.runNow","Run saved policy")}),D&&e.jsx("span",{className:a.projectChangesSaved,role:"status",children:d("settings.projectChanges.cleanup.saved","Saved")})]})]})]}),n.selectedPlace.dryRun.wouldRemainOverLimit&&e.jsx("p",{className:a.projectChangesWarning,children:d("settings.projectChanges.cleanup.protectedWarning","Active changes are protected, so this Place may stay over the limit.")}),e.jsxs("div",{className:a.projectChangesLastRun,"data-testid":"project-storage-footer",children:[e.jsx("span",{className:a.projectChangesLastRunLabel,children:d("settings.projectChanges.cleanup.lastRun","Last cleanup")}),n.selectedPlace.lastRun?e.jsxs("span",{children:[new Date(n.selectedPlace.lastRun.ranAt).toLocaleString(l)," · ",d("settings.projectChanges.cleanup.lastRunSummary","{sessions} sessions · {bytes} freed").replace("{sessions}",n.selectedPlace.lastRun.deletedSessionCount.toLocaleString()).replace("{bytes}",J(n.selectedPlace.lastRun.freedBytes))]}):e.jsx("span",{children:d("settings.projectChanges.cleanup.neverRun","Not run yet")})]}),x&&e.jsx("p",{className:a.projectChangesError,role:"alert",children:d("settings.projectChanges.cleanup.actionFailed","Could not update storage settings.")}),e.jsx(ce,{open:y!==null,title:d("settings.projectChanges.cleanup.confirm.title","Apply this limit and clean saved changes?"),message:T,cancelLabel:d("common.cancel","Cancel"),confirmLabel:d("settings.projectChanges.cleanup.confirm.apply","Apply and clean"),loading:v,onCancel:()=>!v&&H(null),onConfirm:()=>{y&&A(y.policy)}})]})}const xt={toolsActivity:null,toolStats:null,toolSessions:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null},ft={toolsActivity:null,toolStats:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null};function bt(t){var s;return t?t.pluginConnected?t.activePlaceId:t.lastActivePlaceId??((s=t.places[0])==null?void 0:s.placeId)??null:null}async function G(t){try{return await t}catch{return null}}function ee(t){return t?typeof t.total=="number"?t.total:Array.isArray(t.entries)?t.entries.length:null:null}function te(t,s,l,d){return s===null?t("settings.dataHistory.metric.unavailable","Unavailable"):`${s.toLocaleString()} ${t(l,d)}`}function Q(t,s,l){const d=l===null?t("settings.dataHistory.metric.sizeUnavailable","size unavailable"):Y(l);return`${s} · ${d}`}function Z(t,s){var d;const l=(d=t==null?void 0:t[s])==null?void 0:d.bytes;return typeof l=="number"&&Number.isFinite(l)?l:null}function vt(t,s){return s?[`${s.requestCount.toLocaleString()} ${t("uiStudio.storage.requestCount","change records")}`,`${s.snapshotCount.toLocaleString()} ${t("uiStudio.storage.snapshotCount","screenshots")}`,Y(s.totalBytes)].join(" · "):t("settings.dataHistory.metric.unavailable","Unavailable")}function St({tier:t}){const{t:s}=X(),[l,d]=r.useState(xt),[n,b]=r.useState(ft),[i,g]=r.useState(t==="basic"?ae:null),[p,_]=r.useState(null),[v,k]=r.useState(!0),[P,z]=r.useState(!0),[x,f]=r.useState(null),[D,w]=r.useState(()=>new Set),[y,H]=r.useState(null),[L,A]=r.useState(!1),[$,N]=r.useState(null),j=r.useCallback(async()=>{k(!0);const u=await G(me()),C=bt(u);_(C);const[K,q,h,M,O,ge,V]=await Promise.all([G(I.get("/api/dashboard/history",{limit:"1",offset:"0"})),G(I.get("/api/dashboard/tool-stats")),G(I.get("/sync/history",{limit:"1",offset:"0"})),G(I.get("/api/dashboard/playtest/history")),G(I.get("/api/dashboard/changelog",{limit:"1",offset:"0"})),G(I.get("/api/dashboard/connection-log")),G(I.get("/api/dashboard/storage-summary"))]),he=t==="basic"?ae:C===null?null:await G(pe(C));d({toolsActivity:ee(K),toolStats:(q==null?void 0:q.totalCalls)??null,toolSessions:(q==null?void 0:q.totalSessions)??null,syncLog:ee(h),playtestReports:ee(M),projectChanges:ee(O),connectionLog:ee(ge)}),b({toolsActivity:Z(V,"toolsActivity"),toolStats:Z(V,"toolStats"),syncLog:Z(V,"syncLog"),playtestReports:Z(V,"playtestReports"),projectChanges:Z(V,"projectChanges"),connectionLog:Z(V,"connectionLog")}),g(he),k(!1)},[t]);r.useEffect(()=>{j()},[j]);const E=r.useCallback(u=>{w(C=>{if(C.has(u))return C;const K=new Set(C);return K.add(u),K}),f(C=>C===u?null:u)},[]),S=r.useMemo(()=>[{key:"toolsActivity",title:s("settings.dataHistory.toolsActivity.title","Tool activity"),description:s("settings.dataHistory.toolsActivity.description","Saved tool runs shown on the Tools page."),metric:Q(s,te(s,l.toolsActivity,"settings.dataHistory.metric.records","records"),n.toolsActivity),metricTooltip:s("settings.dataHistory.toolsActivity.metric.tooltip","Number of saved tool runs and the disk space they use."),route:"/tools",clearEndpoint:"/api/dashboard/tools/history/clear"},{key:"toolStats",title:s("settings.dataHistory.toolStats.title","Tool usage statistics"),description:s("settings.dataHistory.toolStats.description","Aggregated tool counts and status totals."),metric:Q(s,l.toolStats===null?s("settings.dataHistory.metric.unavailable","Unavailable"):`${l.toolStats.toLocaleString()} ${s("settings.dataHistory.metric.runs","runs")} · ${(l.toolSessions??0).toLocaleString()} ${s("settings.dataHistory.metric.sessions","sessions")}`,n.toolStats),metricTooltip:s("settings.dataHistory.toolStats.metric.tooltip","Aggregated total runs and session counts."),route:"/tools",clearEndpoint:"/api/dashboard/tools/statistics/clear"},{key:"syncLog",title:s("settings.dataHistory.syncLog.title","Sync log"),description:s("settings.dataHistory.syncLog.description","Saved file sync events for the active place."),metric:Q(s,te(s,l.syncLog,"settings.dataHistory.metric.records","records"),n.syncLog),metricTooltip:s("settings.dataHistory.syncLog.metric.tooltip","Number of saved sync events and the disk space they use."),route:"/sync",clearEndpoint:"/api/dashboard/sync/history/clear"},{key:"playtestReports",title:s("settings.dataHistory.playtest.title","Playtest reports"),description:s("settings.dataHistory.playtest.description","Saved automated playtest reports and logs."),metric:Q(s,te(s,l.playtestReports,"settings.dataHistory.metric.reports","reports"),n.playtestReports),metricTooltip:s("settings.dataHistory.playtestReports.metric.tooltip","Number of saved playtest reports and the disk space they use."),route:"/playtest",clearEndpoint:"/api/dashboard/playtest/history/clear"},{key:"projectChanges",title:s("settings.dataHistory.projectChanges.title","Project change summary"),description:s("settings.dataHistory.projectChanges.description","Saved summaries of project changes."),metric:Q(s,te(s,l.projectChanges,"settings.dataHistory.metric.records","records"),n.projectChanges),metricTooltip:s("settings.dataHistory.projectChanges.metric.tooltip","Number of saved project change summaries and the disk space they use."),route:"/changelog",clearEndpoint:"/api/dashboard/changelog/clear"},{key:"connectionLog",title:s("settings.dataHistory.connectionLog.title","Connection log"),description:s("settings.dataHistory.connectionLog.description","Saved MCP and Studio connection events."),metric:Q(s,te(s,l.connectionLog,"settings.dataHistory.metric.records","records"),n.connectionLog),metricTooltip:s("settings.dataHistory.connectionLog.metric.tooltip","Number of saved connection events and the disk space they use."),route:"/connection",clearEndpoint:"/api/dashboard/connection-log/clear"}],[l,n,s]),B=async()=>{if(y){A(!0),N(null);try{if(y.kind==="uiStudio"){if(t!=="pro"||p===null)throw new Error("UI Studio place is unavailable");await se(p,{all:!0,alsoSnapshots:!0}),N(s("settings.dataHistory.uiStudio.clear.success","UI Studio saved data cleared."))}else{const u=y.row.key==="projectChanges";if(u&&p===null)throw new Error("Project changes place is unavailable");let C=y.row.clearEndpoint;u&&p!==null&&(C=`${C}?placeId=${encodeURIComponent(p)}`),await I.post(C),N(u?s("settings.dataHistory.projectChanges.clear.success","Project change summaries cleared."):s("settings.dataHistory.clear.success","Saved data cleared."))}H(null),await j()}catch{N(y.kind==="uiStudio"?s("settings.dataHistory.uiStudio.clear.failed","Failed to clear UI Studio saved data."):s("settings.dataHistory.clear.failed","Failed to clear saved data."))}finally{A(!1)}}},U=t==="pro"?p:0,F=t==="pro"&&p!==null,c=(y==null?void 0:y.kind)==="uiStudio",T=(y==null?void 0:y.kind)==="row"&&y.row.key==="projectChanges",W=s("settings.dataHistory.title","Data & History");return e.jsxs(e.Fragment,{children:[e.jsxs("section",{id:"data-history",className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:s("settings.dataHistory.title","Data & History"),tooltip:s("settings.dataHistory.title.tooltip","Manage saved dashboard data in one place.")}),e.jsxs("div",{className:a.cardHeaderActions,children:[e.jsx(m,{text:s("settings.dataHistory.scope.tooltip","Clear actions apply to the current project and active place where applicable."),children:e.jsx("span",{className:a.headerBadge,children:v?s("common.loading","Loading"):s("settings.dataHistory.scope","Current project")})}),e.jsx(m,{text:s("settings.dataHistory.toggle.tooltip","Collapse or expand this section."),children:e.jsx("button",{className:a.collapseButton,type:"button","aria-expanded":P,"aria-controls":"settings-data-history-body","aria-label":P?s("settings.dataHistory.collapse","Collapse {title}").replace("{title}",W):s("settings.dataHistory.expand","Expand {title}").replace("{title}",W),onClick:()=>z(u=>!u),children:P?"▾":"▸"})})]})]}),P&&e.jsxs("div",{id:"settings-data-history-body",children:[e.jsx("p",{className:a.dataHistoryIntro,children:s("settings.dataHistory.intro","Review saved dashboard data, open the related page, or clear stored records from one place.")}),e.jsxs("div",{className:a.dataHistoryList,children:[S.map(u=>e.jsxs(r.Fragment,{children:[e.jsxs("div",{className:`${a.dataHistoryRow} ${u.key==="projectChanges"&&x==="projectChanges"?a.dataHistoryRowExpanded:""}`,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:u.title}),e.jsx("div",{className:a.dataHistoryDescription,children:u.description})]}),e.jsx(m,{text:u.metricTooltip,children:e.jsx("div",{className:a.dataHistoryMetric,children:u.metric})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(m,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:`#${u.route}`,children:s("settings.dataHistory.open","Open")})}),u.key==="projectChanges"&&e.jsx(m,{text:s("settings.dataHistory.manageStorage.tooltip","Show or hide storage policy and cleanup controls."),children:e.jsxs("button",{className:a.manageStorageButton,type:"button","aria-expanded":x==="projectChanges","aria-controls":"settings-project-changes-storage","aria-label":s("settings.dataHistory.manageStorage.projectChanges.aria","Manage Project change summary storage"),onClick:()=>E("projectChanges"),children:[s("settings.dataHistory.manageStorage","Manage storage"),e.jsx("span",{"aria-hidden":"true",children:x==="projectChanges"?"▴":"▾"})]})}),e.jsx(m,{text:s("settings.dataHistory.clear.tooltip","Delete only the records saved for this item. Roblox Studio data is not changed."),children:e.jsx("button",{className:a.dangerButton,type:"button",disabled:u.key==="projectChanges"&&p===null,onClick:()=>H({kind:"row",row:u}),children:u.key==="projectChanges"?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear")})})]})]}),u.key==="projectChanges"&&D.has("projectChanges")&&e.jsx("div",{id:"settings-project-changes-storage",className:`${a.dataHistoryDetail} ${a.projectChangesDataHistoryDetail}`,hidden:x!=="projectChanges",children:e.jsx(jt,{placeId:p,onChanged:j})})]},u.key)),e.jsxs("div",{className:`${a.dataHistoryRow} ${x==="uiStudio"?a.dataHistoryRowExpanded:""}`,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:s("settings.dataHistory.uiStudio.title","UI Studio history and screenshots")}),e.jsx("div",{className:a.dataHistoryDescription,children:s("settings.dataHistory.uiStudio.description","Saved UI Studio change records, screenshots, and cleanup policy.")})]}),e.jsx(m,{text:s("settings.dataHistory.uiStudio.metric.tooltip","UI Studio change record and capture counts, plus total disk usage."),children:e.jsx("div",{className:a.dataHistoryMetric,children:vt(s,i)})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(m,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:"#/ui-studio?tab=history",children:s("settings.dataHistory.open","Open")})}),e.jsx(m,{text:s("settings.dataHistory.manageStorage.tooltip","Show or hide storage policy and cleanup controls."),children:e.jsxs("button",{className:a.manageStorageButton,type:"button","aria-expanded":x==="uiStudio","aria-controls":"settings-ui-studio-storage","aria-label":s("settings.dataHistory.manageStorage.uiStudio.aria","Manage UI Studio history and screenshots storage"),onClick:()=>E("uiStudio"),children:[s("settings.dataHistory.manageStorage","Manage storage"),e.jsx("span",{"aria-hidden":"true",children:x==="uiStudio"?"▴":"▾"})]})}),e.jsx(m,{text:s("settings.dataHistory.clear.tooltip","Delete only the records saved for this item. Roblox Studio data is not changed."),children:e.jsx("button",{className:a.dangerButton,type:"button",disabled:!F,onClick:()=>H({kind:"uiStudio"}),children:s("settings.dataHistory.clearAll","Clear all")})})]})]}),D.has("uiStudio")&&e.jsx("div",{id:"settings-ui-studio-storage",className:`${a.dataHistoryDetail} ${a.uiStudioDataHistoryDetail}`,hidden:x!=="uiStudio",children:e.jsx(gt,{placeId:U,tier:t,onChanged:j,embedded:!0,...t==="basic"?{sampleUsage:ae,sampleRetention:_e}:{}})})]}),$&&e.jsx("p",{className:a.inlineStatus,children:$})]})]}),e.jsx(ce,{open:y!==null,title:c?s("settings.dataHistory.uiStudio.clear.title","Clear UI Studio saved data?"):T?s("settings.dataHistory.projectChanges.clear.title","Clear project change summaries?"):s("settings.dataHistory.clear.title","Clear saved data?"),message:c?s("settings.dataHistory.uiStudio.clear.message","This deletes saved UI Studio change records and screenshots only. Roblox Studio instances and project objects are not changed."):T?s("settings.dataHistory.projectChanges.clear.message","This deletes completed sessions and ended context history for the selected Place. Active work and Roblox Studio project data stay intact."):s("settings.dataHistory.clear.message","This deletes saved dashboard records only. Roblox Studio instances and project objects are not changed."),cancelLabel:s("common.cancel","Cancel"),confirmLabel:T||c?s("settings.dataHistory.clearAll","Clear all"):s("common.clear","Clear"),loading:L,onCancel:()=>!L&&H(null),onConfirm:()=>void B()})]})}const Ct=r.forwardRef(function({autoOpen:s,settingsFilePath:l,saving:d,targeted:n,updateDashboardPreferences:b},i){const{t:g}=X(),[p,_]=r.useState("idle"),v="settings-dashboard-auto-open-label",k=d||p==="saving",P=async x=>{_("saving");try{await b({autoOpen:x}),_("saved")}catch{_("error")}},z=p==="saving"?g("settings.dashboard.autoOpen.saving","Saving…"):p==="saved"?g("settings.dashboard.autoOpen.saved","Saved for the next server start."):p==="error"?g("settings.dashboard.autoOpen.error","Could not save. The previous setting was restored."):" ";return e.jsxs("div",{id:"settings-dashboard",ref:i,tabIndex:-1,"data-testid":"settings-dashboard-card",className:[a.card,a.dashboardCard,n?a.dashboardCardTarget:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:g("settings.dashboard.title","Dashboard"),tooltip:g("settings.dashboard.title.tooltip","Choose how WEPPY Dashboard behaves when the MCP Server starts.")}),e.jsx(m,{text:g("settings.dashboard.autoOpen.nextStart","Applies the next time the MCP Server starts."),children:e.jsx("span",{className:a.headerBadge,children:g("settings.dashboard.nextStartBadge","Next Start")})})]}),e.jsxs("div",{className:a.dashboardSettingRow,children:[e.jsxs("div",{className:a.dashboardSettingCopy,children:[e.jsx("span",{id:v,className:a.dashboardSettingLabel,children:g("settings.dashboard.autoOpen.label","Open Dashboard when WEPPY starts")}),e.jsx("span",{className:a.dashboardSettingDescription,children:g("settings.dashboard.autoOpen.description","Automatically opens this Dashboard after the MCP Server starts.")}),e.jsx("span",{className:a.dashboardSettingMeta,children:g("settings.dashboard.autoOpen.nextStart","Applies the next time the MCP Server starts.")})]}),e.jsxs("label",{className:`${a.toggleSwitch} ${a.dashboardToggleTarget}`,children:[e.jsx("input",{className:a.toggleInput,type:"checkbox",role:"switch","aria-labelledby":v,checked:s,disabled:k,onChange:x=>{P(x.target.checked)}}),e.jsx("span",{className:a.toggleTrack,"aria-hidden":"true",children:e.jsx("span",{className:a.toggleThumb})})]})]}),e.jsxs("dl",{className:a.dashboardDetails,children:[e.jsxs("div",{className:a.dashboardDetailRow,children:[e.jsx("dt",{children:g("settings.dashboard.settingsFile.label","Settings file")}),e.jsx("dd",{children:e.jsx("code",{className:a.dashboardSettingsFilePath,children:l})})]}),e.jsxs("div",{className:a.dashboardDetailRow,children:[e.jsx("dt",{children:g("settings.dashboard.agentExample.label","Ask your Agent")}),e.jsx("dd",{className:a.dashboardAgentPrompt,children:g("settings.dashboard.agentExample.prompt","“Turn off Dashboard auto-open.”")})]})]}),e.jsx("p",{className:`${a.dashboardSaveFeedback} ${p==="error"?a.dashboardSaveFeedbackError:""}`,"aria-live":"polite",children:z})]})}),Nt={en:"English",ko:"한국어",es:"Español","pt-br":"Português (BR)",ja:"日本語",id:"Bahasa Indonesia",de:"Deutsch","fr-fr":"Français"};function _t(t){return t==="active"?a.statusActive:t==="grace"?a.statusGrace:t==="invalid"||t==="revoked"?a.statusError:a.statusInactive}function kt(t){return t?t.refreshBlockedReason==="missing_session_token"?!0:t.status==="active"||t.status==="grace"||t.status==="invalid"||t.status==="revoked"||t.status==="unknown":!1}function Pt(t,s){return t.refreshBlockedReason==="missing_session_token"?{label:s("settings.license.status.activationRequired","Activation Required"),tooltip:s("settings.license.status.activationRequired.tooltip","Manual license activation is required before WEPPY Dashboard can refresh this status."),detail:s("settings.license.detail.missingSessionToken","Refresh is blocked because the current session token is missing."),detailTone:a.licenseNoticeWarning}:t.statusDetail==="active_cancel_pending"?{label:s("settings.license.active","Active"),tooltip:s("settings.license.status.activeCancelPending.tooltip","Cancellation is pending, but Pro access remains active until the current billing period ends."),detail:s("settings.license.detail.cancelPending","Cancellation is scheduled. Pro access remains active until the current billing period ends."),detailTone:a.licenseNoticeInfo}:t.statusDetail==="grace_provider_unavailable"?{label:s("settings.license.status.grace","Grace"),tooltip:s("settings.license.status.grace.tooltip","Provider verification is temporarily unavailable, but Pro access remains active during the grace period."),detail:s("settings.license.detail.graceProviderUnavailable","Provider unavailable. Pro access remains active during grace mode."),detailTone:a.licenseNoticeInfo}:t.statusDetail==="grace_expired"||t.statusDetail==="grace_payment_failed"?{label:s("settings.license.status.grace","Grace"),tooltip:s("settings.license.status.graceBilling.tooltip","Pro access is still available during a billing-related grace period."),detail:s("settings.license.detail.graceBilling","Pro access remains available during a billing grace period."),detailTone:a.licenseNoticeInfo}:{label:s(`settings.license.${t.status}`,t.status),tooltip:s(`settings.license.${t.status}.tooltip`,"Current license activation state."),detail:t.refreshRequired?s("settings.license.detail.refreshRecommended","License verification should be refreshed soon."):null,detailTone:a.licenseNoticeMuted}}function zt(){const{t,selectedLocale:s,setLocale:l}=X(),{trackEvent:d}=le(),{search:n}=ye(),{settings:b,license:i,licenseControlsDisabled:g,licenseSubmitting:p,licenseMessage:_,activateLicense:v,refreshLicense:k,resetLicense:P,saving:z,updateDashboardPreferences:x,loading:f}=Se(),[D,w]=r.useState(""),y=i?Pt(i,t):null,H=kt(i),L=H&&(i==null?void 0:i.refreshBlockedReason)!=="missing_session_token",A=H,$=H?i==null?void 0:i.maskedKey:void 0,N=i!=null&&i.provider&&i.provider!=="auto"?i.provider:void 0,j=(i==null?void 0:i.tier)==="pro"?"pro":"basic",E=r.useRef(null),S=r.useRef(null),B=r.useRef(null),U=r.useMemo(()=>new URLSearchParams(n).get("section")==="license",[n]),F=r.useMemo(()=>new URLSearchParams(n).get("section")==="dashboard",[n]);return r.useEffect(()=>{var T;if(!U||f)return;const c=E.current;if((T=c==null?void 0:c.scrollIntoView)==null||T.call(c,{block:"start",behavior:"smooth"}),B.current&&!B.current.disabled){B.current.focus();return}c==null||c.focus()},[f,g,p,U]),r.useEffect(()=>{var T;if(!F||f)return;const c=S.current;(T=c==null?void 0:c.scrollIntoView)==null||T.call(c,{block:"start",behavior:"smooth"}),c==null||c.focus()},[f,F]),f?e.jsx("div",{className:a.page,children:e.jsx("div",{className:a.loading,children:t("common.loading")})}):e.jsxs("div",{className:a.page,children:[e.jsx(ve,{title:t("page.settings.title","Settings"),description:t("page.settings.description","Manage license, saved data, server environment, and language."),helpTopicId:"settings",helpState:{tier:j}}),e.jsxs("div",{id:"settings-license",ref:E,tabIndex:-1,"data-testid":"settings-license-card",className:[a.card,U?a.licenseCardTarget:"",(i==null?void 0:i.tier)==="pro"?a.licenseCardPro:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:t("settings.license.title","License"),tooltip:t("settings.license.title.tooltip","Current license status and subscription tier.")}),e.jsx(m,{text:g?t("settings.license.disconnected.tooltip","Reconnect to the MCP server to manage license actions from WEPPY Dashboard."):t("settings.license.live.tooltip","License actions are sent to the MCP server immediately."),children:e.jsx("span",{className:`${a.headerBadge} ${g?"":a.headerBadgeLive}`,children:g?t("settings.license.disconnected","Disconnected"):t("settings.general.liveApply","Live Apply")})})]}),e.jsxs(e.Fragment,{children:[i?e.jsxs(e.Fragment,{children:[(()=>{const c=y;return e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.licenseGrid,children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.status","Status"),tooltip:t("settings.license.status.tooltip","Current license activation state.")})}),e.jsxs("dd",{children:[e.jsx("span",{className:`${a.statusDot} ${_t(i.status)}`}),e.jsx(m,{text:(c==null?void 0:c.tooltip)??t(`settings.license.${i.status}.tooltip`,"Current license activation state."),children:(c==null?void 0:c.label)??t(`settings.license.${i.status}`,i.status)})]}),e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.tier","Tier"),tooltip:t("settings.license.tier.tooltip","Current subscription tier for available WEPPY Dashboard features.")})}),e.jsx("dd",{className:i.tier==="pro"?a.proBadge:"",children:e.jsx(m,{text:t(`tier.${i.tier}.tooltip`,"Available feature set for the connected license."),children:i.tier==="pro"?t("tier.pro","Pro"):t("tier.basic","Basic")})}),$&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.key","Key"),tooltip:t("settings.license.key.tooltip","Masked license key currently loaded by the server.")})}),e.jsx("dd",{children:e.jsx(m,{text:t("settings.license.keyValue.tooltip","Masked license key currently loaded by the server."),children:$})})]}),N&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(R,{label:t("settings.license.provider","Provider"),tooltip:t("settings.license.provider.tooltip","License provider used to validate this key.")})}),e.jsx("dd",{children:e.jsx(m,{text:t("settings.license.providerValue.tooltip","License provider used to validate this key."),children:N})})]})]}),(c==null?void 0:c.detail)&&e.jsx("p",{className:`${a.licenseNotice} ${c.detailTone}`,children:i.refreshBlockedReason==="missing_session_token"?t("settings.license.detail.manualActivation","Manual activation required to restore Pro access."):c.detail}),i.refreshBlockedReason==="missing_session_token"&&e.jsx("p",{className:`${a.licenseNotice} ${a.licenseNoticeMuted}`,children:c==null?void 0:c.detail})]})})(),i.tier==="basic"&&e.jsx(m,{text:t("tier.upgrade.tooltip","View Pro features and purchase options."),children:e.jsx("a",{className:a.upgradeLink,href:je.settingsLicense,target:"_blank",rel:"noopener noreferrer",onClick:()=>d("dashboard_click_event",{click_target:"upgrade_cta",placement:"settings_license",page:"settings"}),children:t("tier.upgrade","View Pro")})})]}):e.jsx("div",{className:a.loading,children:t("settings.license.unavailable")}),e.jsxs("div",{className:a.licenseControls,children:[e.jsxs("div",{className:a.licenseControlRow,children:[e.jsx(m,{text:t("settings.license.refresh.tooltip","Re-fetch the current state from the license server. Useful when a billing change hasn't appeared yet."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p||!L,onClick:()=>{k()},children:p?t("common.loading"):t("settings.license.refresh","Refresh License")})}),e.jsx(m,{text:t("settings.license.reset.tooltip","Remove the currently registered license key. Use this before activating with a different key."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p||!A,onClick:()=>{P()},children:p?t("common.loading"):t("settings.license.reset","Reset License")})})]}),e.jsxs("div",{className:a.licenseControlRow,children:[e.jsxs("label",{className:`${a.licenseField} ${a.licenseFieldGrow}`,children:[e.jsx("span",{className:a.controlLabel,children:e.jsx(R,{label:t("settings.license.keyInput","License Key"),tooltip:t("settings.license.key.tooltip","Masked license key currently loaded by the server.")})}),e.jsx("input",{ref:B,"aria-label":t("settings.license.keyInput","License Key"),className:a.textInput,type:"text",value:D,disabled:g||p,onChange:c=>w(c.target.value)})]}),e.jsx(m,{text:t("settings.license.activate.tooltip","Activate Pro features with the entered license key."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:g||p,onClick:()=>{(async()=>await v(D)&&w(""))()},children:p?t("common.loading"):t("settings.license.activate","Activate License")})})]}),_&&e.jsx("p",{className:a.licenseMessage,children:_})]})]})]}),e.jsx(St,{tier:j}),b&&e.jsx(Ct,{ref:S,autoOpen:b.dashboard.autoOpen,settingsFilePath:b.dashboard.settingsFilePath,saving:z,targeted:F,updateDashboardPreferences:x}),e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(R,{label:t("settings.cold.title","Server Environment"),tooltip:t("settings.cold.title.tooltip","Read-only server environment values loaded at startup.")}),e.jsx(m,{text:t("settings.readOnly.tooltip","This section shows values that cannot be edited from WEPPY Dashboard."),children:e.jsx("span",{className:a.headerBadge,children:t("settings.readOnly","Read-only")})})]}),b?e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.coldGrid,children:[e.jsx("dt",{children:e.jsx(R,{label:"HTTP_PORT",tooltip:t("settings.cold.httpPort.tooltip","Port number used by the MCP WEPPY Dashboard HTTP server.")})}),e.jsx("dd",{children:b.cold.HTTP_PORT}),e.jsx("dt",{children:e.jsx(R,{label:"HTTP_HOST",tooltip:t("settings.cold.httpHost.tooltip","Host interface that the MCP WEPPY Dashboard HTTP server binds to.")})}),e.jsx("dd",{children:b.cold.HTTP_HOST})]}),e.jsx("p",{className:a.coldHint,children:t("settings.cold.hint","Set via environment variables to change these values.")})]}):e.jsx("div",{className:a.loading,children:t("settings.unavailable")})]}),e.jsxs("div",{className:a.card,children:[e.jsx("div",{className:a.cardHeader,children:e.jsx(R,{label:t("settings.language.title","Language"),tooltip:t("settings.language.title.tooltip","Choose how the WEPPY Dashboard interface text is localized.")})}),e.jsxs("div",{className:a.langRow,children:[e.jsx("label",{children:e.jsx(R,{label:t("settings.language.dashboard","WEPPY Dashboard Language"),tooltip:t("settings.language.dashboard.tooltip","Overrides the WEPPY Dashboard language or follows the system language when set to Auto.")})}),e.jsx(m,{text:t("settings.language.auto.tooltip","Follow the operating system's language. Falls back to English when not supported."),children:e.jsxs("select",{className:a.select,value:s,onChange:c=>l(c.target.value),children:[e.jsx("option",{value:xe,children:t("settings.language.auto","Auto")}),fe.map(c=>e.jsx("option",{value:c,children:Nt[c]??c},c))]})})]})]})]})}export{zt as Component};
@@ -1 +1 @@
1
- import{u as o,j as s}from"./index-ZP3F-qh6.js";const e="_badge_1ucqq_2",c="_dot_1ucqq_12",a="_online_1ucqq_20",l="_offline_1ucqq_25",_="_idle_1ucqq_30",u="_syncing_1ucqq_34",d="_initializing_1ucqq_35",n={badge:e,dot:c,online:a,offline:l,idle:_,syncing:u,initializing:d},g={online:"status.online",offline:"status.offline",idle:"status.idle",syncing:"status.syncing",initializing:"status.initializing"};function f({status:i}){const{t}=o();return s.jsxs("span",{className:n.badge,children:[s.jsx("span",{className:`${n.dot} ${n[i]}`}),t(g[i])]})}export{f as S};
1
+ import{u as o,j as s}from"./index-CG4GxcAc.js";const e="_badge_1ucqq_2",c="_dot_1ucqq_12",a="_online_1ucqq_20",l="_offline_1ucqq_25",_="_idle_1ucqq_30",u="_syncing_1ucqq_34",d="_initializing_1ucqq_35",n={badge:e,dot:c,online:a,offline:l,idle:_,syncing:u,initializing:d},g={online:"status.online",offline:"status.offline",idle:"status.idle",syncing:"status.syncing",initializing:"status.initializing"};function f({status:i}){const{t}=o();return s.jsxs("span",{className:n.badge,children:[s.jsx("span",{className:`${n.dot} ${n[i]}`}),t(g[i])]})}export{f as S};
@@ -1 +1 @@
1
- import{r as c,b,k as C,D as F,u as O,j as e,a as U,d as V,e as W,i as q,T as G}from"./index-ZP3F-qh6.js";import{B as R,a as P,P as z}from"./PageHeader-C1A4pFFD.js";import{I}from"./InfoLabel-BaayM8hW.js";import{T as j}from"./TooltipText-INE_h7BS.js";import{C as H}from"./ConfirmModal-CL0Z5xwJ.js";import{C as E}from"./CurrentPlaceScope-CHRh7s-z.js";import{S as Y}from"./StatusBadge-CiHSf_o_.js";import{T as K}from"./TierPromoPanel-DI3EP06A.js";import"./ConfirmModal.module-DJksQHBd.js";import"./PlaceSelectOptions-DU7Ka-gE.js";const J=5e3;function Q(){const[t,s]=c.useState(null),[l,a]=c.useState([]),[v,g]=c.useState(!0),[y,f]=c.useState(null),[_,w]=c.useState(null),[r,u]=c.useState({report:null,loading:!1,applying:!1,error:null}),D=c.useRef(null),N=c.useRef(null),x=c.useCallback(async()=>{var p;try{const[n,m]=await Promise.all([b.get("/sync/status"),b.get("/api/dashboard/place-summary")]);s(n);const T=(p=m.places)==null?void 0:p.find(M=>M.isActive);return f((T==null?void 0:T.placeDirName)??null),w(m.activePlaceId),m.activePlaceId}catch{return null}},[]),L=c.useCallback(async()=>{try{const p=await b.get("/sync/history",{limit:"30"});a(p.entries??[])}catch{a([])}},[]),o=c.useCallback(async p=>{if(p===null){u({report:null,loading:!1,applying:!1,error:null});return}u(n=>({...n,loading:!0,error:null}));try{const n=await b.get("/api/sync/migration",{placeId:String(p)});u(m=>({...m,report:n,loading:!1,error:n.status==="blocked"?"migration_blocked":null}))}catch(n){if(n instanceof C&&(n.status===404||n.status===503)){u(m=>({...m,report:null,loading:!1,error:null}));return}u(m=>({...m,loading:!1,error:"unknown"}))}},[]),h=c.useCallback(async()=>{const[p]=await Promise.all([x(),L()]);await o(p),g(!1)},[x,L,o]),k=c.useCallback(()=>{h()},[h]),A=c.useCallback(async()=>{await o(_)},[_,o]),d=c.useCallback(async()=>{const p=r.report;if(!(!p||p.status!=="ready"||r.applying)){u(n=>({...n,applying:!0,error:null}));try{const n=await b.post("/api/sync/migration",{placeId:p.placeId,fromVersion:2,previewFingerprint:p.previewFingerprint,apply:!0});u({report:n,loading:!1,applying:!1,error:null}),await x()}catch(n){if(n instanceof C&&n.status===409&&(n.error==="preview_stale"||n.error==="migration_blocked")){const m=n.error;await o(p.placeId),u(T=>({...T,applying:!1,error:m}));return}u(m=>({...m,applying:!1,error:"unknown"}))}}},[o,x,r.applying,r.report]),S=c.useCallback(async()=>{await b.post("/api/dashboard/sync/history/clear"),a([]),x()},[x]);return c.useEffect(()=>(h(),N.current=setInterval(h,J),()=>{N.current&&clearInterval(N.current)}),[h]),c.useEffect(()=>{const p=new F;D.current=p,p.connect();const n=p.on("sync",()=>{h()});return()=>{n(),p.disconnect(),D.current=null}},[h]),{status:t,history:l,loading:v,activePlaceDirName:y,migration:r,refresh:k,refreshMigration:A,applyMigration:d,clearHistory:S}}const X="_page_1rrgy_2",Z="_card_1rrgy_10",ee="_cardHeader_1rrgy_17",te="_clearButton_1rrgy_29",ie="_statusRow_1rrgy_53",oe="_metaItem_1rrgy_60",ae="_statusGrid_1rrgy_66",se="_migrationPanel_1rrgy_85",re="_migrationHeader_1rrgy_92",ne="_migrationTitle_1rrgy_99",ce="_migrationDescription_1rrgy_108",le="_migrationLedger_1rrgy_116",pe="_migrationLedgerItem_1rrgy_123",ye="_migrationLedgerBlocked_1rrgy_148",de="_migrationSection_1rrgy_152",ue="_migrationList_1rrgy_166",ge="_migrationRow_1rrgy_176",me="_migrationOperation_1rrgy_189",he="_migrationRowBody_1rrgy_194",fe="_migrationNotice_1rrgy_215",_e="_migrationActions_1rrgy_222",xe="_migrationButton_1rrgy_228",je="_policySummary_1rrgy_265",ve="_policySummaryItem_1rrgy_276",Se="_policyPrimaryValue_1rrgy_301",we="_policyReviewNotice_1rrgy_307",Ne="_policyApplySection_1rrgy_318",be="_policyApplyHeader_1rrgy_322",Ie="_policyApplyTitle_1rrgy_326",Le="_policyApplyDescription_1rrgy_334",Te="_policyInfoLabel_1rrgy_342",Re="_policySafetyRow_1rrgy_353",De="_policySafetyLabel_1rrgy_365",ke="_policySafetyBadge_1rrgy_371",Ae="_policyDisclosure_1rrgy_375",Ce="_policyDisclosureIcon_1rrgy_407",Pe="_policyDisclosureIconOpen_1rrgy_414",Ee="_policyScopeList_1rrgy_418",Be="_policyScopeRow_1rrgy_425",$e="_policyScopeName_1rrgy_439",Oe="_policyDirectionRail_1rrgy_451",He="_policyDirectionEndpoint_1rrgy_467",Me="_policyDirectionEndpointStudio_1rrgy_474",Fe="_policyDirectionArrow_1rrgy_478",Ue="_forwardBadge_1rrgy_521",Ve="_logContainer_1rrgy_536",We="_logEntry_1rrgy_543",qe="_logTime_1rrgy_555",Ge="_logType_1rrgy_561",ze="_logTypeWrite_1rrgy_570",Ye="_logTypeUpdate_1rrgy_574",Ke="_logTypeDelete_1rrgy_578",Je="_logTypeIdle_1rrgy_582",Qe="_logPath_1rrgy_586",Xe="_logEmpty_1rrgy_593",Ze="_overlay_1rrgy_600",et="_overlayTitle_1rrgy_610",tt="_overlayMessage_1rrgy_617",it="_checklist_1rrgy_623",ot="_checkItem_1rrgy_633",i={page:X,card:Z,cardHeader:ee,clearButton:te,statusRow:ie,metaItem:oe,statusGrid:ae,migrationPanel:se,migrationHeader:re,migrationTitle:ne,migrationDescription:ce,migrationLedger:le,migrationLedgerItem:pe,migrationLedgerBlocked:ye,migrationSection:de,migrationList:ue,migrationRow:ge,migrationOperation:me,migrationRowBody:he,migrationNotice:fe,migrationActions:_e,migrationButton:xe,policySummary:je,policySummaryItem:ve,policyPrimaryValue:Se,policyReviewNotice:we,policyApplySection:Ne,policyApplyHeader:be,policyApplyTitle:Ie,policyApplyDescription:Le,policyInfoLabel:Te,policySafetyRow:Re,policySafetyLabel:De,policySafetyBadge:ke,policyDisclosure:Ae,policyDisclosureIcon:Ce,policyDisclosureIconOpen:Pe,policyScopeList:Ee,policyScopeRow:Be,policyScopeName:$e,policyDirectionRail:Oe,policyDirectionEndpoint:He,policyDirectionEndpointStudio:Me,policyDirectionArrow:Fe,forwardBadge:Ue,logContainer:Ve,logEntry:We,logTime:qe,logType:Ge,logTypeWrite:ze,logTypeUpdate:Ye,logTypeDelete:Ke,logTypeIdle:Je,logPath:Qe,logEmpty:Xe,overlay:Ze,overlayTitle:et,overlayMessage:tt,checklist:it,checkItem:ot};function at(t){return t==="add"?"success":t==="delete"?"danger":"accent"}function st(t){return`sync.migration.reason.${t}`}function rt(t){return`sync.migration.reason.${t}`}function nt({migration:t,onRefresh:s,onApply:l}){const{t:a}=O(),[v,g]=c.useState(!1),y=t==null?void 0:t.report;if(!t||!y||y.status==="not_required")return null;const f=y.status==="blocked",_=y.status==="ready"&&!t.loading&&!t.applying,w=async()=>{await l(),g(!1)};return e.jsxs("section",{className:`${i.card} ${i.migrationPanel}`,"aria-labelledby":"sync-migration-title",children:[e.jsxs("div",{className:i.migrationHeader,children:[e.jsxs("div",{children:[e.jsx("h2",{id:"sync-migration-title",className:i.migrationTitle,children:a("sync.migration.title","Sync format update available")}),e.jsx("p",{className:i.migrationDescription,children:a("sync.migration.description","Review the metadata changes before updating this place from sync format v2 to v3.")})]}),e.jsx(R,{variant:f?"warning":"accent",children:f?a("sync.migration.status.blocked","Blocked"):a("sync.migration.status.ready","Ready to review")})]}),e.jsxs("div",{className:i.migrationLedger,"aria-label":a("sync.migration.preview","Review changes"),children:[e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.add","Add")}),e.jsx("strong",{children:y.summary.add})]}),e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.modify","Modify")}),e.jsx("strong",{children:y.summary.modify})]}),e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.delete","Delete")}),e.jsx("strong",{children:y.summary.delete})]}),e.jsxs("div",{className:`${i.migrationLedgerItem} ${f?i.migrationLedgerBlocked:""}`,children:[e.jsx("span",{children:a("sync.migration.summary.blocked","Blocked")}),e.jsx("strong",{children:y.summary.blocked})]})]}),y.changes.length>0&&e.jsxs("div",{className:i.migrationSection,children:[e.jsx("h3",{children:a("sync.migration.changes","Metadata changes")}),e.jsx("ul",{className:i.migrationList,children:y.changes.map(r=>e.jsxs("li",{className:i.migrationRow,children:[e.jsx(R,{variant:at(r.operation),className:i.migrationOperation,children:a(`sync.migration.operation.${r.operation}`,r.operation)}),e.jsxs("div",{className:i.migrationRowBody,children:[e.jsx("code",{children:r.path}),e.jsx("span",{children:a(st(r.reason),r.reason.replace(/_/g," "))})]})]},`${r.operation}:${r.path}`))})]}),y.blockers.length>0&&e.jsxs("div",{className:i.migrationSection,children:[e.jsx("h3",{children:a("sync.migration.blockers","Items to resolve")}),e.jsx("ul",{className:i.migrationList,children:y.blockers.map((r,u)=>e.jsxs("li",{className:i.migrationRow,children:[e.jsx(R,{variant:"warning",className:i.migrationOperation,children:a("sync.migration.summary.blocked","Blocked")}),e.jsxs("div",{className:i.migrationRowBody,children:[r.path&&e.jsx("code",{children:r.path}),e.jsx("span",{children:a(rt(r.reason),r.reason.replace(/_/g," "))})]})]},`${r.reason}:${r.path??u}`))})]}),e.jsxs("div",{className:i.migrationNotice,"aria-live":"polite",children:[(f||t.error==="migration_blocked")&&e.jsx("span",{children:a("sync.migration.blocked","Resolve sync conflicts before updating")}),t.error==="preview_stale"&&e.jsx("span",{children:a("sync.migration.stale","Preview changed. Review the latest diff.")}),t.error==="unknown"&&e.jsx("span",{children:a("sync.migration.error","Could not update the sync format. Try again.")})]}),e.jsxs("div",{className:i.migrationActions,children:[e.jsx(P,{variant:"secondary",className:i.migrationButton,disabled:t.loading||t.applying,onClick:()=>void s(),children:t.loading?a("sync.migration.refreshing","Refreshing…"):a("sync.migration.refresh","Refresh preview")}),e.jsx(P,{variant:"primary",className:i.migrationButton,disabled:!_,onClick:()=>g(!0),children:t.applying?a("sync.migration.applying","Applying…"):a("sync.migration.apply","Apply update")})]}),e.jsx(H,{open:v,title:a("sync.migration.confirm.title","Apply sync format update?"),message:a("sync.migration.confirm.message","Back up and update the listed sync metadata. Your Luau source files will not change."),cancelLabel:a("common.cancel","Cancel"),confirmLabel:a("sync.migration.apply","Apply update"),loading:t.applying,onCancel:()=>!t.applying&&g(!1),onConfirm:()=>void w()})]})}const ct=["scriptSource","properties","structure","serviceProperties"];function lt(t){const s=new Date(t);return`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`}function pt(t){switch(t){case"write":return i.logTypeWrite;case"update":return i.logTypeUpdate;case"delete":return i.logTypeDelete;default:return i.logTypeIdle}}function yt(t){switch(t){case"syncing":return"syncing";case"initializing":return"initializing";case"idle":return"idle";default:return"offline"}}function dt(t,s){const l={studio_first:"Studio First",bidirectional_review:"Bidirectional",local_code_studio_world:"Local Code, Studio World",custom:"Custom"};return t(`sync.policy.preset.${s}`,l[s])}function B(t,s){return s==="auto"?t("sync.policy.apply.auto","Auto apply"):t("sync.policy.apply.manual","Review first")}function ut(t,s){const l={forward:"Studio → Local",reverse:"Local → Studio",bidirectional:"Both ways"};return t(`sync.policy.direction.${s}`,l[s])}function gt(t){return{forward:"←",reverse:"→",bidirectional:"⇄"}[t]}function mt(t,s){const l={forward:"Studio changes are written to local files.",reverse:"Local file changes are applied to Studio.",bidirectional:"Changes can move from Studio to local files and from local files to Studio."};return t(`sync.policy.direction.${s}.tooltip`,l[s])}function $(...t){const s=t[0]??"",l=s.includes("\\")&&!s.includes("/")?"\\":"/";return t.filter(a=>a.length>0).map((a,v)=>v===0?a.replace(/[\\/]+$/g,""):a.replace(/^[\\/]+|[\\/]+$/g,"")).join(l)}function ht(t){const s=t.replace(/[\\/]+$/g,""),l=s.split(/[\\/]+/);return l[l.length-1]??s}function ft(t,s){const l=ht(t);return l==="explorer"?t:l===s?$(t,"explorer"):$(t,s,"explorer")}function _t(t,s){return s?t("sync.policy.safety.auto","Auto delete to Studio"):t("sync.policy.safety.review","Review before delete")}function xt(t,s){return s?t("sync.policy.safety.auto.tooltip","Deleting local files may automatically remove matching Studio instances. This is separate from UI Studio automatic cleanup."):t("sync.policy.safety.review.tooltip","Local file deletions wait for review before matching Studio instances are removed. This is separate from UI Studio automatic cleanup.")}function jt(t,s){switch(s){case"write":return t("sync.log.type.write","WRITE");case"update":return t("sync.log.type.update","UPDATE");case"delete":return t("sync.log.type.delete","DELETE");default:return t("sync.log.type.idle","IDLE")}}function vt(t,s){switch(s){case"write":return t("sync.log.type.write.tooltip","A new sync output was written to disk.");case"update":return t("sync.log.type.update.tooltip","An existing synced file or instance was updated.");case"delete":return t("sync.log.type.delete.tooltip","A synced file or instance was removed.");default:return t("sync.log.type.idle.tooltip","A sync event was recorded without a file mutation.")}}function At(){const{t}=O(),{trackEvent:s}=U(),{level:l}=V(),{tier:a,loading:v}=W(),g=Q(),{show:y}=q(),[f,_]=c.useState(!1),[w,r]=c.useState(!1),[u,D]=c.useState(!1),N=!v&&a==="basic",x=l==="disconnected"||l==="serverOnly",L=e.jsx(z,{title:t("page.sync.title","Sync"),description:t("page.sync.description","Monitor Studio to local sync status, direction, apply mode, and recent sync logs."),helpTopicId:"sync",helpState:{connectionLevel:l,tier:a}});if(x)return e.jsxs("div",{className:i.page,children:[L,e.jsx(E,{surface:"sync"}),e.jsx("div",{className:i.card,children:e.jsxs("div",{className:i.overlay,children:[e.jsx("div",{className:i.overlayTitle,children:t("sync.overlay.title","Roblox Studio plugin required")}),e.jsx("div",{className:i.overlayMessage,children:t("sync.overlay.message","Sync status will be available once the Roblox Studio plugin connects.")}),e.jsxs("ul",{className:i.checklist,children:[e.jsx("li",{className:i.checkItem,children:t("sync.overlay.check1","Is Roblox Studio running?")}),e.jsx("li",{className:i.checkItem,children:t("sync.overlay.check2","Is the WEPPY Plugin installed?")})]})]})})]});const o=g.status,h=g.history,k=yt(o==null?void 0:o.state),A=async()=>{r(!0);try{await g.clearHistory(),y(t("toast.clearSuccess","Cleared successfully"),"success"),_(!1)}catch{y(t("toast.clearFailed","Failed to clear data"),"error")}finally{r(!1)}};return e.jsxs("div",{className:i.page,children:[L,e.jsx(E,{surface:"sync"}),e.jsxs("div",{className:i.card,children:[e.jsxs("div",{className:i.cardHeader,children:[e.jsx(j,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),N&&e.jsx(j,{text:t("sync.status.forwardOnly.tooltip","Basic tier allows Studio to local forward sync only."),children:e.jsx("span",{className:i.forwardBadge,children:t("sync.status.forwardOnly","Forward Only")})})]}),e.jsxs("div",{className:i.statusRow,children:[e.jsx(Y,{status:k}),(o==null?void 0:o.placeName)&&e.jsxs("span",{className:i.metaItem,children:[e.jsx(I,{label:t("sync.status.place","Place"),tooltip:t("sync.status.place.tooltip","Connected Roblox place name and place ID.")}),": ",o.placeName,o.placeId?` (${o.placeId})`:""]})]}),e.jsxs("dl",{className:i.statusGrid,children:[(o==null?void 0:o.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.path","Place Root"),tooltip:t("sync.status.path.tooltip","Local filesystem root currently used for this place sync output.")})}),e.jsx("dd",{children:o.syncRoot})]}),g.activePlaceDirName&&(o==null?void 0:o.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.placePath","Explorer Path"),tooltip:t("sync.status.placePath.tooltip","Explorer files path for the active place.")})}),e.jsx("dd",{children:ft(o.syncRoot,g.activePlaceDirName)})]}),(o==null?void 0:o.instanceCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.instances","Instances"),tooltip:t("sync.status.instances.tooltip","Total synced Roblox instances tracked in the local mirror.")})}),e.jsx("dd",{children:o.instanceCount})]}),(o==null?void 0:o.scriptCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.scripts","Scripts"),tooltip:t("sync.status.scripts.tooltip","Total synced script files currently indexed for this place.")})}),e.jsx("dd",{children:o.scriptCount})]}),(o==null?void 0:o.state)==="syncing"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.state","State"),tooltip:t("sync.status.state.tooltip","Current runtime sync state reported by the server.")})}),e.jsx("dd",{children:t("status.syncing","Syncing")})]})]})]}),e.jsx(nt,{migration:g.migration,onRefresh:g.refreshMigration,onApply:g.applyMigration}),(o==null?void 0:o.policy)&&e.jsxs("div",{className:i.card,children:[e.jsx("div",{className:i.cardHeader,children:e.jsx(j,{text:t("sync.policy.title.tooltip","Effective Sync policy reported by the connected Studio plugin."),children:t("sync.policy.title","Sync Policy")})}),e.jsxs("dl",{className:i.policySummary,children:[e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.activation","Activation")}),e.jsx("dd",{children:e.jsx(R,{variant:o.syncEnabled?"success":"neutral",children:o.syncEnabled?t("sync.policy.activation.on","Sync ON"):t("sync.policy.activation.off","Sync OFF")})})]}),e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.preset","Workflow")}),e.jsx("dd",{className:i.policyPrimaryValue,children:dt(t,o.policy.preset)})]})]}),o.policyReviewRequired&&e.jsx("div",{className:i.policyReviewNotice,role:"status",children:t("sync.policy.reviewRequired","Review this policy in the Studio plugin before starting Sync.")}),e.jsxs("section",{className:i.policyApplySection,"aria-labelledby":"sync-policy-apply-title",children:[e.jsxs("div",{className:i.policyApplyHeader,children:[e.jsx("h3",{id:"sync-policy-apply-title",className:i.policyApplyTitle,children:t("sync.policy.apply.title","How local changes apply to Studio")}),e.jsx("p",{className:i.policyApplyDescription,children:t("sync.policy.apply.description","Shows whether changes made locally are reviewed first or applied to Studio automatically.")})]}),e.jsxs("dl",{className:i.policySummary,children:[e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(j,{text:t("sync.policy.apply.content.tooltip","Script Source, property, and Service property changes made locally. Instance creation, deletion, renaming, and moves are Structure changes."),children:e.jsx("span",{className:i.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.content","Content changes")})})}),e.jsx("dd",{children:B(t,o.policy.apply.contentChanges)})]}),e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(j,{text:t("sync.policy.apply.structure.tooltip","Instance creation, deletion, renaming, and moves made locally. Automatic local deletion additionally requires the separate delete option below."),children:e.jsx("span",{className:i.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.structure","Structure changes")})})}),e.jsx("dd",{children:B(t,o.policy.apply.structureChanges)})]})]}),e.jsxs("div",{className:i.policySafetyRow,children:[e.jsx("span",{className:i.policySafetyLabel,children:t("sync.policy.safety.localDeletes","Local delete → Studio instance removal")}),e.jsx(j,{text:xt(t,o.policy.autoApplyLocalDeletesToStudio),children:e.jsx(R,{variant:o.policy.autoApplyLocalDeletesToStudio?"warning":"neutral",className:i.policySafetyBadge,tabIndex:0,children:_t(t,o.policy.autoApplyLocalDeletesToStudio)})})]})]}),e.jsxs("button",{type:"button",className:i.policyDisclosure,"aria-expanded":u,"aria-controls":"sync-policy-scope-panel",onClick:()=>D(d=>!d),children:[e.jsx("span",{children:t("sync.policy.scope.disclosure","Scope directions")}),e.jsx("span",{"aria-hidden":"true",className:`${i.policyDisclosureIcon} ${u?i.policyDisclosureIconOpen:""}`,children:"⌄"})]}),u&&e.jsx("div",{id:"sync-policy-scope-panel",className:i.policyScopeList,children:ct.map(d=>{const S=o.policy.directions[d];return e.jsxs("div",{className:i.policyScopeRow,"data-testid":"sync-policy-scope-row",children:[e.jsx("span",{className:i.policyScopeName,children:t(`sync.policy.scope.${d}`,d)}),e.jsx(j,{text:mt(t,S),children:e.jsxs("span",{className:i.policyDirectionRail,"data-testid":"sync-policy-direction-rail",role:"img","aria-label":ut(t,S),tabIndex:0,children:[e.jsx("span",{className:i.policyDirectionEndpoint,children:t("sync.policy.endpoint.local","Local")}),e.jsx("span",{className:i.policyDirectionArrow,"aria-hidden":"true",children:gt(S)}),e.jsx("span",{className:`${i.policyDirectionEndpoint} ${i.policyDirectionEndpointStudio}`,children:t("sync.policy.endpoint.studio","Studio")})]})})]},d)})})]}),e.jsxs("div",{className:i.card,children:[e.jsxs("div",{className:i.cardHeader,children:[e.jsx("span",{children:t("sync.log.title","Sync Log")}),e.jsx("button",{className:i.clearButton,onClick:()=>{s("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),_(!0)},children:t("common.clear","Clear")})]}),e.jsx("div",{className:i.logContainer,children:h.length===0?e.jsx("div",{className:i.logEmpty,children:t("sync.log.empty","No sync events yet")}):h.map((d,S)=>e.jsxs("div",{className:i.logEntry,children:[e.jsx("span",{className:i.logTime,children:lt(d.timestamp)}),e.jsx(j,{text:vt(t,d.type),children:e.jsx("span",{className:`${i.logType} ${pt(d.type)}`,children:jt(t,d.type)})}),e.jsxs("span",{className:i.logPath,children:[d.path,d.details?` — ${d.details}`:""]})]},S))})]}),N&&e.jsx(K,{title:t("sync.upgrade.title","Explore Full Sync with Pro"),description:t("tier.banner.save","Save AI tokens with Pro!"),benefits:[t("sync.upgrade.benefit1","Bidirectional sync — edit files, auto-apply to Studio"),t("sync.upgrade.benefit2","Reverse sync — push file changes back to Studio"),t("sync.upgrade.benefit3","Full sync history and detailed change log")],upgradeLabel:t("sync.upgrade.buy","View Pro"),upgradeHref:G.sync}),e.jsx(H,{open:f,title:t("sync.clear.title","Clear sync log?"),message:t("sync.clear.message","This permanently removes the stored sync log for the current place."),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:w,onCancel:()=>!w&&_(!1),onConfirm:A})]})}export{At as Component};
1
+ import{r as c,b,k as C,D as F,u as O,j as e,a as U,d as V,e as W,i as q,T as G}from"./index-CG4GxcAc.js";import{B as R,a as P,P as z}from"./PageHeader-Dc41DgFB.js";import{I}from"./InfoLabel-CAGC3efT.js";import{T as j}from"./TooltipText-C0DmdntK.js";import{C as H}from"./ConfirmModal-Ddk0UX_P.js";import{C as E}from"./CurrentPlaceScope-Y25KxsHT.js";import{S as Y}from"./StatusBadge-Cdfb5vyE.js";import{T as K}from"./TierPromoPanel-B0BctivD.js";import"./ConfirmModal.module-DJksQHBd.js";import"./PlaceSelectOptions-Gd2pK9DL.js";const J=5e3;function Q(){const[t,s]=c.useState(null),[l,a]=c.useState([]),[v,g]=c.useState(!0),[y,f]=c.useState(null),[_,w]=c.useState(null),[r,u]=c.useState({report:null,loading:!1,applying:!1,error:null}),D=c.useRef(null),N=c.useRef(null),x=c.useCallback(async()=>{var p;try{const[n,m]=await Promise.all([b.get("/sync/status"),b.get("/api/dashboard/place-summary")]);s(n);const T=(p=m.places)==null?void 0:p.find(M=>M.isActive);return f((T==null?void 0:T.placeDirName)??null),w(m.activePlaceId),m.activePlaceId}catch{return null}},[]),L=c.useCallback(async()=>{try{const p=await b.get("/sync/history",{limit:"30"});a(p.entries??[])}catch{a([])}},[]),o=c.useCallback(async p=>{if(p===null){u({report:null,loading:!1,applying:!1,error:null});return}u(n=>({...n,loading:!0,error:null}));try{const n=await b.get("/api/sync/migration",{placeId:String(p)});u(m=>({...m,report:n,loading:!1,error:n.status==="blocked"?"migration_blocked":null}))}catch(n){if(n instanceof C&&(n.status===404||n.status===503)){u(m=>({...m,report:null,loading:!1,error:null}));return}u(m=>({...m,loading:!1,error:"unknown"}))}},[]),h=c.useCallback(async()=>{const[p]=await Promise.all([x(),L()]);await o(p),g(!1)},[x,L,o]),k=c.useCallback(()=>{h()},[h]),A=c.useCallback(async()=>{await o(_)},[_,o]),d=c.useCallback(async()=>{const p=r.report;if(!(!p||p.status!=="ready"||r.applying)){u(n=>({...n,applying:!0,error:null}));try{const n=await b.post("/api/sync/migration",{placeId:p.placeId,fromVersion:2,previewFingerprint:p.previewFingerprint,apply:!0});u({report:n,loading:!1,applying:!1,error:null}),await x()}catch(n){if(n instanceof C&&n.status===409&&(n.error==="preview_stale"||n.error==="migration_blocked")){const m=n.error;await o(p.placeId),u(T=>({...T,applying:!1,error:m}));return}u(m=>({...m,applying:!1,error:"unknown"}))}}},[o,x,r.applying,r.report]),S=c.useCallback(async()=>{await b.post("/api/dashboard/sync/history/clear"),a([]),x()},[x]);return c.useEffect(()=>(h(),N.current=setInterval(h,J),()=>{N.current&&clearInterval(N.current)}),[h]),c.useEffect(()=>{const p=new F;D.current=p,p.connect();const n=p.on("sync",()=>{h()});return()=>{n(),p.disconnect(),D.current=null}},[h]),{status:t,history:l,loading:v,activePlaceDirName:y,migration:r,refresh:k,refreshMigration:A,applyMigration:d,clearHistory:S}}const X="_page_1rrgy_2",Z="_card_1rrgy_10",ee="_cardHeader_1rrgy_17",te="_clearButton_1rrgy_29",ie="_statusRow_1rrgy_53",oe="_metaItem_1rrgy_60",ae="_statusGrid_1rrgy_66",se="_migrationPanel_1rrgy_85",re="_migrationHeader_1rrgy_92",ne="_migrationTitle_1rrgy_99",ce="_migrationDescription_1rrgy_108",le="_migrationLedger_1rrgy_116",pe="_migrationLedgerItem_1rrgy_123",ye="_migrationLedgerBlocked_1rrgy_148",de="_migrationSection_1rrgy_152",ue="_migrationList_1rrgy_166",ge="_migrationRow_1rrgy_176",me="_migrationOperation_1rrgy_189",he="_migrationRowBody_1rrgy_194",fe="_migrationNotice_1rrgy_215",_e="_migrationActions_1rrgy_222",xe="_migrationButton_1rrgy_228",je="_policySummary_1rrgy_265",ve="_policySummaryItem_1rrgy_276",Se="_policyPrimaryValue_1rrgy_301",we="_policyReviewNotice_1rrgy_307",Ne="_policyApplySection_1rrgy_318",be="_policyApplyHeader_1rrgy_322",Ie="_policyApplyTitle_1rrgy_326",Le="_policyApplyDescription_1rrgy_334",Te="_policyInfoLabel_1rrgy_342",Re="_policySafetyRow_1rrgy_353",De="_policySafetyLabel_1rrgy_365",ke="_policySafetyBadge_1rrgy_371",Ae="_policyDisclosure_1rrgy_375",Ce="_policyDisclosureIcon_1rrgy_407",Pe="_policyDisclosureIconOpen_1rrgy_414",Ee="_policyScopeList_1rrgy_418",Be="_policyScopeRow_1rrgy_425",$e="_policyScopeName_1rrgy_439",Oe="_policyDirectionRail_1rrgy_451",He="_policyDirectionEndpoint_1rrgy_467",Me="_policyDirectionEndpointStudio_1rrgy_474",Fe="_policyDirectionArrow_1rrgy_478",Ue="_forwardBadge_1rrgy_521",Ve="_logContainer_1rrgy_536",We="_logEntry_1rrgy_543",qe="_logTime_1rrgy_555",Ge="_logType_1rrgy_561",ze="_logTypeWrite_1rrgy_570",Ye="_logTypeUpdate_1rrgy_574",Ke="_logTypeDelete_1rrgy_578",Je="_logTypeIdle_1rrgy_582",Qe="_logPath_1rrgy_586",Xe="_logEmpty_1rrgy_593",Ze="_overlay_1rrgy_600",et="_overlayTitle_1rrgy_610",tt="_overlayMessage_1rrgy_617",it="_checklist_1rrgy_623",ot="_checkItem_1rrgy_633",i={page:X,card:Z,cardHeader:ee,clearButton:te,statusRow:ie,metaItem:oe,statusGrid:ae,migrationPanel:se,migrationHeader:re,migrationTitle:ne,migrationDescription:ce,migrationLedger:le,migrationLedgerItem:pe,migrationLedgerBlocked:ye,migrationSection:de,migrationList:ue,migrationRow:ge,migrationOperation:me,migrationRowBody:he,migrationNotice:fe,migrationActions:_e,migrationButton:xe,policySummary:je,policySummaryItem:ve,policyPrimaryValue:Se,policyReviewNotice:we,policyApplySection:Ne,policyApplyHeader:be,policyApplyTitle:Ie,policyApplyDescription:Le,policyInfoLabel:Te,policySafetyRow:Re,policySafetyLabel:De,policySafetyBadge:ke,policyDisclosure:Ae,policyDisclosureIcon:Ce,policyDisclosureIconOpen:Pe,policyScopeList:Ee,policyScopeRow:Be,policyScopeName:$e,policyDirectionRail:Oe,policyDirectionEndpoint:He,policyDirectionEndpointStudio:Me,policyDirectionArrow:Fe,forwardBadge:Ue,logContainer:Ve,logEntry:We,logTime:qe,logType:Ge,logTypeWrite:ze,logTypeUpdate:Ye,logTypeDelete:Ke,logTypeIdle:Je,logPath:Qe,logEmpty:Xe,overlay:Ze,overlayTitle:et,overlayMessage:tt,checklist:it,checkItem:ot};function at(t){return t==="add"?"success":t==="delete"?"danger":"accent"}function st(t){return`sync.migration.reason.${t}`}function rt(t){return`sync.migration.reason.${t}`}function nt({migration:t,onRefresh:s,onApply:l}){const{t:a}=O(),[v,g]=c.useState(!1),y=t==null?void 0:t.report;if(!t||!y||y.status==="not_required")return null;const f=y.status==="blocked",_=y.status==="ready"&&!t.loading&&!t.applying,w=async()=>{await l(),g(!1)};return e.jsxs("section",{className:`${i.card} ${i.migrationPanel}`,"aria-labelledby":"sync-migration-title",children:[e.jsxs("div",{className:i.migrationHeader,children:[e.jsxs("div",{children:[e.jsx("h2",{id:"sync-migration-title",className:i.migrationTitle,children:a("sync.migration.title","Sync format update available")}),e.jsx("p",{className:i.migrationDescription,children:a("sync.migration.description","Review the metadata changes before updating this place from sync format v2 to v3.")})]}),e.jsx(R,{variant:f?"warning":"accent",children:f?a("sync.migration.status.blocked","Blocked"):a("sync.migration.status.ready","Ready to review")})]}),e.jsxs("div",{className:i.migrationLedger,"aria-label":a("sync.migration.preview","Review changes"),children:[e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.add","Add")}),e.jsx("strong",{children:y.summary.add})]}),e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.modify","Modify")}),e.jsx("strong",{children:y.summary.modify})]}),e.jsxs("div",{className:i.migrationLedgerItem,children:[e.jsx("span",{children:a("sync.migration.summary.delete","Delete")}),e.jsx("strong",{children:y.summary.delete})]}),e.jsxs("div",{className:`${i.migrationLedgerItem} ${f?i.migrationLedgerBlocked:""}`,children:[e.jsx("span",{children:a("sync.migration.summary.blocked","Blocked")}),e.jsx("strong",{children:y.summary.blocked})]})]}),y.changes.length>0&&e.jsxs("div",{className:i.migrationSection,children:[e.jsx("h3",{children:a("sync.migration.changes","Metadata changes")}),e.jsx("ul",{className:i.migrationList,children:y.changes.map(r=>e.jsxs("li",{className:i.migrationRow,children:[e.jsx(R,{variant:at(r.operation),className:i.migrationOperation,children:a(`sync.migration.operation.${r.operation}`,r.operation)}),e.jsxs("div",{className:i.migrationRowBody,children:[e.jsx("code",{children:r.path}),e.jsx("span",{children:a(st(r.reason),r.reason.replace(/_/g," "))})]})]},`${r.operation}:${r.path}`))})]}),y.blockers.length>0&&e.jsxs("div",{className:i.migrationSection,children:[e.jsx("h3",{children:a("sync.migration.blockers","Items to resolve")}),e.jsx("ul",{className:i.migrationList,children:y.blockers.map((r,u)=>e.jsxs("li",{className:i.migrationRow,children:[e.jsx(R,{variant:"warning",className:i.migrationOperation,children:a("sync.migration.summary.blocked","Blocked")}),e.jsxs("div",{className:i.migrationRowBody,children:[r.path&&e.jsx("code",{children:r.path}),e.jsx("span",{children:a(rt(r.reason),r.reason.replace(/_/g," "))})]})]},`${r.reason}:${r.path??u}`))})]}),e.jsxs("div",{className:i.migrationNotice,"aria-live":"polite",children:[(f||t.error==="migration_blocked")&&e.jsx("span",{children:a("sync.migration.blocked","Resolve sync conflicts before updating")}),t.error==="preview_stale"&&e.jsx("span",{children:a("sync.migration.stale","Preview changed. Review the latest diff.")}),t.error==="unknown"&&e.jsx("span",{children:a("sync.migration.error","Could not update the sync format. Try again.")})]}),e.jsxs("div",{className:i.migrationActions,children:[e.jsx(P,{variant:"secondary",className:i.migrationButton,disabled:t.loading||t.applying,onClick:()=>void s(),children:t.loading?a("sync.migration.refreshing","Refreshing…"):a("sync.migration.refresh","Refresh preview")}),e.jsx(P,{variant:"primary",className:i.migrationButton,disabled:!_,onClick:()=>g(!0),children:t.applying?a("sync.migration.applying","Applying…"):a("sync.migration.apply","Apply update")})]}),e.jsx(H,{open:v,title:a("sync.migration.confirm.title","Apply sync format update?"),message:a("sync.migration.confirm.message","Back up and update the listed sync metadata. Your Luau source files will not change."),cancelLabel:a("common.cancel","Cancel"),confirmLabel:a("sync.migration.apply","Apply update"),loading:t.applying,onCancel:()=>!t.applying&&g(!1),onConfirm:()=>void w()})]})}const ct=["scriptSource","properties","structure","serviceProperties"];function lt(t){const s=new Date(t);return`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`}function pt(t){switch(t){case"write":return i.logTypeWrite;case"update":return i.logTypeUpdate;case"delete":return i.logTypeDelete;default:return i.logTypeIdle}}function yt(t){switch(t){case"syncing":return"syncing";case"initializing":return"initializing";case"idle":return"idle";default:return"offline"}}function dt(t,s){const l={studio_first:"Studio First",bidirectional_review:"Bidirectional",local_code_studio_world:"Local Code, Studio World",custom:"Custom"};return t(`sync.policy.preset.${s}`,l[s])}function B(t,s){return s==="auto"?t("sync.policy.apply.auto","Auto apply"):t("sync.policy.apply.manual","Review first")}function ut(t,s){const l={forward:"Studio → Local",reverse:"Local → Studio",bidirectional:"Both ways"};return t(`sync.policy.direction.${s}`,l[s])}function gt(t){return{forward:"←",reverse:"→",bidirectional:"⇄"}[t]}function mt(t,s){const l={forward:"Studio changes are written to local files.",reverse:"Local file changes are applied to Studio.",bidirectional:"Changes can move from Studio to local files and from local files to Studio."};return t(`sync.policy.direction.${s}.tooltip`,l[s])}function $(...t){const s=t[0]??"",l=s.includes("\\")&&!s.includes("/")?"\\":"/";return t.filter(a=>a.length>0).map((a,v)=>v===0?a.replace(/[\\/]+$/g,""):a.replace(/^[\\/]+|[\\/]+$/g,"")).join(l)}function ht(t){const s=t.replace(/[\\/]+$/g,""),l=s.split(/[\\/]+/);return l[l.length-1]??s}function ft(t,s){const l=ht(t);return l==="explorer"?t:l===s?$(t,"explorer"):$(t,s,"explorer")}function _t(t,s){return s?t("sync.policy.safety.auto","Auto delete to Studio"):t("sync.policy.safety.review","Review before delete")}function xt(t,s){return s?t("sync.policy.safety.auto.tooltip","Deleting local files may automatically remove matching Studio instances. This is separate from UI Studio automatic cleanup."):t("sync.policy.safety.review.tooltip","Local file deletions wait for review before matching Studio instances are removed. This is separate from UI Studio automatic cleanup.")}function jt(t,s){switch(s){case"write":return t("sync.log.type.write","WRITE");case"update":return t("sync.log.type.update","UPDATE");case"delete":return t("sync.log.type.delete","DELETE");default:return t("sync.log.type.idle","IDLE")}}function vt(t,s){switch(s){case"write":return t("sync.log.type.write.tooltip","A new sync output was written to disk.");case"update":return t("sync.log.type.update.tooltip","An existing synced file or instance was updated.");case"delete":return t("sync.log.type.delete.tooltip","A synced file or instance was removed.");default:return t("sync.log.type.idle.tooltip","A sync event was recorded without a file mutation.")}}function At(){const{t}=O(),{trackEvent:s}=U(),{level:l}=V(),{tier:a,loading:v}=W(),g=Q(),{show:y}=q(),[f,_]=c.useState(!1),[w,r]=c.useState(!1),[u,D]=c.useState(!1),N=!v&&a==="basic",x=l==="disconnected"||l==="serverOnly",L=e.jsx(z,{title:t("page.sync.title","Sync"),description:t("page.sync.description","Monitor Studio to local sync status, direction, apply mode, and recent sync logs."),helpTopicId:"sync",helpState:{connectionLevel:l,tier:a}});if(x)return e.jsxs("div",{className:i.page,children:[L,e.jsx(E,{surface:"sync"}),e.jsx("div",{className:i.card,children:e.jsxs("div",{className:i.overlay,children:[e.jsx("div",{className:i.overlayTitle,children:t("sync.overlay.title","Roblox Studio plugin required")}),e.jsx("div",{className:i.overlayMessage,children:t("sync.overlay.message","Sync status will be available once the Roblox Studio plugin connects.")}),e.jsxs("ul",{className:i.checklist,children:[e.jsx("li",{className:i.checkItem,children:t("sync.overlay.check1","Is Roblox Studio running?")}),e.jsx("li",{className:i.checkItem,children:t("sync.overlay.check2","Is the WEPPY Plugin installed?")})]})]})})]});const o=g.status,h=g.history,k=yt(o==null?void 0:o.state),A=async()=>{r(!0);try{await g.clearHistory(),y(t("toast.clearSuccess","Cleared successfully"),"success"),_(!1)}catch{y(t("toast.clearFailed","Failed to clear data"),"error")}finally{r(!1)}};return e.jsxs("div",{className:i.page,children:[L,e.jsx(E,{surface:"sync"}),e.jsxs("div",{className:i.card,children:[e.jsxs("div",{className:i.cardHeader,children:[e.jsx(j,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),N&&e.jsx(j,{text:t("sync.status.forwardOnly.tooltip","Basic tier allows Studio to local forward sync only."),children:e.jsx("span",{className:i.forwardBadge,children:t("sync.status.forwardOnly","Forward Only")})})]}),e.jsxs("div",{className:i.statusRow,children:[e.jsx(Y,{status:k}),(o==null?void 0:o.placeName)&&e.jsxs("span",{className:i.metaItem,children:[e.jsx(I,{label:t("sync.status.place","Place"),tooltip:t("sync.status.place.tooltip","Connected Roblox place name and place ID.")}),": ",o.placeName,o.placeId?` (${o.placeId})`:""]})]}),e.jsxs("dl",{className:i.statusGrid,children:[(o==null?void 0:o.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.path","Place Root"),tooltip:t("sync.status.path.tooltip","Local filesystem root currently used for this place sync output.")})}),e.jsx("dd",{children:o.syncRoot})]}),g.activePlaceDirName&&(o==null?void 0:o.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.placePath","Explorer Path"),tooltip:t("sync.status.placePath.tooltip","Explorer files path for the active place.")})}),e.jsx("dd",{children:ft(o.syncRoot,g.activePlaceDirName)})]}),(o==null?void 0:o.instanceCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.instances","Instances"),tooltip:t("sync.status.instances.tooltip","Total synced Roblox instances tracked in the local mirror.")})}),e.jsx("dd",{children:o.instanceCount})]}),(o==null?void 0:o.scriptCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.scripts","Scripts"),tooltip:t("sync.status.scripts.tooltip","Total synced script files currently indexed for this place.")})}),e.jsx("dd",{children:o.scriptCount})]}),(o==null?void 0:o.state)==="syncing"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(I,{label:t("sync.status.state","State"),tooltip:t("sync.status.state.tooltip","Current runtime sync state reported by the server.")})}),e.jsx("dd",{children:t("status.syncing","Syncing")})]})]})]}),e.jsx(nt,{migration:g.migration,onRefresh:g.refreshMigration,onApply:g.applyMigration}),(o==null?void 0:o.policy)&&e.jsxs("div",{className:i.card,children:[e.jsx("div",{className:i.cardHeader,children:e.jsx(j,{text:t("sync.policy.title.tooltip","Effective Sync policy reported by the connected Studio plugin."),children:t("sync.policy.title","Sync Policy")})}),e.jsxs("dl",{className:i.policySummary,children:[e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.activation","Activation")}),e.jsx("dd",{children:e.jsx(R,{variant:o.syncEnabled?"success":"neutral",children:o.syncEnabled?t("sync.policy.activation.on","Sync ON"):t("sync.policy.activation.off","Sync OFF")})})]}),e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.preset","Workflow")}),e.jsx("dd",{className:i.policyPrimaryValue,children:dt(t,o.policy.preset)})]})]}),o.policyReviewRequired&&e.jsx("div",{className:i.policyReviewNotice,role:"status",children:t("sync.policy.reviewRequired","Review this policy in the Studio plugin before starting Sync.")}),e.jsxs("section",{className:i.policyApplySection,"aria-labelledby":"sync-policy-apply-title",children:[e.jsxs("div",{className:i.policyApplyHeader,children:[e.jsx("h3",{id:"sync-policy-apply-title",className:i.policyApplyTitle,children:t("sync.policy.apply.title","How local changes apply to Studio")}),e.jsx("p",{className:i.policyApplyDescription,children:t("sync.policy.apply.description","Shows whether changes made locally are reviewed first or applied to Studio automatically.")})]}),e.jsxs("dl",{className:i.policySummary,children:[e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(j,{text:t("sync.policy.apply.content.tooltip","Script Source, property, and Service property changes made locally. Instance creation, deletion, renaming, and moves are Structure changes."),children:e.jsx("span",{className:i.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.content","Content changes")})})}),e.jsx("dd",{children:B(t,o.policy.apply.contentChanges)})]}),e.jsxs("div",{className:i.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(j,{text:t("sync.policy.apply.structure.tooltip","Instance creation, deletion, renaming, and moves made locally. Automatic local deletion additionally requires the separate delete option below."),children:e.jsx("span",{className:i.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.structure","Structure changes")})})}),e.jsx("dd",{children:B(t,o.policy.apply.structureChanges)})]})]}),e.jsxs("div",{className:i.policySafetyRow,children:[e.jsx("span",{className:i.policySafetyLabel,children:t("sync.policy.safety.localDeletes","Local delete → Studio instance removal")}),e.jsx(j,{text:xt(t,o.policy.autoApplyLocalDeletesToStudio),children:e.jsx(R,{variant:o.policy.autoApplyLocalDeletesToStudio?"warning":"neutral",className:i.policySafetyBadge,tabIndex:0,children:_t(t,o.policy.autoApplyLocalDeletesToStudio)})})]})]}),e.jsxs("button",{type:"button",className:i.policyDisclosure,"aria-expanded":u,"aria-controls":"sync-policy-scope-panel",onClick:()=>D(d=>!d),children:[e.jsx("span",{children:t("sync.policy.scope.disclosure","Scope directions")}),e.jsx("span",{"aria-hidden":"true",className:`${i.policyDisclosureIcon} ${u?i.policyDisclosureIconOpen:""}`,children:"⌄"})]}),u&&e.jsx("div",{id:"sync-policy-scope-panel",className:i.policyScopeList,children:ct.map(d=>{const S=o.policy.directions[d];return e.jsxs("div",{className:i.policyScopeRow,"data-testid":"sync-policy-scope-row",children:[e.jsx("span",{className:i.policyScopeName,children:t(`sync.policy.scope.${d}`,d)}),e.jsx(j,{text:mt(t,S),children:e.jsxs("span",{className:i.policyDirectionRail,"data-testid":"sync-policy-direction-rail",role:"img","aria-label":ut(t,S),tabIndex:0,children:[e.jsx("span",{className:i.policyDirectionEndpoint,children:t("sync.policy.endpoint.local","Local")}),e.jsx("span",{className:i.policyDirectionArrow,"aria-hidden":"true",children:gt(S)}),e.jsx("span",{className:`${i.policyDirectionEndpoint} ${i.policyDirectionEndpointStudio}`,children:t("sync.policy.endpoint.studio","Studio")})]})})]},d)})})]}),e.jsxs("div",{className:i.card,children:[e.jsxs("div",{className:i.cardHeader,children:[e.jsx("span",{children:t("sync.log.title","Sync Log")}),e.jsx("button",{className:i.clearButton,onClick:()=>{s("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),_(!0)},children:t("common.clear","Clear")})]}),e.jsx("div",{className:i.logContainer,children:h.length===0?e.jsx("div",{className:i.logEmpty,children:t("sync.log.empty","No sync events yet")}):h.map((d,S)=>e.jsxs("div",{className:i.logEntry,children:[e.jsx("span",{className:i.logTime,children:lt(d.timestamp)}),e.jsx(j,{text:vt(t,d.type),children:e.jsx("span",{className:`${i.logType} ${pt(d.type)}`,children:jt(t,d.type)})}),e.jsxs("span",{className:i.logPath,children:[d.path,d.details?` — ${d.details}`:""]})]},S))})]}),N&&e.jsx(K,{title:t("sync.upgrade.title","Explore Full Sync with Pro"),description:t("tier.banner.save","Save AI tokens with Pro!"),benefits:[t("sync.upgrade.benefit1","Bidirectional sync — edit files, auto-apply to Studio"),t("sync.upgrade.benefit2","Reverse sync — push file changes back to Studio"),t("sync.upgrade.benefit3","Full sync history and detailed change log")],upgradeLabel:t("sync.upgrade.buy","View Pro"),upgradeHref:G.sync}),e.jsx(H,{open:f,title:t("sync.clear.title","Clear sync log?"),message:t("sync.clear.message","This permanently removes the stored sync log for the current place."),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:w,onCancel:()=>!w&&_(!1),onConfirm:A})]})}export{At as Component};
@@ -1 +1 @@
1
- import{r,p as k,j as d}from"./index-ZP3F-qh6.js";const w="_backdrop_1sgib_1",T="_dialog_1sgib_19",j={backdrop:w,dialog:T},B=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(", ");function L(a){return Array.from(a.querySelectorAll(B))}function R(a){const s=document.activeElement;if(!(s instanceof HTMLElement))return!1;const c=s.closest('[role="dialog"][aria-modal="true"]');return c!==null&&c!==a}function M({open:a,ariaLabel:s,onClose:c,returnFocusTo:f=null,initialFocusRef:l,dismissDisabled:i=!1,children:m,testId:v}){const e=r.useRef(null),t=r.useRef(c),u=r.useRef(i),E=r.useRef(null);return t.current=c,u.current=i,r.useEffect(()=>{if(!a)return;const o=e.current;if(!o)return;const x=document.body.style.overflow;E.current=f??(document.activeElement instanceof HTMLElement?document.activeElement:null),document.body.style.overflow="hidden",((l==null?void 0:l.current)??o).focus();const _=n=>{if(R(o))return;if(n.key==="Escape"){n.preventDefault(),u.current||t.current();return}if(n.key!=="Tab")return;const g=L(o);if(g.length===0){n.preventDefault(),o.focus();return}const p=g[0],h=g[g.length-1],y=document.activeElement;n.shiftKey&&(y===p||!o.contains(y))?(n.preventDefault(),h.focus()):!n.shiftKey&&(y===h||!o.contains(y))&&(n.preventDefault(),p.focus())};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_),document.body.style.overflow=x;const n=f??E.current;n&&document.contains(n)&&n.focus()}},[l,a,f]),a?k.createPortal(d.jsx("div",{className:j.backdrop,"data-testid":v,role:"presentation",onClick:o=>{o.target===o.currentTarget&&!i&&t.current()},children:d.jsx("section",{ref:e,className:j.dialog,role:"dialog","aria-modal":"true","aria-label":s,tabIndex:-1,children:m})}),document.body):null}const A="_tabBar_jefog_2",D="_tabs_jefog_9",N="_actions_jefog_14",C="_tab_jefog_2",S="_tabActive_jefog_52",b={tabBar:A,tabs:D,actions:N,tab:C,tabActive:S};function O({items:a,value:s,onChange:c,ariaLabel:f,className:l,rightActions:i}){const m=r.useRef(null),v=r.useRef(null);return r.useEffect(()=>{const e=()=>{const t=m.current,u=v.current;!t||!u||typeof t.scrollTo!="function"||t.scrollTo({left:Math.max(0,u.offsetLeft+u.offsetWidth/2-t.clientWidth/2),behavior:"auto"})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[s]),d.jsxs("div",{ref:m,className:[b.tabBar,l].filter(Boolean).join(" "),role:"tablist","aria-label":f,children:[d.jsx("div",{className:b.tabs,children:a.map(e=>{const t=e.key===s;return d.jsx("button",{ref:t?v:void 0,type:"button",role:"tab","aria-selected":t,"data-testid":e.testId,className:[b.tab,t?b.tabActive:""].filter(Boolean).join(" "),onClick:()=>c(e.key),children:e.label},e.key)})}),i?d.jsx("div",{className:b.actions,children:i}):null]})}export{M as C,O as T};
1
+ import{r,w as k,j as d}from"./index-CG4GxcAc.js";const w="_backdrop_1sgib_1",T="_dialog_1sgib_19",j={backdrop:w,dialog:T},B=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[contenteditable="true"]','[tabindex]:not([tabindex="-1"])'].join(", ");function L(a){return Array.from(a.querySelectorAll(B))}function R(a){const s=document.activeElement;if(!(s instanceof HTMLElement))return!1;const c=s.closest('[role="dialog"][aria-modal="true"]');return c!==null&&c!==a}function M({open:a,ariaLabel:s,onClose:c,returnFocusTo:f=null,initialFocusRef:l,dismissDisabled:i=!1,children:m,testId:v}){const e=r.useRef(null),t=r.useRef(c),u=r.useRef(i),E=r.useRef(null);return t.current=c,u.current=i,r.useEffect(()=>{if(!a)return;const o=e.current;if(!o)return;const x=document.body.style.overflow;E.current=f??(document.activeElement instanceof HTMLElement?document.activeElement:null),document.body.style.overflow="hidden",((l==null?void 0:l.current)??o).focus();const _=n=>{if(R(o))return;if(n.key==="Escape"){n.preventDefault(),u.current||t.current();return}if(n.key!=="Tab")return;const g=L(o);if(g.length===0){n.preventDefault(),o.focus();return}const p=g[0],h=g[g.length-1],y=document.activeElement;n.shiftKey&&(y===p||!o.contains(y))?(n.preventDefault(),h.focus()):!n.shiftKey&&(y===h||!o.contains(y))&&(n.preventDefault(),p.focus())};return document.addEventListener("keydown",_),()=>{document.removeEventListener("keydown",_),document.body.style.overflow=x;const n=f??E.current;n&&document.contains(n)&&n.focus()}},[l,a,f]),a?k.createPortal(d.jsx("div",{className:j.backdrop,"data-testid":v,role:"presentation",onClick:o=>{o.target===o.currentTarget&&!i&&t.current()},children:d.jsx("section",{ref:e,className:j.dialog,role:"dialog","aria-modal":"true","aria-label":s,tabIndex:-1,children:m})}),document.body):null}const A="_tabBar_jefog_2",D="_tabs_jefog_9",N="_actions_jefog_14",C="_tab_jefog_2",S="_tabActive_jefog_52",b={tabBar:A,tabs:D,actions:N,tab:C,tabActive:S};function O({items:a,value:s,onChange:c,ariaLabel:f,className:l,rightActions:i}){const m=r.useRef(null),v=r.useRef(null);return r.useEffect(()=>{const e=()=>{const t=m.current,u=v.current;!t||!u||typeof t.scrollTo!="function"||t.scrollTo({left:Math.max(0,u.offsetLeft+u.offsetWidth/2-t.clientWidth/2),behavior:"auto"})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[s]),d.jsxs("div",{ref:m,className:[b.tabBar,l].filter(Boolean).join(" "),role:"tablist","aria-label":f,children:[d.jsx("div",{className:b.tabs,children:a.map(e=>{const t=e.key===s;return d.jsx("button",{ref:t?v:void 0,type:"button",role:"tab","aria-selected":t,"data-testid":e.testId,className:[b.tab,t?b.tabActive:""].filter(Boolean).join(" "),onClick:()=>c(e.key),children:e.label},e.key)})}),i?d.jsx("div",{className:b.actions,children:i}):null]})}export{M as C,O as T};
@@ -1 +1 @@
1
- import{a as m,c as d,q as h,j as n}from"./index-ZP3F-qh6.js";const x="_actions_z7b39_60",f="_btn_z7b39_68",j="_btnPrimary_z7b39_99",z="_panel_z7b39_109",I="_panelIcon_z7b39_116",N="_panelTitle_z7b39_122",u="_panelDesc_z7b39_132",v="_benefitList_z7b39_140",y="_benefitItem_z7b39_149",e={actions:x,btn:f,btnPrimary:j,panel:z,panelIcon:I,panelTitle:N,panelDesc:u,benefitList:v,benefitItem:y};function g({icon:a,title:s,description:c,benefits:l,upgradeLabel:i,upgradeHref:r}){const{trackEvent:o}=m(),{pathname:_,search:b}=d(),p=h(_,b);return n.jsxs("div",{className:e.panel,children:[a&&n.jsx("div",{className:e.panelIcon,children:a}),n.jsx("div",{className:e.panelTitle,children:s}),n.jsx("div",{className:e.panelDesc,children:c}),n.jsx("ul",{className:e.benefitList,children:l.map(t=>n.jsx("li",{className:e.benefitItem,children:t},t))}),n.jsx("div",{className:e.actions,children:n.jsx("a",{className:`${e.btn} ${e.btnPrimary}`,href:r,target:"_blank",rel:"noreferrer",onClick:()=>o("dashboard_click_event",{click_target:"upgrade_cta",placement:"tier_panel",...p}),children:i})})]})}export{g as T};
1
+ import{a as m,c as d,x as h,j as n}from"./index-CG4GxcAc.js";const x="_actions_z7b39_60",f="_btn_z7b39_68",j="_btnPrimary_z7b39_99",z="_panel_z7b39_109",I="_panelIcon_z7b39_116",N="_panelTitle_z7b39_122",u="_panelDesc_z7b39_132",v="_benefitList_z7b39_140",y="_benefitItem_z7b39_149",e={actions:x,btn:f,btnPrimary:j,panel:z,panelIcon:I,panelTitle:N,panelDesc:u,benefitList:v,benefitItem:y};function g({icon:a,title:s,description:c,benefits:l,upgradeLabel:i,upgradeHref:r}){const{trackEvent:o}=m(),{pathname:_,search:b}=d(),p=h(_,b);return n.jsxs("div",{className:e.panel,children:[a&&n.jsx("div",{className:e.panelIcon,children:a}),n.jsx("div",{className:e.panelTitle,children:s}),n.jsx("div",{className:e.panelDesc,children:c}),n.jsx("ul",{className:e.benefitList,children:l.map(t=>n.jsx("li",{className:e.benefitItem,children:t},t))}),n.jsx("div",{className:e.actions,children:n.jsx("a",{className:`${e.btn} ${e.btnPrimary}`,href:r,target:"_blank",rel:"noreferrer",onClick:()=>o("dashboard_click_event",{click_target:"upgrade_cta",placement:"tier_panel",...p}),children:i})})]})}export{g as T};