@weppy/roblox-mcp 2.7.13 → 2.7.15
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.
- package/CHANGELOG.md +17 -0
- package/dashboard/dist/assets/{ChangelogDetailPage-BpYn-_uJ.js → ChangelogDetailPage-Cado4LDZ.js} +1 -1
- package/dashboard/dist/assets/{ChangelogPage-BGqHwmkj.js → ChangelogPage-DyS8_4IL.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-lSOkaAvB.js → ConfirmModal-C66ZwIur.js} +1 -1
- package/dashboard/dist/assets/{ConnectionPage-BKHQPyJV.js → ConnectionPage-DsGgzpmn.js} +1 -1
- package/dashboard/dist/assets/{GameChangeDetail-DjupgTS5.js → GameChangeDetail-BvLY7yg8.js} +1 -1
- package/dashboard/dist/assets/{InfoLabel-BkXtpBzT.js → InfoLabel-LyMkHb1i.js} +1 -1
- package/dashboard/dist/assets/{OverviewPage-D-ZhLkmY.js → OverviewPage-BDkw5pqk.js} +1 -1
- package/dashboard/dist/assets/{PlaytestPage-vBV2EzAl.js → PlaytestPage-Chwh5KSd.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-KOJtVHm4.js → SettingsPage-7nNA3k5H.js} +1 -1
- package/dashboard/dist/assets/{StatusBadge-C0DYxkUy.js → StatusBadge-CLJmMG0w.js} +1 -1
- package/dashboard/dist/assets/{SyncPage-CJfFG48l.js → SyncPage-CUP2s1T6.js} +1 -1
- package/dashboard/dist/assets/{Tabs-B4kZyHzy.js → Tabs-C9KNjyNX.js} +1 -1
- package/dashboard/dist/assets/{ToolsPage-CB2Sn5ZE.js → ToolsPage-QacrKG2A.js} +1 -1
- package/dashboard/dist/assets/{TooltipText-59Xfc1Ui.js → TooltipText-BPEldl3x.js} +1 -1
- package/dashboard/dist/assets/UiStudioPage-RUjTAi4h.js +16 -0
- package/dashboard/dist/assets/WhatsNewPage-CKNhbHAQ.js +1 -0
- package/dashboard/dist/assets/{index-BIVkyPD7.js → index-VNIYQxwF.js} +78 -51
- package/dashboard/dist/assets/{sample-requests-DyHFY41o.js → sample-requests-Bttgc133.js} +1 -1
- package/dashboard/dist/assets/{useLiveUptime-C1ZSqLmR.js → useLiveUptime-CksXMBr9.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/index.js +77 -78
- package/package.json +1 -1
- package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
- package/dashboard/dist/assets/AssetsPage-CGgBe-s5.css +0 -1
- package/dashboard/dist/assets/AssetsPage-UVXVmDv7.js +0 -46
- package/dashboard/dist/assets/UiStudioPage-CPmYO3Vj.js +0 -11
- package/dashboard/dist/assets/WhatsNewPage-ClHLVkbF.js +0 -1
- package/dashboard/dist/assets/x-sRJSvoLm.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as re,r as c,f as ce,D as de,e as ue,g as ge,h as pe,a as D,u as V,i as ie,j as e,k as he,T as ye,A as me,S as ve}from"./index-BIVkyPD7.js";import{I as _}from"./InfoLabel-BkXtpBzT.js";import{T as g}from"./TooltipText-59Xfc1Ui.js";import{C as _e}from"./ConfirmModal-lSOkaAvB.js";import{D as ne,f as oe,r as xe,s as je,a as le,d as K,S as te,b as fe}from"./sample-requests-DyHFY41o.js";function be(){const{level:t}=re(),[s,r]=c.useState(null),[f,o]=c.useState(null),[u,i]=c.useState(!1),[v,m]=c.useState(!0),[I,b]=c.useState(!1),[B,x]=c.useState(null),H=t==="disconnected",y=c.useCallback(d=>{d&&o(p=>({...p,...d,maskedKey:d.maskedKey??(p==null?void 0:p.maskedKey),provider:d.provider??(p==null?void 0:p.provider)??"auto"}))},[]),j=c.useCallback(d=>{if(!d){o(null);return}o({...d,provider:d.provider??"auto"})},[]),k=c.useCallback(async()=>{try{return await ce()}catch{return null}},[]);c.useEffect(()=>{let d=!1;async function p(){try{const[n,C]=await Promise.all([D.get("/api/dashboard/settings").catch(()=>null),k()]);if(d)return;n&&r(n),C&&y(C)}catch{}finally{d||m(!1)}}return p(),()=>{d=!0}},[k,y]),c.useEffect(()=>{const d=new de;d.connect();const p=d.on("license",n=>{k().then(C=>{if(C){if((n==null?void 0:n.cleared)===!0){j(C);return}y(C)}})});return()=>{p(),d.disconnect()}},[k,y,j]);const S=c.useCallback((d,p)=>{x(d??p)},[]),w=c.useCallback(async d=>{if(H)return!1;if(!d.trim())return x("License key is required."),!1;b(!0);try{const p=await ue({licenseKey:d.trim()});return y(p.license),S(p.message,p.ok?"License updated.":"License activation failed."),p.ok}catch{return x("License activation failed."),!1}finally{b(!1)}},[S,H,y]),T=c.useCallback(async()=>{if(!H){b(!0);try{const d=await ge();y(d.license),S(d.message,d.ok?"License updated.":"License refresh failed.")}catch{x("License refresh failed.")}finally{b(!1)}}},[S,H,y]),E=c.useCallback(async()=>{if(!H){b(!0);try{const d=await pe();j(d.license),S(d.message,d.ok?"License reset.":"License reset failed.")}catch{x("License reset failed.")}finally{b(!1)}}},[S,H,j]),A=c.useCallback(async(d,p)=>{if(s){r(n=>n&&{...n,hot:{...n.hot,[d]:p}}),i(!0);try{await D.patch("/api/dashboard/settings",{[d]:p})}catch{r(n=>n&&{...n,hot:{...n.hot,[d]:s.hot[d]}})}finally{i(!1)}}},[s]);return{settings:s,license:f,saving:u,licenseControlsDisabled:H,licenseSubmitting:I,licenseMessage:B,activateLicense:w,refreshLicense:T,resetLicense:E,updateHotSetting:A,loading:v}}const Se="_card_1jlvt_4",Ne="_cardEmbedded_1jlvt_14",Le="_cardTitle_1jlvt_21",Ce="_usageRow_1jlvt_30",He="_usageTotal_1jlvt_36",ke="_usageBreakdown_1jlvt_42",we="_usageCounts_1jlvt_47",Re="_divider_1jlvt_53",Te="_lastRunRow_1jlvt_60",Ee="_lastRunLabel_1jlvt_69",Ae="_errorIcon_1jlvt_75",Be="_tooltip_1jlvt_83",Ie="_cleanupRow_1jlvt_106",De="_cleanupLabel_1jlvt_113",Pe="_cleanupBtn_1jlvt_120",Me="_cleanupBtnDanger_1jlvt_143",$e="_retentionSection_1jlvt_155",Ue="_retentionTitle_1jlvt_161",Oe="_retentionFieldset_1jlvt_170",ze="_proOverlay_1jlvt_185",Fe="_radioRow_1jlvt_197",Ge="_radioLabel_1jlvt_204",qe="_presetGroup_1jlvt_224",We="_presetBtn_1jlvt_232",Ye="_presetBtnActive_1jlvt_249",Ke="_freeInput_1jlvt_256",Ve="_inputError_1jlvt_272",Qe="_inputUnit_1jlvt_276",Xe="_cascadeRow_1jlvt_283",Je="_retentionActions_1jlvt_302",Ze="_saveBtn_1jlvt_308",et="_runNowBtn_1jlvt_330",tt="_errorMsg_1jlvt_353",l={card:Se,cardEmbedded:Ne,cardTitle:Le,usageRow:Ce,usageTotal:He,usageBreakdown:ke,usageCounts:we,divider:Re,lastRunRow:Te,lastRunLabel:Ee,errorIcon:Ae,tooltip:Be,cleanupRow:Ie,cleanupLabel:De,cleanupBtn:Pe,cleanupBtnDanger:Me,retentionSection:$e,retentionTitle:Ue,retentionFieldset:Oe,proOverlay:ze,radioRow:Fe,radioLabel:Ge,presetGroup:qe,presetBtn:We,presetBtnActive:Ye,freeInput:Ke,inputError:Ve,inputUnit:Qe,cascadeRow:Xe,retentionActions:Je,saveBtn:Ze,runNowBtn:et,errorMsg:tt};function st(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 se(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 at(t,s){return t.mode===s.mode&&t.ageDays===s.ageDays&&t.sizeMb===s.sizeMb&&t.cascadeSnapshots===s.cascadeSnapshots}function O(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 it({placeId:t,tier:s,currentPolicy:r,onSaved:f}){const{t:o}=V(),{trackEvent:u}=ie(),[i,v]=c.useState(r),[m,I]=c.useState(()=>[7,14,30,90].includes(r.ageDays??-1)?"":String(r.ageDays??30)),[b,B]=c.useState(()=>[100,500,1e3].includes(r.sizeMb??-1)?"":String(r.sizeMb??500)),[x,H]=c.useState(null),[y,j]=c.useState(!1),[k,S]=c.useState(!1),[w,T]=c.useState(!1),[E,A]=c.useState(null);c.useEffect(()=>{v(r);const h=[7,14,30,90],R=[100,500,1e3];I(h.includes(r.ageDays??-1)?"":String(r.ageDays??30)),B(R.includes(r.sizeMb??-1)?"":String(r.sizeMb??500))},[r]);const d=s==="basic",p=se(i),n=at(r,i),C=p&&!n&&!k,N=h=>{v(R=>{const U={...R,mode:h};return h==="age"&&(U.ageDays=parseInt(m,10)||30),h==="size"&&(U.sizeMb=parseInt(b,10)||500),U})},L=h=>{I(""),v(R=>({...R,ageDays:h}))},z=h=>{B(""),v(R=>({...R,sizeMb:h}))},Q=h=>{I(h);const R=parseInt(h,10);Number.isNaN(R)||v(U=>({...U,ageDays:R}))},M=h=>{B(h);const R=parseInt(h,10);Number.isNaN(R)||v(U=>({...U,sizeMb:R}))},X=async()=>{if(A(null),u("dashboard_click_event",{click_target:"ui_studio_cleanup_save",page:"settings"}),st(r,i)){try{const h=await oe(t,{mode:i.mode,ageDays:i.ageDays,sizeMb:i.sizeMb,cascadeSnapshots:i.cascadeSnapshots});H(h.dryRun),j(!0)}catch(h){A(h.message)}return}await Y()},Y=async()=>{S(!0);try{await je(t,i),j(!1),f()}catch(h){throw A(h.message),h}finally{S(!1)}},J=async()=>{A(null),u("dashboard_click_event",{click_target:"ui_studio_cleanup_run_now",page:"settings"}),T(!0);try{await xe(t),f()}catch(h){A(h.message)}finally{T(!1)}},Z=x?`${o("uiStudio.cleanup.policy.confirm.messageStrict","이 정책으로 즉시")} ${x.wouldRemoveRequests}${o("uiStudio.cleanup.policy.confirm.requests","건")} / ${x.wouldRemoveSnapshots}${o("uiStudio.cleanup.policy.confirm.snapshots","개 화면 캡처")} / ${O(x.wouldFreeBytes)} ${o("uiStudio.cleanup.policy.confirm.freed","가 삭제됩니다 — 적용?")}`:"",$=i.mode==="age"&&!se(i),ee=i.mode==="size"&&!se(i);return e.jsxs("div",{className:l.retentionSection,children:[e.jsx("h3",{className:l.retentionTitle,children:e.jsx(_,{label:o("uiStudio.cleanup.policy.title","자동 삭제 정책"),tooltip:o("uiStudio.cleanup.policy.title.tooltip","Rules that automatically remove old or large captures.")})}),e.jsxs("div",{style:{position:"relative"},children:[d&&e.jsx("div",{className:l.proOverlay,title:o("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능"),children:e.jsx("div",{className:l.tooltip,children:o("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능")})}),e.jsxs("fieldset",{className:l.retentionFieldset,disabled:d,style:d?{opacity:.45,pointerEvents:"none"}:void 0,children:[e.jsx("div",{className:l.radioRow,children:e.jsx(g,{text:o("uiStudio.cleanup.policy.modeOff.tooltip","Turn off auto-cleanup. Data stays until you remove it manually."),children:e.jsxs("label",{className:l.radioLabel,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"off",checked:i.mode==="off",onChange:()=>N("off")}),o("uiStudio.cleanup.policy.modeOff","사용 안 함 (off)")]})})}),e.jsxs("div",{children:[e.jsx("div",{className:l.radioRow,children:e.jsx(g,{text:o("uiStudio.cleanup.policy.modeAge.tooltip","Automatically delete data older than the configured number of days."),children:e.jsxs("label",{className:l.radioLabel,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"age",checked:i.mode==="age",onChange:()=>N("age")}),o("uiStudio.cleanup.policy.modeAge","기간 기반 (age)")]})})}),i.mode==="age"&&e.jsxs("div",{className:l.presetGroup,children:[[7,14,30,90].map(h=>e.jsx(g,{text:o("uiStudio.cleanup.policy.agePreset.tooltip","Delete data older than this many days."),children:e.jsxs("button",{type:"button",className:`${l.presetBtn} ${i.ageDays===h&&m===""?l.presetBtnActive:""}`,onClick:()=>L(h),children:[h,o("uiStudio.cleanup.policy.daysUnit","일")]})},h)),e.jsx(g,{text:o("uiStudio.cleanup.policy.ageInput.tooltip","Enter any value between 1 and 365 days."),children:e.jsx("input",{type:"number",className:`${l.freeInput} ${$?l.inputError:""}`,value:m,min:1,max:365,onChange:h=>Q(h.target.value)})}),e.jsxs("span",{className:l.inputUnit,children:["1–365",o("uiStudio.cleanup.policy.daysUnit","일")]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:l.radioRow,children:e.jsx(g,{text:o("uiStudio.cleanup.policy.modeSize.tooltip","When total usage exceeds the limit, the oldest data is removed first."),children:e.jsxs("label",{className:l.radioLabel,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"size",checked:i.mode==="size",onChange:()=>N("size")}),o("uiStudio.cleanup.policy.modeSize","용량 기반 (size)")]})})}),i.mode==="size"&&e.jsxs("div",{className:l.presetGroup,children:[[100,500,1e3].map(h=>e.jsx(g,{text:o("uiStudio.cleanup.policy.sizePreset.tooltip","Keep total usage under this size."),children:e.jsxs("button",{type:"button",className:`${l.presetBtn} ${i.sizeMb===h&&b===""?l.presetBtnActive:""}`,onClick:()=>z(h),children:[h,o("uiStudio.cleanup.policy.mbUnit","MB")]})},h)),e.jsx(g,{text:o("uiStudio.cleanup.policy.sizeInput.tooltip","Enter any value between 50 MB and 10000 MB (10 GB)."),children:e.jsx("input",{type:"number",className:`${l.freeInput} ${ee?l.inputError:""}`,value:b,min:50,max:1e4,onChange:h=>M(h.target.value)})}),e.jsxs("span",{className:l.inputUnit,children:["50–10000",o("uiStudio.cleanup.policy.mbUnit","MB")]})]})]}),e.jsx(g,{text:o("uiStudio.cleanup.policy.cascade.tooltip","Also delete the capture images linked to those records. If off, the images stay."),children:e.jsxs("label",{className:l.cascadeRow,children:[e.jsx("input",{type:"checkbox",checked:i.cascadeSnapshots,onChange:h=>v(R=>({...R,cascadeSnapshots:h.target.checked}))}),o("uiStudio.cleanup.policy.cascade","연결된 화면 캡처도 함께 삭제")]})}),e.jsxs("div",{className:l.retentionActions,children:[e.jsx(g,{text:o("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:l.saveBtn,onClick:()=>void X(),disabled:!C,children:o("uiStudio.cleanup.policy.save","정책 저장")})}),e.jsx(g,{text:o("uiStudio.cleanup.policy.runNow.tooltip","Run the current rule once now, without waiting for the next scheduled run."),children:e.jsx("button",{type:"button",className:l.runNowBtn,onClick:()=>void J(),disabled:w,children:o("uiStudio.cleanup.policy.runNow","지금 정리")})})]}),E&&e.jsx("div",{className:l.errorMsg,children:E})]})]}),y&&x&&e.jsx(ne,{title:o("uiStudio.cleanup.policy.confirm.title","정책 적용 확인"),message:Z,danger:!0,confirmLabel:o("uiStudio.cleanup.policy.save","정책 저장"),busy:k,onConfirm:Y,onClose:()=>j(!1)})]})}function nt({placeId:t,tier:s,onChanged:r,sampleUsage:f,sampleRetention:o,embedded:u=!1}){const{t:i}=V(),v=s==="basic"&&f!=null&&o!=null,[m,I]=c.useState(v?f:null),[b,B]=c.useState(v?o:null),[x,H]=c.useState(null),[y,j]=c.useState(null),[k,S]=c.useState(null),w=c.useCallback(async()=>{if(!v&&t!=null){H(null);try{const[N,L]=await Promise.all([le(t),oe(t)]);I(N),B(L.policy)}catch(N){H(N.message)}}},[t,v]);c.useEffect(()=>{w()},[w]);const T=c.useCallback(()=>{w(),r==null||r()},[w,r]),E=c.useCallback(async()=>{if(y&&t!=null){S(null);try{y.kind==="keep7"?await K(t,{olderThanDays:7,alsoSnapshots:!0}):y.kind==="keep30"?await K(t,{olderThanDays:30,alsoSnapshots:!0}):await K(t,{all:!0,alsoSnapshots:!0}),j(null),w(),r==null||r()}catch(N){throw S(N.message),N}}},[y,t,w,r]);function A(N){const L=i("uiStudio.cleanup.studioPreservedNote","This deletes saved change records and screenshots on disk only; Roblox Studio instances are not affected.");return N.kind==="keep7"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep7","7일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${L}`:N.kind==="keep30"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep30","30일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${L}`:`${((m==null?void 0:m.requestCount)??0)+((m==null?void 0:m.snapshotCount)??0)}${i("uiStudio.cleanup.cleanupConfirmMessage.all","개의 저장된 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${L}`}if(t==null&&!v)return null;if(x)return e.jsx("div",{className:`${l.card} ${u?l.cardEmbedded:""}`,children:e.jsx("p",{className:l.errorMsg,children:x})});if(!m||!b)return e.jsx("div",{className:`${l.card} ${u?l.cardEmbedded:""}`,children:e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:0},children:i("uiStudio.storage.loading","로딩 중...")})});const d=b.lastRunAt,p=b.lastRunStats,n=d?new Date(d).toLocaleString():null,C=t??0;return e.jsxs("div",{className:`${l.card} ${u?l.cardEmbedded:""}`,children:[e.jsx("h3",{className:l.cardTitle,children:e.jsx(_,{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:l.usageRow,children:[e.jsx(g,{text:i("uiStudio.storage.usageLabel.tooltip","Disk space currently used by UI Studio for this project."),children:e.jsxs("div",{className:l.usageTotal,children:[i("uiStudio.storage.usageLabel","사용 중")," ",O(m.totalBytes)]})}),e.jsxs("div",{className:l.usageBreakdown,children:[e.jsx(g,{text:i("uiStudio.storage.historyBytes.tooltip","Space taken by change record data (JSON)."),children:e.jsxs("span",{children:[i("uiStudio.storage.historyBytes","변경 이력")," ",O(m.historyBytes)]})})," · ",e.jsx(g,{text:i("uiStudio.storage.snapshotBytes.tooltip","Space taken by captured PNG image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotBytes","화면 캡처")," ",O(m.snapshotBytes)]})})]}),e.jsxs("div",{className:l.usageCounts,children:[e.jsx(g,{text:i("uiStudio.storage.requestCount.tooltip","Number of actions where AI changed the UI."),children:e.jsxs("span",{children:[i("uiStudio.storage.requestCount","변경 기록")," ",m.requestCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(g,{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","변경 상세")," ",m.mutationCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(g,{text:i("uiStudio.storage.snapshotCount.tooltip","Number of saved capture image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotCount","화면 캡처")," ",m.snapshotCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})]})]}),e.jsx("hr",{className:l.divider}),e.jsx(it,{placeId:C,tier:s,currentPolicy:b,onSaved:T}),e.jsx("hr",{className:l.divider}),e.jsxs("div",{className:l.lastRunRow,children:[e.jsx("span",{className:l.lastRunLabel,children:e.jsx(_,{label:i("uiStudio.storage.lastRun","마지막 자동 정리"),tooltip:i("uiStudio.storage.lastRun.tooltip","When the auto-cleanup policy last ran, and what it removed.")})}),n?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n}),p&&e.jsxs("span",{children:["· ",i("uiStudio.storage.requestCount","변경 기록")," ",p.removedRequests,i("uiStudio.storage.countSuffix","개")," / ",i("uiStudio.storage.snapshotCount","화면 캡처")," ",p.removedSnapshots,i("uiStudio.storage.countSuffix","개")," / ",O(p.freedBytes)," ",i("uiStudio.storage.lastRunFreed","회수")]}),p&&p.errors>0&&e.jsxs("span",{className:l.errorIcon,title:`${i("uiStudio.storage.lastRunErrors","오류")} ${p.errors}건`,children:["⚠",e.jsxs("span",{className:l.tooltip,children:[i("uiStudio.storage.lastRunErrors","오류")," ",p.errors,i("uiStudio.storage.countSuffix","건")]})]})]}):e.jsx("span",{children:i("uiStudio.storage.lastRunNever","—")})]}),e.jsx("hr",{className:l.divider}),e.jsxs("div",{className:l.cleanupRow,children:[e.jsx("span",{className:l.cleanupLabel,children:e.jsx(_,{label:i("uiStudio.cleanup.label","수동 정리"),tooltip:i("uiStudio.cleanup.label.tooltip","Manually clean up change records and captures whenever you want.")})}),e.jsx(g,{text:i("uiStudio.cleanup.keep7.tooltip","Delete change records and captures older than 7 days."),children:e.jsx("button",{type:"button",className:l.cleanupBtn,onClick:()=>j({kind:"keep7"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 7일만 남기기").replace("{n}","7")})}),e.jsx(g,{text:i("uiStudio.cleanup.keep30.tooltip","Delete change records and captures older than 30 days."),children:e.jsx("button",{type:"button",className:l.cleanupBtn,onClick:()=>j({kind:"keep30"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 30일만 남기기").replace("{n}","30")})}),e.jsx(g,{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:`${l.cleanupBtn} ${l.cleanupBtnDanger}`,onClick:()=>j({kind:"all"}),disabled:s==="basic",children:i("uiStudio.cleanup.deleteAll","전체 삭제…")})})]}),k&&e.jsx("div",{className:l.errorMsg,children:k}),y&&e.jsx(ne,{title:i("uiStudio.cleanup.cleanupConfirmTitle","정리 확인"),message:A(y),danger:!0,confirmLabel:i("common.delete","삭제"),onConfirm:E,onClose:()=>{j(null),S(null)}})]})}const ot="_page_16yvc_2",lt="_card_16yvc_10",rt="_licenseCardPro_16yvc_17",ct="_cardHeader_16yvc_28",dt="_cardHeaderActions_16yvc_41",ut="_collapseButton_16yvc_47",gt="_headerBadge_16yvc_69",pt="_headerBadgeLive_16yvc_80",ht="_licenseGrid_16yvc_86",yt="_statusDot_16yvc_104",mt="_statusActive_16yvc_113",vt="_statusGrace_16yvc_118",_t="_statusInactive_16yvc_123",xt="_statusError_16yvc_127",jt="_proBadge_16yvc_132",ft="_upgradeLink_16yvc_146",bt="_licenseControls_16yvc_160",St="_licenseControlRow_16yvc_169",Nt="_licenseField_16yvc_176",Lt="_licenseFieldGrow_16yvc_182",Ct="_controlLabel_16yvc_187",Ht="_textInput_16yvc_193",kt="_actionBtn_16yvc_209",wt="_licenseMessage_16yvc_231",Rt="_licenseNotice_16yvc_238",Tt="_licenseNoticeInfo_16yvc_248",Et="_licenseNoticeWarning_16yvc_254",At="_licenseNoticeMuted_16yvc_260",Bt="_settingRow_16yvc_266",It="_settingLabel_16yvc_280",Dt="_settingControl_16yvc_287",Pt="_select_16yvc_296",Mt="_numberInput_16yvc_314",$t="_toggleSwitch_16yvc_332",Ut="_toggleInput_16yvc_339",Ot="_toggleTrack_16yvc_347",zt="_toggleThumb_16yvc_369",Ft="_savedIndicator_16yvc_418",Gt="_savedIndicatorHidden_16yvc_429",qt="_dataHistoryIntro_16yvc_434",Wt="_dataHistoryList_16yvc_442",Yt="_dataHistoryRow_16yvc_448",Kt="_dataHistoryDetail_16yvc_457",Vt="_uiStudioDataHistoryRow_16yvc_462",Qt="_uiStudioDataHistoryDetail_16yvc_467",Xt="_dataHistoryMain_16yvc_474",Jt="_dataHistoryTitle_16yvc_478",Zt="_dataHistoryDescription_16yvc_484",es="_dataHistoryMetric_16yvc_492",ts="_dataHistoryActions_16yvc_499",ss="_linkButton_16yvc_505",as="_dangerButton_16yvc_506",is="_inlineStatus_16yvc_542",ns="_coldGrid_16yvc_550",os="_coldHint_16yvc_568",ls="_langRow_16yvc_577",rs="_loading_16yvc_590",cs="_unit_16yvc_599",a={page:ot,card:lt,licenseCardPro:rt,cardHeader:ct,cardHeaderActions:dt,collapseButton:ut,headerBadge:gt,headerBadgeLive:pt,licenseGrid:ht,statusDot:yt,statusActive:mt,statusGrace:vt,statusInactive:_t,statusError:xt,proBadge:jt,upgradeLink:ft,licenseControls:bt,licenseControlRow:St,licenseField:Nt,licenseFieldGrow:Lt,controlLabel:Ct,textInput:Ht,actionBtn:kt,licenseMessage:wt,licenseNotice:Rt,licenseNoticeInfo:Tt,licenseNoticeWarning:Et,licenseNoticeMuted:At,settingRow:Bt,settingLabel:It,settingControl:Dt,select:Pt,numberInput:Mt,toggleSwitch:$t,toggleInput:Ut,toggleTrack:Ot,toggleThumb:zt,savedIndicator:Ft,savedIndicatorHidden:Gt,dataHistoryIntro:qt,dataHistoryList:Wt,dataHistoryRow:Yt,dataHistoryDetail:Kt,uiStudioDataHistoryRow:Vt,uiStudioDataHistoryDetail:Qt,dataHistoryMain:Xt,dataHistoryTitle:Jt,dataHistoryDescription:Zt,dataHistoryMetric:es,dataHistoryActions:ts,linkButton:ss,dangerButton:as,inlineStatus:is,coldGrid:ns,coldHint:os,langRow:ls,loading:rs,unit:cs},ds={toolsActivity:null,toolStats:null,toolSessions:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null},us={toolsActivity:null,toolStats:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null};function gs(t){var s;return t?t.pluginConnected?t.activePlaceId:t.lastActivePlaceId??((s=t.places[0])==null?void 0:s.placeId)??null:null}async function P(t){try{return await t}catch{return null}}function q(t){return t?typeof t.total=="number"?t.total:Array.isArray(t.entries)?t.entries.length:null:null}function W(t,s,r,f){return s===null?t("settings.dataHistory.metric.unavailable","Unavailable"):`${s.toLocaleString()} ${t(r,f)}`}function F(t,s,r){const f=r===null?t("settings.dataHistory.metric.sizeUnavailable","size unavailable"):O(r);return`${s} · ${f}`}function G(t,s){var f;const r=(f=t==null?void 0:t[s])==null?void 0:f.bytes;return typeof r=="number"&&Number.isFinite(r)?r:null}function ps(t,s){return s?[`${s.requestCount.toLocaleString()} ${t("uiStudio.storage.requestCount","change records")}`,`${s.snapshotCount.toLocaleString()} ${t("uiStudio.storage.snapshotCount","screenshots")}`,O(s.totalBytes)].join(" · "):t("settings.dataHistory.metric.unavailable","Unavailable")}function hs({tier:t}){const{t:s}=V(),[r,f]=c.useState(ds),[o,u]=c.useState(us),[i,v]=c.useState(t==="basic"?te:null),[m,I]=c.useState(null),[b,B]=c.useState(!0),[x,H]=c.useState(!0),[y,j]=c.useState(null),[k,S]=c.useState(!1),[w,T]=c.useState(null),E=c.useCallback(async()=>{B(!0);const L=await P(he()),z=gs(L);I(z);const[Q,M,X,Y,J,Z,$]=await Promise.all([P(D.get("/api/dashboard/history",{limit:"1",offset:"0"})),P(D.get("/api/dashboard/tool-stats")),P(D.get("/sync/history",{limit:"1",offset:"0"})),P(D.get("/api/dashboard/playtest/history")),P(D.get("/api/dashboard/changelog",{limit:"1",offset:"0"})),P(D.get("/api/dashboard/connection-log")),P(D.get("/api/dashboard/storage-summary"))]),ee=t==="basic"?te:z===null?null:await P(le(z));f({toolsActivity:q(Q),toolStats:(M==null?void 0:M.totalCalls)??null,toolSessions:(M==null?void 0:M.totalSessions)??null,syncLog:q(X),playtestReports:q(Y),projectChanges:q(J),connectionLog:q(Z)}),u({toolsActivity:G($,"toolsActivity"),toolStats:G($,"toolStats"),syncLog:G($,"syncLog"),playtestReports:G($,"playtestReports"),projectChanges:G($,"projectChanges"),connectionLog:G($,"connectionLog")}),v(ee),B(!1)},[t]);c.useEffect(()=>{E()},[E]);const A=c.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:F(s,W(s,r.toolsActivity,"settings.dataHistory.metric.records","records"),o.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:F(s,r.toolStats===null?s("settings.dataHistory.metric.unavailable","Unavailable"):`${r.toolStats.toLocaleString()} ${s("settings.dataHistory.metric.runs","runs")} · ${(r.toolSessions??0).toLocaleString()} ${s("settings.dataHistory.metric.sessions","sessions")}`,o.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:F(s,W(s,r.syncLog,"settings.dataHistory.metric.records","records"),o.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:F(s,W(s,r.playtestReports,"settings.dataHistory.metric.reports","reports"),o.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:F(s,W(s,r.projectChanges,"settings.dataHistory.metric.records","records"),o.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:F(s,W(s,r.connectionLog,"settings.dataHistory.metric.records","records"),o.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"}],[r,o,s]),d=async()=>{if(y){S(!0),T(null);try{if(y.kind==="uiStudio"){if(t!=="pro"||m===null)throw new Error("UI Studio place is unavailable");await K(m,{all:!0,alsoSnapshots:!0}),T(s("settings.dataHistory.uiStudio.clear.success","UI Studio saved data cleared."))}else await D.post(y.row.clearEndpoint),T(s("settings.dataHistory.clear.success","Saved data cleared."));j(null),await E()}catch{T(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{S(!1)}}},p=t==="pro"?m:0,n=t==="pro"&&m!==null,C=(y==null?void 0:y.kind)==="uiStudio",N=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(_,{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(g,{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:b?s("common.loading","Loading"):s("settings.dataHistory.scope","Current project")})}),e.jsx(g,{text:s("settings.dataHistory.toggle.tooltip","Collapse or expand this section."),children:e.jsx("button",{className:a.collapseButton,type:"button","aria-expanded":x,"aria-controls":"settings-data-history-body","aria-label":x?s("settings.dataHistory.collapse","Collapse {title}").replace("{title}",N):s("settings.dataHistory.expand","Expand {title}").replace("{title}",N),onClick:()=>H(L=>!L),children:x?"▾":"▸"})})]})]}),x&&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:[A.map(L=>e.jsxs("div",{className:a.dataHistoryRow,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:L.title}),e.jsx("div",{className:a.dataHistoryDescription,children:L.description})]}),e.jsx(g,{text:L.metricTooltip,children:e.jsx("div",{className:a.dataHistoryMetric,children:L.metric})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(g,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:`#${L.route}`,children:s("settings.dataHistory.open","Open")})}),e.jsx(g,{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",onClick:()=>j({kind:"row",row:L}),children:s("common.clear","Clear")})})]})]},L.key)),e.jsxs("div",{className:`${a.dataHistoryRow} ${a.uiStudioDataHistoryRow}`,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(g,{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:ps(s,i)})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(g,{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(g,{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:!n,onClick:()=>j({kind:"uiStudio"}),children:s("common.clear","Clear")})})]})]}),e.jsx("div",{className:`${a.dataHistoryDetail} ${a.uiStudioDataHistoryDetail}`,children:e.jsx(nt,{placeId:p,tier:t,onChanged:E,embedded:!0,...t==="basic"?{sampleUsage:te,sampleRetention:fe}:{}})})]}),w&&e.jsx("p",{className:a.inlineStatus,children:w})]})]}),e.jsx(_e,{open:y!==null,title:C?s("settings.dataHistory.uiStudio.clear.title","Clear UI Studio saved data?"):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."):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:s("common.clear","Clear"),loading:k,onCancel:()=>!k&&j(null),onConfirm:()=>void d()})]})}const ys={en:"English",ko:"한국어",es:"Español","pt-br":"Português (BR)",ja:"日本語",id:"Bahasa Indonesia",de:"Deutsch","fr-fr":"Français"},ms=["debug","info","warn","error"];function vs(t){return t==="active"?a.statusActive:t==="grace"?a.statusGrace:t==="invalid"||t==="revoked"?a.statusError:a.statusInactive}function _s(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 ae({checked:t,onChange:s,testId:r,ariaLabel:f}){return e.jsxs("label",{className:a.toggleSwitch,"data-testid":r,children:[e.jsx("input",{type:"checkbox",className:a.toggleInput,checked:t,"aria-label":f,onChange:o=>s(o.target.checked)}),e.jsx("span",{className:a.toggleTrack,"aria-hidden":"true",children:e.jsx("span",{className:a.toggleThumb})})]})}function Ns(){const{t,selectedLocale:s,setLocale:r}=V(),{trackEvent:f}=ie(),{settings:o,license:u,licenseControlsDisabled:i,licenseSubmitting:v,licenseMessage:m,activateLicense:I,refreshLicense:b,resetLicense:B,updateHotSetting:x,loading:H}=be(),[y,j]=c.useState(null),[k,S]=c.useState(""),w=u?_s(u,t):null,T=(u==null?void 0:u.tier)==="pro",E=(u==null?void 0:u.tier)==="pro"?u.maskedKey:void 0,A=u!=null&&u.provider&&u.provider!=="auto"?u.provider:void 0,d=(u==null?void 0:u.tier)==="pro"?"pro":"basic",p=c.useCallback(async(n,C)=>{await x(n,C),j(n),setTimeout(()=>j(N=>N===n?null:N),2e3)},[x]);return H?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.jsxs("div",{"data-testid":"settings-license-card",className:[a.card,(u==null?void 0:u.tier)==="pro"?a.licenseCardPro:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(_,{label:t("settings.license.title","License"),tooltip:t("settings.license.title.tooltip","Current license status and subscription tier.")}),e.jsx(g,{text:i?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} ${i?"":a.headerBadgeLive}`,children:i?t("settings.license.disconnected","Disconnected"):t("settings.general.liveApply","Live Apply")})})]}),e.jsxs(e.Fragment,{children:[u?e.jsxs(e.Fragment,{children:[(()=>{const n=w;return e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.licenseGrid,children:[e.jsx("dt",{children:e.jsx(_,{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} ${vs(u.status)}`}),e.jsx(g,{text:(n==null?void 0:n.tooltip)??t(`settings.license.${u.status}.tooltip`,"Current license activation state."),children:(n==null?void 0:n.label)??t(`settings.license.${u.status}`,u.status)})]}),e.jsx("dt",{children:e.jsx(_,{label:t("settings.license.tier","Tier"),tooltip:t("settings.license.tier.tooltip","Current subscription tier for available WEPPY Dashboard features.")})}),e.jsx("dd",{className:u.tier==="pro"?a.proBadge:"",children:e.jsx(g,{text:t(`tier.${u.tier}.tooltip`,"Available feature set for the connected license."),children:u.tier==="pro"?t("tier.pro","Pro"):t("tier.basic","Basic")})}),E&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(_,{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(g,{text:t("settings.license.keyValue.tooltip","Masked license key currently loaded by the server."),children:E})})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(_,{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(g,{text:t("settings.license.providerValue.tooltip","License provider used to validate this key."),children:A})})]})]}),(n==null?void 0:n.detail)&&e.jsx("p",{className:`${a.licenseNotice} ${n.detailTone}`,children:u.refreshBlockedReason==="missing_session_token"?t("settings.license.detail.manualActivation","Manual activation required to restore Pro access."):n.detail}),u.refreshBlockedReason==="missing_session_token"&&e.jsx("p",{className:`${a.licenseNotice} ${a.licenseNoticeMuted}`,children:n==null?void 0:n.detail})]})})(),u.tier==="basic"&&e.jsx(g,{text:t("tier.upgrade.tooltip","View Pro features and purchase options."),children:e.jsx("a",{className:a.upgradeLink,href:ye.settingsLicense,target:"_blank",rel:"noopener noreferrer",onClick:()=>f("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(g,{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:i||v||!T,onClick:()=>{b()},children:v?t("common.loading"):t("settings.license.refresh","Refresh License")})}),e.jsx(g,{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:i||v||!T,onClick:()=>{B()},children:v?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(_,{label:t("settings.license.keyInput","License Key"),tooltip:t("settings.license.key.tooltip","Masked license key currently loaded by the server.")})}),e.jsx("input",{"aria-label":t("settings.license.keyInput","License Key"),className:a.textInput,type:"text",value:k,disabled:i||v,onChange:n=>S(n.target.value)})]}),e.jsx(g,{text:t("settings.license.activate.tooltip","Activate Pro features with the entered license key."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:i||v,onClick:()=>{(async()=>await I(k)&&S(""))()},children:v?t("common.loading"):t("settings.license.activate","Activate License")})})]}),m&&e.jsx("p",{className:a.licenseMessage,children:m})]})]})]}),e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(_,{label:t("settings.general.title","General Settings"),tooltip:t("settings.general.title.tooltip","Hot settings that apply immediately when changed.")}),e.jsx(g,{text:t("settings.general.liveApply.tooltip","Changes in this section are applied immediately without a separate save button."),children:e.jsx("span",{className:`${a.headerBadge} ${a.headerBadgeLive}`,children:t("settings.general.liveApply","Live Apply")})})]}),o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.logLevel","Log Level"),tooltip:t("settings.general.logLevel.tooltip","Sets how much detail WEPPY Dashboard writes to its logs.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("select",{className:a.select,value:o.hot.LOG_LEVEL,onChange:n=>p("LOG_LEVEL",n.target.value),children:ms.map(n=>e.jsx("option",{value:n,children:n},n))}),y==="LOG_LEVEL"&&e.jsx("span",{className:a.savedIndicator,children:t("settings.general.applied")})]})]}),e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.localHistory","Tool History Recording"),tooltip:t("settings.general.localHistory.tooltip","Stores local tool execution history for the WEPPY Dashboard history views.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("span",{className:`${a.savedIndicator} ${y==="ENABLE_LOCAL_HISTORY"?"":a.savedIndicatorHidden}`,children:t("settings.general.applied","Applied")}),e.jsx(ae,{checked:o.hot.ENABLE_LOCAL_HISTORY,ariaLabel:t("settings.general.localHistory","Tool History Recording"),testId:"settings-toggle-enable-local-history",onChange:n=>p("ENABLE_LOCAL_HISTORY",n)})]})]}),e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.localStatistics","Tool Statistics Collection"),tooltip:t("settings.general.localStatistics.tooltip","Aggregates local usage statistics for WEPPY Dashboard reporting.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("span",{className:`${a.savedIndicator} ${y==="ENABLE_LOCAL_STATISTICS"?"":a.savedIndicatorHidden}`,children:t("settings.general.applied","Applied")}),e.jsx(ae,{checked:o.hot.ENABLE_LOCAL_STATISTICS,ariaLabel:t("settings.general.localStatistics","Tool Statistics Collection"),testId:"settings-toggle-enable-local-statistics",onChange:n=>p("ENABLE_LOCAL_STATISTICS",n)})]})]}),e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.contextCapture","Context Capture"),tooltip:t("settings.general.contextCapture.tooltip","When enabled, WEPPY Dashboard records structured execution context for changelog and playtest views.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("span",{className:`${a.savedIndicator} ${y==="ENABLE_CONTEXT_CAPTURE"?"":a.savedIndicatorHidden}`,children:t("settings.general.applied","Applied")}),e.jsx(ae,{checked:o.hot.ENABLE_CONTEXT_CAPTURE,ariaLabel:t("settings.general.contextCapture","Context Capture"),testId:"settings-toggle-enable-context-capture",onChange:n=>p("ENABLE_CONTEXT_CAPTURE",n)})]})]}),e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.requestTimeout","Action Timeout"),tooltip:t("settings.general.requestTimeout.tooltip","Maximum time WEPPY Dashboard waits for an action before it fails.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("input",{type:"number",className:a.numberInput,value:o.hot.REQUEST_TIMEOUT,min:1e3,max:12e4,step:1e3,onChange:n=>{const C=parseInt(n.target.value,10);isNaN(C)||p("REQUEST_TIMEOUT",C)}}),e.jsx(g,{text:t("settings.general.requestTimeout.unit.tooltip","Action timeout is measured in milliseconds."),children:e.jsx("span",{className:a.unit,children:t("settings.general.requestTimeout.unit","ms")})}),y==="REQUEST_TIMEOUT"&&e.jsx("span",{className:a.savedIndicator,children:t("settings.general.applied","Applied")})]})]})]}):e.jsx("div",{className:a.loading,children:t("settings.unavailable")})]}),e.jsx(hs,{tier:d}),e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(_,{label:t("settings.cold.title","Server Environment"),tooltip:t("settings.cold.title.tooltip","Read-only server environment values loaded at startup.")}),e.jsx(g,{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")})})]}),o?e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.coldGrid,children:[e.jsx("dt",{children:e.jsx(_,{label:"HTTP_PORT",tooltip:t("settings.cold.httpPort.tooltip","Port number used by the MCP WEPPY Dashboard HTTP server.")})}),e.jsx("dd",{children:o.cold.HTTP_PORT}),e.jsx("dt",{children:e.jsx(_,{label:"HTTP_HOST",tooltip:t("settings.cold.httpHost.tooltip","Host interface that the MCP WEPPY Dashboard HTTP server binds to.")})}),e.jsx("dd",{children:o.cold.HTTP_HOST}),e.jsx("dt",{children:e.jsx(_,{label:"DASHBOARD_AUTO_OPEN",tooltip:t("settings.cold.dashboardAutoOpen.tooltip","Controls whether WEPPY Dashboard opens automatically in the browser when the server starts.")})}),e.jsx("dd",{children:e.jsx(g,{text:t("settings.cold.dashboardAutoOpen.value.tooltip","Current startup behavior for opening WEPPY Dashboard in a browser."),children:String(o.cold.DASHBOARD_AUTO_OPEN)})})]}),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(_,{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(_,{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(g,{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:n=>r(n.target.value),children:[e.jsx("option",{value:me,children:t("settings.language.auto","Auto")}),ve.map(n=>e.jsx("option",{value:n,children:ys[n]??n},n))]})})]})]})]})}export{Ns as Component};
|
|
1
|
+
import{d as re,r as c,f as ce,D as de,e as ue,g as ge,h as pe,a as D,u as V,i as ie,j as e,k as he,T as ye,A as me,S as ve}from"./index-VNIYQxwF.js";import{I as _}from"./InfoLabel-LyMkHb1i.js";import{T as g}from"./TooltipText-BPEldl3x.js";import{C as _e}from"./ConfirmModal-C66ZwIur.js";import{D as ne,f as oe,r as xe,s as je,a as le,d as K,S as te,b as fe}from"./sample-requests-Bttgc133.js";function be(){const{level:t}=re(),[s,r]=c.useState(null),[f,o]=c.useState(null),[u,i]=c.useState(!1),[v,m]=c.useState(!0),[I,b]=c.useState(!1),[B,x]=c.useState(null),H=t==="disconnected",y=c.useCallback(d=>{d&&o(p=>({...p,...d,maskedKey:d.maskedKey??(p==null?void 0:p.maskedKey),provider:d.provider??(p==null?void 0:p.provider)??"auto"}))},[]),j=c.useCallback(d=>{if(!d){o(null);return}o({...d,provider:d.provider??"auto"})},[]),k=c.useCallback(async()=>{try{return await ce()}catch{return null}},[]);c.useEffect(()=>{let d=!1;async function p(){try{const[n,C]=await Promise.all([D.get("/api/dashboard/settings").catch(()=>null),k()]);if(d)return;n&&r(n),C&&y(C)}catch{}finally{d||m(!1)}}return p(),()=>{d=!0}},[k,y]),c.useEffect(()=>{const d=new de;d.connect();const p=d.on("license",n=>{k().then(C=>{if(C){if((n==null?void 0:n.cleared)===!0){j(C);return}y(C)}})});return()=>{p(),d.disconnect()}},[k,y,j]);const S=c.useCallback((d,p)=>{x(d??p)},[]),w=c.useCallback(async d=>{if(H)return!1;if(!d.trim())return x("License key is required."),!1;b(!0);try{const p=await ue({licenseKey:d.trim()});return y(p.license),S(p.message,p.ok?"License updated.":"License activation failed."),p.ok}catch{return x("License activation failed."),!1}finally{b(!1)}},[S,H,y]),T=c.useCallback(async()=>{if(!H){b(!0);try{const d=await ge();y(d.license),S(d.message,d.ok?"License updated.":"License refresh failed.")}catch{x("License refresh failed.")}finally{b(!1)}}},[S,H,y]),E=c.useCallback(async()=>{if(!H){b(!0);try{const d=await pe();j(d.license),S(d.message,d.ok?"License reset.":"License reset failed.")}catch{x("License reset failed.")}finally{b(!1)}}},[S,H,j]),A=c.useCallback(async(d,p)=>{if(s){r(n=>n&&{...n,hot:{...n.hot,[d]:p}}),i(!0);try{await D.patch("/api/dashboard/settings",{[d]:p})}catch{r(n=>n&&{...n,hot:{...n.hot,[d]:s.hot[d]}})}finally{i(!1)}}},[s]);return{settings:s,license:f,saving:u,licenseControlsDisabled:H,licenseSubmitting:I,licenseMessage:B,activateLicense:w,refreshLicense:T,resetLicense:E,updateHotSetting:A,loading:v}}const Se="_card_1jlvt_4",Ne="_cardEmbedded_1jlvt_14",Le="_cardTitle_1jlvt_21",Ce="_usageRow_1jlvt_30",He="_usageTotal_1jlvt_36",ke="_usageBreakdown_1jlvt_42",we="_usageCounts_1jlvt_47",Re="_divider_1jlvt_53",Te="_lastRunRow_1jlvt_60",Ee="_lastRunLabel_1jlvt_69",Ae="_errorIcon_1jlvt_75",Be="_tooltip_1jlvt_83",Ie="_cleanupRow_1jlvt_106",De="_cleanupLabel_1jlvt_113",Pe="_cleanupBtn_1jlvt_120",Me="_cleanupBtnDanger_1jlvt_143",$e="_retentionSection_1jlvt_155",Ue="_retentionTitle_1jlvt_161",Oe="_retentionFieldset_1jlvt_170",ze="_proOverlay_1jlvt_185",Fe="_radioRow_1jlvt_197",Ge="_radioLabel_1jlvt_204",qe="_presetGroup_1jlvt_224",We="_presetBtn_1jlvt_232",Ye="_presetBtnActive_1jlvt_249",Ke="_freeInput_1jlvt_256",Ve="_inputError_1jlvt_272",Qe="_inputUnit_1jlvt_276",Xe="_cascadeRow_1jlvt_283",Je="_retentionActions_1jlvt_302",Ze="_saveBtn_1jlvt_308",et="_runNowBtn_1jlvt_330",tt="_errorMsg_1jlvt_353",l={card:Se,cardEmbedded:Ne,cardTitle:Le,usageRow:Ce,usageTotal:He,usageBreakdown:ke,usageCounts:we,divider:Re,lastRunRow:Te,lastRunLabel:Ee,errorIcon:Ae,tooltip:Be,cleanupRow:Ie,cleanupLabel:De,cleanupBtn:Pe,cleanupBtnDanger:Me,retentionSection:$e,retentionTitle:Ue,retentionFieldset:Oe,proOverlay:ze,radioRow:Fe,radioLabel:Ge,presetGroup:qe,presetBtn:We,presetBtnActive:Ye,freeInput:Ke,inputError:Ve,inputUnit:Qe,cascadeRow:Xe,retentionActions:Je,saveBtn:Ze,runNowBtn:et,errorMsg:tt};function st(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 se(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 at(t,s){return t.mode===s.mode&&t.ageDays===s.ageDays&&t.sizeMb===s.sizeMb&&t.cascadeSnapshots===s.cascadeSnapshots}function O(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 it({placeId:t,tier:s,currentPolicy:r,onSaved:f}){const{t:o}=V(),{trackEvent:u}=ie(),[i,v]=c.useState(r),[m,I]=c.useState(()=>[7,14,30,90].includes(r.ageDays??-1)?"":String(r.ageDays??30)),[b,B]=c.useState(()=>[100,500,1e3].includes(r.sizeMb??-1)?"":String(r.sizeMb??500)),[x,H]=c.useState(null),[y,j]=c.useState(!1),[k,S]=c.useState(!1),[w,T]=c.useState(!1),[E,A]=c.useState(null);c.useEffect(()=>{v(r);const h=[7,14,30,90],R=[100,500,1e3];I(h.includes(r.ageDays??-1)?"":String(r.ageDays??30)),B(R.includes(r.sizeMb??-1)?"":String(r.sizeMb??500))},[r]);const d=s==="basic",p=se(i),n=at(r,i),C=p&&!n&&!k,N=h=>{v(R=>{const U={...R,mode:h};return h==="age"&&(U.ageDays=parseInt(m,10)||30),h==="size"&&(U.sizeMb=parseInt(b,10)||500),U})},L=h=>{I(""),v(R=>({...R,ageDays:h}))},z=h=>{B(""),v(R=>({...R,sizeMb:h}))},Q=h=>{I(h);const R=parseInt(h,10);Number.isNaN(R)||v(U=>({...U,ageDays:R}))},M=h=>{B(h);const R=parseInt(h,10);Number.isNaN(R)||v(U=>({...U,sizeMb:R}))},X=async()=>{if(A(null),u("dashboard_click_event",{click_target:"ui_studio_cleanup_save",page:"settings"}),st(r,i)){try{const h=await oe(t,{mode:i.mode,ageDays:i.ageDays,sizeMb:i.sizeMb,cascadeSnapshots:i.cascadeSnapshots});H(h.dryRun),j(!0)}catch(h){A(h.message)}return}await Y()},Y=async()=>{S(!0);try{await je(t,i),j(!1),f()}catch(h){throw A(h.message),h}finally{S(!1)}},J=async()=>{A(null),u("dashboard_click_event",{click_target:"ui_studio_cleanup_run_now",page:"settings"}),T(!0);try{await xe(t),f()}catch(h){A(h.message)}finally{T(!1)}},Z=x?`${o("uiStudio.cleanup.policy.confirm.messageStrict","이 정책으로 즉시")} ${x.wouldRemoveRequests}${o("uiStudio.cleanup.policy.confirm.requests","건")} / ${x.wouldRemoveSnapshots}${o("uiStudio.cleanup.policy.confirm.snapshots","개 화면 캡처")} / ${O(x.wouldFreeBytes)} ${o("uiStudio.cleanup.policy.confirm.freed","가 삭제됩니다 — 적용?")}`:"",$=i.mode==="age"&&!se(i),ee=i.mode==="size"&&!se(i);return e.jsxs("div",{className:l.retentionSection,children:[e.jsx("h3",{className:l.retentionTitle,children:e.jsx(_,{label:o("uiStudio.cleanup.policy.title","자동 삭제 정책"),tooltip:o("uiStudio.cleanup.policy.title.tooltip","Rules that automatically remove old or large captures.")})}),e.jsxs("div",{style:{position:"relative"},children:[d&&e.jsx("div",{className:l.proOverlay,title:o("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능"),children:e.jsx("div",{className:l.tooltip,children:o("uiStudio.cleanup.policy.proRequired","Pro에서 사용 가능")})}),e.jsxs("fieldset",{className:l.retentionFieldset,disabled:d,style:d?{opacity:.45,pointerEvents:"none"}:void 0,children:[e.jsx("div",{className:l.radioRow,children:e.jsx(g,{text:o("uiStudio.cleanup.policy.modeOff.tooltip","Turn off auto-cleanup. Data stays until you remove it manually."),children:e.jsxs("label",{className:l.radioLabel,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"off",checked:i.mode==="off",onChange:()=>N("off")}),o("uiStudio.cleanup.policy.modeOff","사용 안 함 (off)")]})})}),e.jsxs("div",{children:[e.jsx("div",{className:l.radioRow,children:e.jsx(g,{text:o("uiStudio.cleanup.policy.modeAge.tooltip","Automatically delete data older than the configured number of days."),children:e.jsxs("label",{className:l.radioLabel,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"age",checked:i.mode==="age",onChange:()=>N("age")}),o("uiStudio.cleanup.policy.modeAge","기간 기반 (age)")]})})}),i.mode==="age"&&e.jsxs("div",{className:l.presetGroup,children:[[7,14,30,90].map(h=>e.jsx(g,{text:o("uiStudio.cleanup.policy.agePreset.tooltip","Delete data older than this many days."),children:e.jsxs("button",{type:"button",className:`${l.presetBtn} ${i.ageDays===h&&m===""?l.presetBtnActive:""}`,onClick:()=>L(h),children:[h,o("uiStudio.cleanup.policy.daysUnit","일")]})},h)),e.jsx(g,{text:o("uiStudio.cleanup.policy.ageInput.tooltip","Enter any value between 1 and 365 days."),children:e.jsx("input",{type:"number",className:`${l.freeInput} ${$?l.inputError:""}`,value:m,min:1,max:365,onChange:h=>Q(h.target.value)})}),e.jsxs("span",{className:l.inputUnit,children:["1–365",o("uiStudio.cleanup.policy.daysUnit","일")]})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:l.radioRow,children:e.jsx(g,{text:o("uiStudio.cleanup.policy.modeSize.tooltip","When total usage exceeds the limit, the oldest data is removed first."),children:e.jsxs("label",{className:l.radioLabel,children:[e.jsx("input",{type:"radio",name:"cleanupMode",value:"size",checked:i.mode==="size",onChange:()=>N("size")}),o("uiStudio.cleanup.policy.modeSize","용량 기반 (size)")]})})}),i.mode==="size"&&e.jsxs("div",{className:l.presetGroup,children:[[100,500,1e3].map(h=>e.jsx(g,{text:o("uiStudio.cleanup.policy.sizePreset.tooltip","Keep total usage under this size."),children:e.jsxs("button",{type:"button",className:`${l.presetBtn} ${i.sizeMb===h&&b===""?l.presetBtnActive:""}`,onClick:()=>z(h),children:[h,o("uiStudio.cleanup.policy.mbUnit","MB")]})},h)),e.jsx(g,{text:o("uiStudio.cleanup.policy.sizeInput.tooltip","Enter any value between 50 MB and 10000 MB (10 GB)."),children:e.jsx("input",{type:"number",className:`${l.freeInput} ${ee?l.inputError:""}`,value:b,min:50,max:1e4,onChange:h=>M(h.target.value)})}),e.jsxs("span",{className:l.inputUnit,children:["50–10000",o("uiStudio.cleanup.policy.mbUnit","MB")]})]})]}),e.jsx(g,{text:o("uiStudio.cleanup.policy.cascade.tooltip","Also delete the capture images linked to those records. If off, the images stay."),children:e.jsxs("label",{className:l.cascadeRow,children:[e.jsx("input",{type:"checkbox",checked:i.cascadeSnapshots,onChange:h=>v(R=>({...R,cascadeSnapshots:h.target.checked}))}),o("uiStudio.cleanup.policy.cascade","연결된 화면 캡처도 함께 삭제")]})}),e.jsxs("div",{className:l.retentionActions,children:[e.jsx(g,{text:o("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:l.saveBtn,onClick:()=>void X(),disabled:!C,children:o("uiStudio.cleanup.policy.save","정책 저장")})}),e.jsx(g,{text:o("uiStudio.cleanup.policy.runNow.tooltip","Run the current rule once now, without waiting for the next scheduled run."),children:e.jsx("button",{type:"button",className:l.runNowBtn,onClick:()=>void J(),disabled:w,children:o("uiStudio.cleanup.policy.runNow","지금 정리")})})]}),E&&e.jsx("div",{className:l.errorMsg,children:E})]})]}),y&&x&&e.jsx(ne,{title:o("uiStudio.cleanup.policy.confirm.title","정책 적용 확인"),message:Z,danger:!0,confirmLabel:o("uiStudio.cleanup.policy.save","정책 저장"),busy:k,onConfirm:Y,onClose:()=>j(!1)})]})}function nt({placeId:t,tier:s,onChanged:r,sampleUsage:f,sampleRetention:o,embedded:u=!1}){const{t:i}=V(),v=s==="basic"&&f!=null&&o!=null,[m,I]=c.useState(v?f:null),[b,B]=c.useState(v?o:null),[x,H]=c.useState(null),[y,j]=c.useState(null),[k,S]=c.useState(null),w=c.useCallback(async()=>{if(!v&&t!=null){H(null);try{const[N,L]=await Promise.all([le(t),oe(t)]);I(N),B(L.policy)}catch(N){H(N.message)}}},[t,v]);c.useEffect(()=>{w()},[w]);const T=c.useCallback(()=>{w(),r==null||r()},[w,r]),E=c.useCallback(async()=>{if(y&&t!=null){S(null);try{y.kind==="keep7"?await K(t,{olderThanDays:7,alsoSnapshots:!0}):y.kind==="keep30"?await K(t,{olderThanDays:30,alsoSnapshots:!0}):await K(t,{all:!0,alsoSnapshots:!0}),j(null),w(),r==null||r()}catch(N){throw S(N.message),N}}},[y,t,w,r]);function A(N){const L=i("uiStudio.cleanup.studioPreservedNote","This deletes saved change records and screenshots on disk only; Roblox Studio instances are not affected.");return N.kind==="keep7"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep7","7일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${L}`:N.kind==="keep30"?`${i("uiStudio.cleanup.cleanupConfirmMessage.keep30","30일 이전 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${L}`:`${((m==null?void 0:m.requestCount)??0)+((m==null?void 0:m.snapshotCount)??0)}${i("uiStudio.cleanup.cleanupConfirmMessage.all","개의 저장된 변경 기록과 화면 캡처가 삭제됩니다. 이 작업은 되돌릴 수 없습니다.")} ${L}`}if(t==null&&!v)return null;if(x)return e.jsx("div",{className:`${l.card} ${u?l.cardEmbedded:""}`,children:e.jsx("p",{className:l.errorMsg,children:x})});if(!m||!b)return e.jsx("div",{className:`${l.card} ${u?l.cardEmbedded:""}`,children:e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:0},children:i("uiStudio.storage.loading","로딩 중...")})});const d=b.lastRunAt,p=b.lastRunStats,n=d?new Date(d).toLocaleString():null,C=t??0;return e.jsxs("div",{className:`${l.card} ${u?l.cardEmbedded:""}`,children:[e.jsx("h3",{className:l.cardTitle,children:e.jsx(_,{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:l.usageRow,children:[e.jsx(g,{text:i("uiStudio.storage.usageLabel.tooltip","Disk space currently used by UI Studio for this project."),children:e.jsxs("div",{className:l.usageTotal,children:[i("uiStudio.storage.usageLabel","사용 중")," ",O(m.totalBytes)]})}),e.jsxs("div",{className:l.usageBreakdown,children:[e.jsx(g,{text:i("uiStudio.storage.historyBytes.tooltip","Space taken by change record data (JSON)."),children:e.jsxs("span",{children:[i("uiStudio.storage.historyBytes","변경 이력")," ",O(m.historyBytes)]})})," · ",e.jsx(g,{text:i("uiStudio.storage.snapshotBytes.tooltip","Space taken by captured PNG image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotBytes","화면 캡처")," ",O(m.snapshotBytes)]})})]}),e.jsxs("div",{className:l.usageCounts,children:[e.jsx(g,{text:i("uiStudio.storage.requestCount.tooltip","Number of actions where AI changed the UI."),children:e.jsxs("span",{children:[i("uiStudio.storage.requestCount","변경 기록")," ",m.requestCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(g,{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","변경 상세")," ",m.mutationCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})," · ",e.jsx(g,{text:i("uiStudio.storage.snapshotCount.tooltip","Number of saved capture image files."),children:e.jsxs("span",{children:[i("uiStudio.storage.snapshotCount","화면 캡처")," ",m.snapshotCount.toLocaleString(),i("uiStudio.storage.countSuffix","개")]})})]})]}),e.jsx("hr",{className:l.divider}),e.jsx(it,{placeId:C,tier:s,currentPolicy:b,onSaved:T}),e.jsx("hr",{className:l.divider}),e.jsxs("div",{className:l.lastRunRow,children:[e.jsx("span",{className:l.lastRunLabel,children:e.jsx(_,{label:i("uiStudio.storage.lastRun","마지막 자동 정리"),tooltip:i("uiStudio.storage.lastRun.tooltip","When the auto-cleanup policy last ran, and what it removed.")})}),n?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:n}),p&&e.jsxs("span",{children:["· ",i("uiStudio.storage.requestCount","변경 기록")," ",p.removedRequests,i("uiStudio.storage.countSuffix","개")," / ",i("uiStudio.storage.snapshotCount","화면 캡처")," ",p.removedSnapshots,i("uiStudio.storage.countSuffix","개")," / ",O(p.freedBytes)," ",i("uiStudio.storage.lastRunFreed","회수")]}),p&&p.errors>0&&e.jsxs("span",{className:l.errorIcon,title:`${i("uiStudio.storage.lastRunErrors","오류")} ${p.errors}건`,children:["⚠",e.jsxs("span",{className:l.tooltip,children:[i("uiStudio.storage.lastRunErrors","오류")," ",p.errors,i("uiStudio.storage.countSuffix","건")]})]})]}):e.jsx("span",{children:i("uiStudio.storage.lastRunNever","—")})]}),e.jsx("hr",{className:l.divider}),e.jsxs("div",{className:l.cleanupRow,children:[e.jsx("span",{className:l.cleanupLabel,children:e.jsx(_,{label:i("uiStudio.cleanup.label","수동 정리"),tooltip:i("uiStudio.cleanup.label.tooltip","Manually clean up change records and captures whenever you want.")})}),e.jsx(g,{text:i("uiStudio.cleanup.keep7.tooltip","Delete change records and captures older than 7 days."),children:e.jsx("button",{type:"button",className:l.cleanupBtn,onClick:()=>j({kind:"keep7"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 7일만 남기기").replace("{n}","7")})}),e.jsx(g,{text:i("uiStudio.cleanup.keep30.tooltip","Delete change records and captures older than 30 days."),children:e.jsx("button",{type:"button",className:l.cleanupBtn,onClick:()=>j({kind:"keep30"}),disabled:s==="basic",children:i("uiStudio.cleanup.keepLastNDays","최근 30일만 남기기").replace("{n}","30")})}),e.jsx(g,{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:`${l.cleanupBtn} ${l.cleanupBtnDanger}`,onClick:()=>j({kind:"all"}),disabled:s==="basic",children:i("uiStudio.cleanup.deleteAll","전체 삭제…")})})]}),k&&e.jsx("div",{className:l.errorMsg,children:k}),y&&e.jsx(ne,{title:i("uiStudio.cleanup.cleanupConfirmTitle","정리 확인"),message:A(y),danger:!0,confirmLabel:i("common.delete","삭제"),onConfirm:E,onClose:()=>{j(null),S(null)}})]})}const ot="_page_16yvc_2",lt="_card_16yvc_10",rt="_licenseCardPro_16yvc_17",ct="_cardHeader_16yvc_28",dt="_cardHeaderActions_16yvc_41",ut="_collapseButton_16yvc_47",gt="_headerBadge_16yvc_69",pt="_headerBadgeLive_16yvc_80",ht="_licenseGrid_16yvc_86",yt="_statusDot_16yvc_104",mt="_statusActive_16yvc_113",vt="_statusGrace_16yvc_118",_t="_statusInactive_16yvc_123",xt="_statusError_16yvc_127",jt="_proBadge_16yvc_132",ft="_upgradeLink_16yvc_146",bt="_licenseControls_16yvc_160",St="_licenseControlRow_16yvc_169",Nt="_licenseField_16yvc_176",Lt="_licenseFieldGrow_16yvc_182",Ct="_controlLabel_16yvc_187",Ht="_textInput_16yvc_193",kt="_actionBtn_16yvc_209",wt="_licenseMessage_16yvc_231",Rt="_licenseNotice_16yvc_238",Tt="_licenseNoticeInfo_16yvc_248",Et="_licenseNoticeWarning_16yvc_254",At="_licenseNoticeMuted_16yvc_260",Bt="_settingRow_16yvc_266",It="_settingLabel_16yvc_280",Dt="_settingControl_16yvc_287",Pt="_select_16yvc_296",Mt="_numberInput_16yvc_314",$t="_toggleSwitch_16yvc_332",Ut="_toggleInput_16yvc_339",Ot="_toggleTrack_16yvc_347",zt="_toggleThumb_16yvc_369",Ft="_savedIndicator_16yvc_418",Gt="_savedIndicatorHidden_16yvc_429",qt="_dataHistoryIntro_16yvc_434",Wt="_dataHistoryList_16yvc_442",Yt="_dataHistoryRow_16yvc_448",Kt="_dataHistoryDetail_16yvc_457",Vt="_uiStudioDataHistoryRow_16yvc_462",Qt="_uiStudioDataHistoryDetail_16yvc_467",Xt="_dataHistoryMain_16yvc_474",Jt="_dataHistoryTitle_16yvc_478",Zt="_dataHistoryDescription_16yvc_484",es="_dataHistoryMetric_16yvc_492",ts="_dataHistoryActions_16yvc_499",ss="_linkButton_16yvc_505",as="_dangerButton_16yvc_506",is="_inlineStatus_16yvc_542",ns="_coldGrid_16yvc_550",os="_coldHint_16yvc_568",ls="_langRow_16yvc_577",rs="_loading_16yvc_590",cs="_unit_16yvc_599",a={page:ot,card:lt,licenseCardPro:rt,cardHeader:ct,cardHeaderActions:dt,collapseButton:ut,headerBadge:gt,headerBadgeLive:pt,licenseGrid:ht,statusDot:yt,statusActive:mt,statusGrace:vt,statusInactive:_t,statusError:xt,proBadge:jt,upgradeLink:ft,licenseControls:bt,licenseControlRow:St,licenseField:Nt,licenseFieldGrow:Lt,controlLabel:Ct,textInput:Ht,actionBtn:kt,licenseMessage:wt,licenseNotice:Rt,licenseNoticeInfo:Tt,licenseNoticeWarning:Et,licenseNoticeMuted:At,settingRow:Bt,settingLabel:It,settingControl:Dt,select:Pt,numberInput:Mt,toggleSwitch:$t,toggleInput:Ut,toggleTrack:Ot,toggleThumb:zt,savedIndicator:Ft,savedIndicatorHidden:Gt,dataHistoryIntro:qt,dataHistoryList:Wt,dataHistoryRow:Yt,dataHistoryDetail:Kt,uiStudioDataHistoryRow:Vt,uiStudioDataHistoryDetail:Qt,dataHistoryMain:Xt,dataHistoryTitle:Jt,dataHistoryDescription:Zt,dataHistoryMetric:es,dataHistoryActions:ts,linkButton:ss,dangerButton:as,inlineStatus:is,coldGrid:ns,coldHint:os,langRow:ls,loading:rs,unit:cs},ds={toolsActivity:null,toolStats:null,toolSessions:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null},us={toolsActivity:null,toolStats:null,syncLog:null,playtestReports:null,projectChanges:null,connectionLog:null};function gs(t){var s;return t?t.pluginConnected?t.activePlaceId:t.lastActivePlaceId??((s=t.places[0])==null?void 0:s.placeId)??null:null}async function P(t){try{return await t}catch{return null}}function q(t){return t?typeof t.total=="number"?t.total:Array.isArray(t.entries)?t.entries.length:null:null}function W(t,s,r,f){return s===null?t("settings.dataHistory.metric.unavailable","Unavailable"):`${s.toLocaleString()} ${t(r,f)}`}function F(t,s,r){const f=r===null?t("settings.dataHistory.metric.sizeUnavailable","size unavailable"):O(r);return`${s} · ${f}`}function G(t,s){var f;const r=(f=t==null?void 0:t[s])==null?void 0:f.bytes;return typeof r=="number"&&Number.isFinite(r)?r:null}function ps(t,s){return s?[`${s.requestCount.toLocaleString()} ${t("uiStudio.storage.requestCount","change records")}`,`${s.snapshotCount.toLocaleString()} ${t("uiStudio.storage.snapshotCount","screenshots")}`,O(s.totalBytes)].join(" · "):t("settings.dataHistory.metric.unavailable","Unavailable")}function hs({tier:t}){const{t:s}=V(),[r,f]=c.useState(ds),[o,u]=c.useState(us),[i,v]=c.useState(t==="basic"?te:null),[m,I]=c.useState(null),[b,B]=c.useState(!0),[x,H]=c.useState(!0),[y,j]=c.useState(null),[k,S]=c.useState(!1),[w,T]=c.useState(null),E=c.useCallback(async()=>{B(!0);const L=await P(he()),z=gs(L);I(z);const[Q,M,X,Y,J,Z,$]=await Promise.all([P(D.get("/api/dashboard/history",{limit:"1",offset:"0"})),P(D.get("/api/dashboard/tool-stats")),P(D.get("/sync/history",{limit:"1",offset:"0"})),P(D.get("/api/dashboard/playtest/history")),P(D.get("/api/dashboard/changelog",{limit:"1",offset:"0"})),P(D.get("/api/dashboard/connection-log")),P(D.get("/api/dashboard/storage-summary"))]),ee=t==="basic"?te:z===null?null:await P(le(z));f({toolsActivity:q(Q),toolStats:(M==null?void 0:M.totalCalls)??null,toolSessions:(M==null?void 0:M.totalSessions)??null,syncLog:q(X),playtestReports:q(Y),projectChanges:q(J),connectionLog:q(Z)}),u({toolsActivity:G($,"toolsActivity"),toolStats:G($,"toolStats"),syncLog:G($,"syncLog"),playtestReports:G($,"playtestReports"),projectChanges:G($,"projectChanges"),connectionLog:G($,"connectionLog")}),v(ee),B(!1)},[t]);c.useEffect(()=>{E()},[E]);const A=c.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:F(s,W(s,r.toolsActivity,"settings.dataHistory.metric.records","records"),o.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:F(s,r.toolStats===null?s("settings.dataHistory.metric.unavailable","Unavailable"):`${r.toolStats.toLocaleString()} ${s("settings.dataHistory.metric.runs","runs")} · ${(r.toolSessions??0).toLocaleString()} ${s("settings.dataHistory.metric.sessions","sessions")}`,o.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:F(s,W(s,r.syncLog,"settings.dataHistory.metric.records","records"),o.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:F(s,W(s,r.playtestReports,"settings.dataHistory.metric.reports","reports"),o.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:F(s,W(s,r.projectChanges,"settings.dataHistory.metric.records","records"),o.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:F(s,W(s,r.connectionLog,"settings.dataHistory.metric.records","records"),o.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"}],[r,o,s]),d=async()=>{if(y){S(!0),T(null);try{if(y.kind==="uiStudio"){if(t!=="pro"||m===null)throw new Error("UI Studio place is unavailable");await K(m,{all:!0,alsoSnapshots:!0}),T(s("settings.dataHistory.uiStudio.clear.success","UI Studio saved data cleared."))}else await D.post(y.row.clearEndpoint),T(s("settings.dataHistory.clear.success","Saved data cleared."));j(null),await E()}catch{T(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{S(!1)}}},p=t==="pro"?m:0,n=t==="pro"&&m!==null,C=(y==null?void 0:y.kind)==="uiStudio",N=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(_,{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(g,{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:b?s("common.loading","Loading"):s("settings.dataHistory.scope","Current project")})}),e.jsx(g,{text:s("settings.dataHistory.toggle.tooltip","Collapse or expand this section."),children:e.jsx("button",{className:a.collapseButton,type:"button","aria-expanded":x,"aria-controls":"settings-data-history-body","aria-label":x?s("settings.dataHistory.collapse","Collapse {title}").replace("{title}",N):s("settings.dataHistory.expand","Expand {title}").replace("{title}",N),onClick:()=>H(L=>!L),children:x?"▾":"▸"})})]})]}),x&&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:[A.map(L=>e.jsxs("div",{className:a.dataHistoryRow,children:[e.jsxs("div",{className:a.dataHistoryMain,children:[e.jsx("div",{className:a.dataHistoryTitle,children:L.title}),e.jsx("div",{className:a.dataHistoryDescription,children:L.description})]}),e.jsx(g,{text:L.metricTooltip,children:e.jsx("div",{className:a.dataHistoryMetric,children:L.metric})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(g,{text:s("settings.dataHistory.open.tooltip","Open the page that shows this item in detail."),children:e.jsx("a",{className:a.linkButton,href:`#${L.route}`,children:s("settings.dataHistory.open","Open")})}),e.jsx(g,{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",onClick:()=>j({kind:"row",row:L}),children:s("common.clear","Clear")})})]})]},L.key)),e.jsxs("div",{className:`${a.dataHistoryRow} ${a.uiStudioDataHistoryRow}`,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(g,{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:ps(s,i)})}),e.jsxs("div",{className:a.dataHistoryActions,children:[e.jsx(g,{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(g,{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:!n,onClick:()=>j({kind:"uiStudio"}),children:s("common.clear","Clear")})})]})]}),e.jsx("div",{className:`${a.dataHistoryDetail} ${a.uiStudioDataHistoryDetail}`,children:e.jsx(nt,{placeId:p,tier:t,onChanged:E,embedded:!0,...t==="basic"?{sampleUsage:te,sampleRetention:fe}:{}})})]}),w&&e.jsx("p",{className:a.inlineStatus,children:w})]})]}),e.jsx(_e,{open:y!==null,title:C?s("settings.dataHistory.uiStudio.clear.title","Clear UI Studio saved data?"):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."):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:s("common.clear","Clear"),loading:k,onCancel:()=>!k&&j(null),onConfirm:()=>void d()})]})}const ys={en:"English",ko:"한국어",es:"Español","pt-br":"Português (BR)",ja:"日本語",id:"Bahasa Indonesia",de:"Deutsch","fr-fr":"Français"},ms=["debug","info","warn","error"];function vs(t){return t==="active"?a.statusActive:t==="grace"?a.statusGrace:t==="invalid"||t==="revoked"?a.statusError:a.statusInactive}function _s(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 ae({checked:t,onChange:s,testId:r,ariaLabel:f}){return e.jsxs("label",{className:a.toggleSwitch,"data-testid":r,children:[e.jsx("input",{type:"checkbox",className:a.toggleInput,checked:t,"aria-label":f,onChange:o=>s(o.target.checked)}),e.jsx("span",{className:a.toggleTrack,"aria-hidden":"true",children:e.jsx("span",{className:a.toggleThumb})})]})}function Ns(){const{t,selectedLocale:s,setLocale:r}=V(),{trackEvent:f}=ie(),{settings:o,license:u,licenseControlsDisabled:i,licenseSubmitting:v,licenseMessage:m,activateLicense:I,refreshLicense:b,resetLicense:B,updateHotSetting:x,loading:H}=be(),[y,j]=c.useState(null),[k,S]=c.useState(""),w=u?_s(u,t):null,T=(u==null?void 0:u.tier)==="pro",E=(u==null?void 0:u.tier)==="pro"?u.maskedKey:void 0,A=u!=null&&u.provider&&u.provider!=="auto"?u.provider:void 0,d=(u==null?void 0:u.tier)==="pro"?"pro":"basic",p=c.useCallback(async(n,C)=>{await x(n,C),j(n),setTimeout(()=>j(N=>N===n?null:N),2e3)},[x]);return H?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.jsxs("div",{"data-testid":"settings-license-card",className:[a.card,(u==null?void 0:u.tier)==="pro"?a.licenseCardPro:""].filter(Boolean).join(" "),children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(_,{label:t("settings.license.title","License"),tooltip:t("settings.license.title.tooltip","Current license status and subscription tier.")}),e.jsx(g,{text:i?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} ${i?"":a.headerBadgeLive}`,children:i?t("settings.license.disconnected","Disconnected"):t("settings.general.liveApply","Live Apply")})})]}),e.jsxs(e.Fragment,{children:[u?e.jsxs(e.Fragment,{children:[(()=>{const n=w;return e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.licenseGrid,children:[e.jsx("dt",{children:e.jsx(_,{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} ${vs(u.status)}`}),e.jsx(g,{text:(n==null?void 0:n.tooltip)??t(`settings.license.${u.status}.tooltip`,"Current license activation state."),children:(n==null?void 0:n.label)??t(`settings.license.${u.status}`,u.status)})]}),e.jsx("dt",{children:e.jsx(_,{label:t("settings.license.tier","Tier"),tooltip:t("settings.license.tier.tooltip","Current subscription tier for available WEPPY Dashboard features.")})}),e.jsx("dd",{className:u.tier==="pro"?a.proBadge:"",children:e.jsx(g,{text:t(`tier.${u.tier}.tooltip`,"Available feature set for the connected license."),children:u.tier==="pro"?t("tier.pro","Pro"):t("tier.basic","Basic")})}),E&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(_,{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(g,{text:t("settings.license.keyValue.tooltip","Masked license key currently loaded by the server."),children:E})})]}),A&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(_,{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(g,{text:t("settings.license.providerValue.tooltip","License provider used to validate this key."),children:A})})]})]}),(n==null?void 0:n.detail)&&e.jsx("p",{className:`${a.licenseNotice} ${n.detailTone}`,children:u.refreshBlockedReason==="missing_session_token"?t("settings.license.detail.manualActivation","Manual activation required to restore Pro access."):n.detail}),u.refreshBlockedReason==="missing_session_token"&&e.jsx("p",{className:`${a.licenseNotice} ${a.licenseNoticeMuted}`,children:n==null?void 0:n.detail})]})})(),u.tier==="basic"&&e.jsx(g,{text:t("tier.upgrade.tooltip","View Pro features and purchase options."),children:e.jsx("a",{className:a.upgradeLink,href:ye.settingsLicense,target:"_blank",rel:"noopener noreferrer",onClick:()=>f("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(g,{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:i||v||!T,onClick:()=>{b()},children:v?t("common.loading"):t("settings.license.refresh","Refresh License")})}),e.jsx(g,{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:i||v||!T,onClick:()=>{B()},children:v?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(_,{label:t("settings.license.keyInput","License Key"),tooltip:t("settings.license.key.tooltip","Masked license key currently loaded by the server.")})}),e.jsx("input",{"aria-label":t("settings.license.keyInput","License Key"),className:a.textInput,type:"text",value:k,disabled:i||v,onChange:n=>S(n.target.value)})]}),e.jsx(g,{text:t("settings.license.activate.tooltip","Activate Pro features with the entered license key."),children:e.jsx("button",{type:"button",className:a.actionBtn,disabled:i||v,onClick:()=>{(async()=>await I(k)&&S(""))()},children:v?t("common.loading"):t("settings.license.activate","Activate License")})})]}),m&&e.jsx("p",{className:a.licenseMessage,children:m})]})]})]}),e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(_,{label:t("settings.general.title","General Settings"),tooltip:t("settings.general.title.tooltip","Hot settings that apply immediately when changed.")}),e.jsx(g,{text:t("settings.general.liveApply.tooltip","Changes in this section are applied immediately without a separate save button."),children:e.jsx("span",{className:`${a.headerBadge} ${a.headerBadgeLive}`,children:t("settings.general.liveApply","Live Apply")})})]}),o?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.logLevel","Log Level"),tooltip:t("settings.general.logLevel.tooltip","Sets how much detail WEPPY Dashboard writes to its logs.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("select",{className:a.select,value:o.hot.LOG_LEVEL,onChange:n=>p("LOG_LEVEL",n.target.value),children:ms.map(n=>e.jsx("option",{value:n,children:n},n))}),y==="LOG_LEVEL"&&e.jsx("span",{className:a.savedIndicator,children:t("settings.general.applied")})]})]}),e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.localHistory","Tool History Recording"),tooltip:t("settings.general.localHistory.tooltip","Stores local tool execution history for the WEPPY Dashboard history views.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("span",{className:`${a.savedIndicator} ${y==="ENABLE_LOCAL_HISTORY"?"":a.savedIndicatorHidden}`,children:t("settings.general.applied","Applied")}),e.jsx(ae,{checked:o.hot.ENABLE_LOCAL_HISTORY,ariaLabel:t("settings.general.localHistory","Tool History Recording"),testId:"settings-toggle-enable-local-history",onChange:n=>p("ENABLE_LOCAL_HISTORY",n)})]})]}),e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.localStatistics","Tool Statistics Collection"),tooltip:t("settings.general.localStatistics.tooltip","Aggregates local usage statistics for WEPPY Dashboard reporting.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("span",{className:`${a.savedIndicator} ${y==="ENABLE_LOCAL_STATISTICS"?"":a.savedIndicatorHidden}`,children:t("settings.general.applied","Applied")}),e.jsx(ae,{checked:o.hot.ENABLE_LOCAL_STATISTICS,ariaLabel:t("settings.general.localStatistics","Tool Statistics Collection"),testId:"settings-toggle-enable-local-statistics",onChange:n=>p("ENABLE_LOCAL_STATISTICS",n)})]})]}),e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.contextCapture","Context Capture"),tooltip:t("settings.general.contextCapture.tooltip","When enabled, WEPPY Dashboard records structured execution context for changelog and playtest views.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("span",{className:`${a.savedIndicator} ${y==="ENABLE_CONTEXT_CAPTURE"?"":a.savedIndicatorHidden}`,children:t("settings.general.applied","Applied")}),e.jsx(ae,{checked:o.hot.ENABLE_CONTEXT_CAPTURE,ariaLabel:t("settings.general.contextCapture","Context Capture"),testId:"settings-toggle-enable-context-capture",onChange:n=>p("ENABLE_CONTEXT_CAPTURE",n)})]})]}),e.jsxs("div",{className:a.settingRow,children:[e.jsx("span",{className:a.settingLabel,children:e.jsx(_,{label:t("settings.general.requestTimeout","Action Timeout"),tooltip:t("settings.general.requestTimeout.tooltip","Maximum time WEPPY Dashboard waits for an action before it fails.")})}),e.jsxs("div",{className:a.settingControl,children:[e.jsx("input",{type:"number",className:a.numberInput,value:o.hot.REQUEST_TIMEOUT,min:1e3,max:12e4,step:1e3,onChange:n=>{const C=parseInt(n.target.value,10);isNaN(C)||p("REQUEST_TIMEOUT",C)}}),e.jsx(g,{text:t("settings.general.requestTimeout.unit.tooltip","Action timeout is measured in milliseconds."),children:e.jsx("span",{className:a.unit,children:t("settings.general.requestTimeout.unit","ms")})}),y==="REQUEST_TIMEOUT"&&e.jsx("span",{className:a.savedIndicator,children:t("settings.general.applied","Applied")})]})]})]}):e.jsx("div",{className:a.loading,children:t("settings.unavailable")})]}),e.jsx(hs,{tier:d}),e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardHeader,children:[e.jsx(_,{label:t("settings.cold.title","Server Environment"),tooltip:t("settings.cold.title.tooltip","Read-only server environment values loaded at startup.")}),e.jsx(g,{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")})})]}),o?e.jsxs(e.Fragment,{children:[e.jsxs("dl",{className:a.coldGrid,children:[e.jsx("dt",{children:e.jsx(_,{label:"HTTP_PORT",tooltip:t("settings.cold.httpPort.tooltip","Port number used by the MCP WEPPY Dashboard HTTP server.")})}),e.jsx("dd",{children:o.cold.HTTP_PORT}),e.jsx("dt",{children:e.jsx(_,{label:"HTTP_HOST",tooltip:t("settings.cold.httpHost.tooltip","Host interface that the MCP WEPPY Dashboard HTTP server binds to.")})}),e.jsx("dd",{children:o.cold.HTTP_HOST}),e.jsx("dt",{children:e.jsx(_,{label:"DASHBOARD_AUTO_OPEN",tooltip:t("settings.cold.dashboardAutoOpen.tooltip","Controls whether WEPPY Dashboard opens automatically in the browser when the server starts.")})}),e.jsx("dd",{children:e.jsx(g,{text:t("settings.cold.dashboardAutoOpen.value.tooltip","Current startup behavior for opening WEPPY Dashboard in a browser."),children:String(o.cold.DASHBOARD_AUTO_OPEN)})})]}),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(_,{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(_,{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(g,{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:n=>r(n.target.value),children:[e.jsx("option",{value:me,children:t("settings.language.auto","Auto")}),ve.map(n=>e.jsx("option",{value:n,children:ys[n]??n},n))]})})]})]})]})}export{Ns as Component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as o,j as s}from"./index-
|
|
1
|
+
import{u as o,j as s}from"./index-VNIYQxwF.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,4 +1,4 @@
|
|
|
1
|
-
import{r as c,a as P,D as R,i as L,n as S,o as k,j as e,u as $,d as E,l as A,m as D,p as O,T as B}from"./index-
|
|
1
|
+
import{r as c,a as P,D as R,i as L,n as S,o as k,j as e,u as $,d as E,l as A,m as D,p as O,T as B}from"./index-VNIYQxwF.js";import{I as u}from"./InfoLabel-LyMkHb1i.js";import{T as b}from"./TooltipText-BPEldl3x.js";import{C as H}from"./ConfirmModal-C66ZwIur.js";import{S as M}from"./StatusBadge-CLJmMG0w.js";const F=5e3;function U(){const[t,i]=c.useState(null),[h,d]=c.useState([]),[p,o]=c.useState(!0),[y,w]=c.useState(null),m=c.useRef(null),g=c.useRef(null),l=c.useCallback(async()=>{var r;try{const[T,a]=await Promise.all([P.get("/sync/status"),P.get("/api/dashboard/place-summary")]);i(T);const x=(r=a.places)==null?void 0:r.find(I=>I.isActive);w((x==null?void 0:x.placeDirName)??null)}catch{}},[]),f=c.useCallback(async()=>{try{const r=await P.get("/sync/history",{limit:"30"});d(r.entries??[])}catch{d([])}},[]),j=c.useCallback(async()=>{await Promise.all([l(),f()]),o(!1)},[l,f]),n=c.useCallback(()=>{j()},[j]),N=c.useCallback(async()=>{await P.post("/api/dashboard/sync/history/clear"),d([]),l()},[l]);return c.useEffect(()=>(j(),g.current=setInterval(j,F),()=>{g.current&&clearInterval(g.current)}),[j]),c.useEffect(()=>{const r=new R;m.current=r,r.connect();const T=r.on("sync",()=>{l(),f()});return()=>{T(),r.disconnect(),m.current=null}},[l,f]),{status:t,history:h,loading:p,activePlaceDirName:y,refresh:n,clearHistory:N}}const W="_actions_1j3p3_60",q="_btn_1j3p3_68",G="_btnPrimary_1j3p3_99",z="_panel_1j3p3_109",V="_panelIcon_1j3p3_116",Y="_panelTitle_1j3p3_122",J="_panelDesc_1j3p3_131",Q="_benefitList_1j3p3_139",X="_benefitItem_1j3p3_148",_={actions:W,btn:q,btnPrimary:G,panel:z,panelIcon:V,panelTitle:Y,panelDesc:J,benefitList:Q,benefitItem:X};function Z({icon:t,title:i,description:h,benefits:d,upgradeLabel:p,upgradeHref:o}){const{trackEvent:y}=L(),{pathname:w,search:m}=S(),g=k(w,m);return e.jsxs("div",{className:_.panel,children:[t&&e.jsx("div",{className:_.panelIcon,children:t}),e.jsx("div",{className:_.panelTitle,children:i}),e.jsx("div",{className:_.panelDesc,children:h}),e.jsx("ul",{className:_.benefitList,children:d.map(l=>e.jsx("li",{className:_.benefitItem,children:l},l))}),e.jsx("div",{className:_.actions,children:e.jsx("a",{className:`${_.btn} ${_.btnPrimary}`,href:o,target:"_blank",rel:"noreferrer",onClick:()=>y("dashboard_click_event",{click_target:"upgrade_cta",placement:"tier_panel",...g}),children:p})})]})}const K="_page_siyu4_2",ee="_card_siyu4_10",te="_cardHeader_siyu4_17",se="_clearButton_siyu4_29",ne="_statusRow_siyu4_39",ie="_metaItem_siyu4_46",ae="_statusGrid_siyu4_52",ce="_table_siyu4_71",oe="_directionRail_siyu4_99",le="_endpointLabel_siyu4_105",re="_optionRail_siyu4_109",de="_directionOption_siyu4_115",pe="_directionOptionActive_siyu4_129",ye="_directionOptionInactive_siyu4_133",ue="_direction_forward_siyu4_139",_e="_direction_bidirectional_siyu4_143",he="_direction_reverse_siyu4_147",me="_lockBadge_siyu4_152",ge="_proBadge_siyu4_160",fe="_forwardBadge_siyu4_174",xe="_logContainer_siyu4_187",be="_logEntry_siyu4_194",je="_logTime_siyu4_206",ve="_logType_siyu4_212",we="_logTypeWrite_siyu4_221",Te="_logTypeUpdate_siyu4_225",Ne="_logTypeDelete_siyu4_229",Ie="_logTypeIdle_siyu4_233",Pe="_logPath_siyu4_237",Ce="_logEmpty_siyu4_244",Le="_overlay_siyu4_251",Re="_overlayTitle_siyu4_261",Se="_overlayMessage_siyu4_268",ke="_checklist_siyu4_274",$e="_checkItem_siyu4_284",Ee="_upgradePanel_siyu4_300",Ae="_upgradePanelHeader_siyu4_307",De="_benefitList_siyu4_315",Oe="_benefitItem_siyu4_324",Be="_upgradeActions_siyu4_339",He="_btn_siyu4_344",Me="_btnPrimary_siyu4_361",Fe="_disabled_siyu4_372",s={page:K,card:ee,cardHeader:te,clearButton:se,statusRow:ne,metaItem:ie,statusGrid:ae,table:ce,directionRail:oe,endpointLabel:le,optionRail:re,directionOption:de,directionOptionActive:pe,directionOptionInactive:ye,direction_forward:ue,direction_bidirectional:_e,direction_reverse:he,lockBadge:me,proBadge:ge,forwardBadge:fe,logContainer:xe,logEntry:be,logTime:je,logType:ve,logTypeWrite:we,logTypeUpdate:Te,logTypeDelete:Ne,logTypeIdle:Ie,logPath:Pe,logEmpty:Ce,overlay:Le,overlayTitle:Re,overlayMessage:Se,checklist:ke,checkItem:$e,upgradePanel:Ee,upgradePanelHeader:Ae,benefitList:De,benefitItem:Oe,upgradeActions:Be,btn:He,btnPrimary:Me,disabled:Fe},Ue=[{key:"forward",symbol:"←"},{key:"bidirectional",symbol:"↔"},{key:"reverse",symbol:"→"}];function We(t){const i=new Date(t);return`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`}function qe(t){switch(t){case"write":return s.logTypeWrite;case"update":return s.logTypeUpdate;case"delete":return s.logTypeDelete;default:return s.logTypeIdle}}function Ge(t){switch(t){case"syncing":return"syncing";case"initializing":return"initializing";case"idle":return"idle";default:return"offline"}}function ze(t,i,h,d){const p=t(`sync.directions.cat.${i}`,i.charAt(0).toUpperCase()+i.slice(1)),o=t("sync.directions.endpoint.local","Local"),y=t("sync.directions.endpoint.studio","Studio");switch(h){case"forward":return[`${p}: ${o} <- ${y}`,t("sync.directions.tooltip.forward.body","Studio changes sync to local files only")].join(`
|
|
2
2
|
`);case"bidirectional":return[`${p}: ${o} <-> ${y}`,t("sync.directions.tooltip.bidirectional.body","Two-way sync between Local and Studio"),d?t("sync.directions.tooltip.proRequired","Pro required in Basic tier"):""].filter(Boolean).join(`
|
|
3
3
|
`);case"reverse":return[`${p}: ${o} -> ${y}`,t("sync.directions.tooltip.reverse.body","Push local file changes to Studio"),d?t("sync.directions.tooltip.proRequired","Pro required in Basic tier"):""].filter(Boolean).join(`
|
|
4
4
|
`);default:return p}}const Ve=["scripts","values","containers","data","services"];function Ye(t,i){return i==="manual"?t("sync.directions.mode.manual","Manual"):i==="auto"?t("sync.directions.mode.auto","Auto"):"-"}function Je(t,i){return i==="manual"?t("sync.directions.mode.manual.tooltip","Applies sync changes only when you trigger them manually."):i==="auto"?t("sync.directions.mode.auto.tooltip","Applies sync changes automatically when updates arrive."):""}function Qe(t,i){switch(i){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 Xe(t,i){switch(i){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 nt(){const{t}=$(),{trackEvent:i}=L(),{level:h}=E(),{tier:d,loading:p}=A(),o=U(),{show:y}=D(),[w,m]=c.useState(!1),[g,l]=c.useState(!1),f=!p&&d==="basic";if(h==="disconnected"||h==="serverOnly")return e.jsx("div",{className:s.page,children:e.jsx("div",{className:s.card,children:e.jsxs("div",{className:s.overlay,children:[e.jsx("div",{className:s.overlayTitle,children:t("sync.overlay.title","Roblox Studio plugin required")}),e.jsx("div",{className:s.overlayMessage,children:t("sync.overlay.message","Sync status will be available once the Roblox Studio plugin connects.")}),e.jsxs("ul",{className:s.checklist,children:[e.jsx("li",{className:s.checkItem,children:t("sync.overlay.check1","Is Roblox Studio running?")}),e.jsx("li",{className:s.checkItem,children:t("sync.overlay.check2","Is the WEPPY Plugin installed?")})]})]})})});const n=o.status,N=o.history,r=Ge(n==null?void 0:n.state),T=async()=>{l(!0);try{await o.clearHistory(),y(t("toast.clearSuccess","Cleared successfully"),"success"),m(!1)}catch{y(t("toast.clearFailed","Failed to clear data"),"error")}finally{l(!1)}};return e.jsxs("div",{className:s.page,children:[e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsx(b,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),f&&e.jsx(b,{text:t("sync.status.forwardOnly.tooltip","Basic tier allows Studio to local forward sync only."),children:e.jsx("span",{className:s.forwardBadge,children:t("sync.status.forwardOnly","Forward Only")})})]}),e.jsxs("div",{className:s.statusRow,children:[e.jsx(M,{status:r}),(n==null?void 0:n.placeName)&&e.jsxs("span",{className:s.metaItem,children:[e.jsx(u,{label:t("sync.status.place","Place"),tooltip:t("sync.status.place.tooltip","Connected Roblox place name and place ID.")}),": ",n.placeName,n.placeId?` (${n.placeId})`:""]})]}),e.jsxs("dl",{className:s.statusGrid,children:[(n==null?void 0:n.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(u,{label:t("sync.status.path","Path"),tooltip:t("sync.status.path.tooltip","Local filesystem root currently used for sync output.")})}),e.jsx("dd",{children:n.syncRoot})]}),o.activePlaceDirName&&(n==null?void 0:n.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(u,{label:t("sync.status.placePath","Place Path"),tooltip:t("sync.status.placePath.tooltip","Active place directory where explorer files are synced.")})}),e.jsx("dd",{children:`${n.syncRoot}/${o.activePlaceDirName}/explorer`})]}),(n==null?void 0:n.instanceCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(u,{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:n.instanceCount})]}),(n==null?void 0:n.scriptCount)!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(u,{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:n.scriptCount})]}),(n==null?void 0:n.state)==="syncing"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(u,{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")})]})]})]}),(n==null?void 0:n.directions)&&e.jsxs("div",{className:s.card,children:[e.jsx("div",{className:s.cardHeader,children:e.jsx(b,{text:t("sync.directions.title.tooltip","Per-category sync direction and apply behavior between Local and Studio."),children:t("sync.directions.title","Sync Directions")})}),e.jsxs("table",{className:s.table,children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:e.jsx(u,{label:t("sync.directions.type","Type"),tooltip:t("sync.directions.type.tooltip","Sync category affected by this rule.")})}),e.jsx("th",{children:e.jsx(u,{label:t("sync.directions.direction","Direction"),tooltip:t("sync.directions.direction.tooltip","Whether each category syncs from Studio, to Studio, or both ways.")})}),e.jsx("th",{children:e.jsx(u,{label:t("sync.directions.applyMode","Apply Mode"),tooltip:t("sync.directions.applyMode.tooltip","How incoming sync changes are applied for this category.")})})]})}),e.jsx("tbody",{children:Ve.map(a=>{var C;const x=n.directions[a],I=(C=n.applyModes)==null?void 0:C[a];return e.jsxs("tr",{children:[e.jsx("td",{children:t(`sync.directions.cat.${a}`,a.charAt(0).toUpperCase()+a.slice(1))}),e.jsx("td",{children:e.jsxs("div",{className:s.directionRail,"aria-label":`${a}-direction-rail`,children:[e.jsx(b,{text:t("sync.directions.endpoint.local.tooltip","Local files on disk are always shown on the left side of the direction rail."),children:e.jsx("span",{className:s.endpointLabel,children:t("sync.directions.endpoint.local","Local")})}),e.jsx("span",{className:s.optionRail,children:Ue.map(v=>e.jsx(O,{text:ze(t,a,v.key,f),children:e.jsx("span",{className:`${s.directionOption} ${x===v.key?s.directionOptionActive:s.directionOptionInactive} ${s[`direction_${v.key}`]??""}`,"data-active":x===v.key?"true":"false",children:v.symbol})},v.key))}),e.jsx(b,{text:t("sync.directions.endpoint.studio.tooltip","Roblox Studio is always shown on the right side of the direction rail."),children:e.jsx("span",{className:s.endpointLabel,children:t("sync.directions.endpoint.studio","Studio")})})]})}),e.jsx("td",{children:e.jsx(b,{text:Je(t,I),children:Ye(t,I)})})]},a)})})]})]}),e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsx("span",{children:t("sync.log.title","Sync Log")}),e.jsx("button",{className:s.clearButton,onClick:()=>{i("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),m(!0)},children:t("common.clear","Clear")})]}),e.jsx("div",{className:s.logContainer,children:N.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.empty","No sync events yet")}):N.map((a,x)=>e.jsxs("div",{className:s.logEntry,children:[e.jsx("span",{className:s.logTime,children:We(a.timestamp)}),e.jsx(b,{text:Xe(t,a.type),children:e.jsx("span",{className:`${s.logType} ${qe(a.type)}`,children:Qe(t,a.type)})}),e.jsxs("span",{className:s.logPath,children:[a.path,a.details?` — ${a.details}`:""]})]},x))})]}),f&&e.jsx(Z,{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:B.sync}),e.jsx(H,{open:w,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:g,onCancel:()=>!g&&m(!1),onConfirm:T})]})}export{nt as Component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./index-
|
|
1
|
+
import{j as s}from"./index-VNIYQxwF.js";const r="_tabBar_1o4kh_2",_="_tabs_1o4kh_9",d="_actions_1o4kh_14",k="_tab_1o4kh_2",h="_tabActive_1o4kh_39",a={tabBar:r,tabs:_,actions:d,tab:k,tabActive:h};function v({items:n,value:c,onChange:l,ariaLabel:b,className:i,rightActions:e}){return s.jsxs("div",{className:[a.tabBar,i].filter(Boolean).join(" "),role:"tablist","aria-label":b,children:[s.jsx("div",{className:a.tabs,children:n.map(t=>{const o=t.key===c;return s.jsx("button",{type:"button",role:"tab","aria-selected":o,"data-testid":t.testId,className:[a.tab,o?a.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(t.key),children:t.label},t.key)})}),e?s.jsx("div",{className:a.actions,children:e}):null]})}export{v as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as n,a as D,D as ot,u as lt,i as rt,m as it}from"./index-BIVkyPD7.js";import{T as M}from"./TooltipText-59Xfc1Ui.js";import{C as nt}from"./ConfirmModal-lSOkaAvB.js";import{T as ct}from"./Tabs-B4kZyHzy.js";const dt="_wrapper_hzgda_2",ut="_table_hzgda_7",pt="_sortable_hzgda_32",xt="_sortArrow_hzgda_41",ht="_clickable_hzgda_52",mt="_empty_hzgda_57",bt="_expandedRow_hzgda_65",_t="_expandedCell_hzgda_74",T={wrapper:dt,table:ut,sortable:pt,sortArrow:xt,clickable:ht,empty:mt,expandedRow:bt,expandedCell:_t};function ft({columns:s,data:l,sortBy:_,sortDir:r="asc",onSort:v,onRowClick:y,rowKey:B,emptyMessage:E,expandedKey:L,renderExpandedRow:w}){return e.jsx("div",{className:T.wrapper,children:e.jsxs("table",{className:T.table,children:[e.jsx("thead",{children:e.jsx("tr",{children:s.map(u=>e.jsxs("th",{style:u.width?{width:u.width}:void 0,className:u.sortable?T.sortable:void 0,onClick:u.sortable&&v?()=>v(u.key):void 0,children:[e.jsx("span",{children:u.label}),u.sortable&&_===u.key&&e.jsx("span",{className:T.sortArrow,children:r==="asc"?"▴":"▾"})]},u.key))})}),e.jsx("tbody",{children:l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length,className:T.empty,children:E||"No data"})}):l.map((u,f)=>{const x=B?B(u):String(f),h=L!=null&&x===L&&w?w(u):null;return e.jsxs(n.Fragment,{children:[e.jsx("tr",{className:y?T.clickable:void 0,onClick:y?()=>y(u):void 0,children:s.map(g=>e.jsx("td",{children:g.render?g.render(u):String(u[g.key]??"")},g.key))}),h&&e.jsx("tr",{className:T.expandedRow,children:e.jsx("td",{colSpan:s.length,className:T.expandedCell,children:h})})]},x)})})]})})}function gt(s){return{...s,sequenceNumber:typeof s.sequenceNumber=="number"?s.sequenceNumber:void 0,executionTimeMs:typeof s.executionTimeMs=="number"?s.executionTimeMs:void 0}}const Ct=50;function yt(){const[s,l]=n.useState(null),[_,r]=n.useState(!0),[v,y]=n.useState([]),[B,E]=n.useState(0),[L,w]=n.useState(!1),[u,f]=n.useState(!0),[x,P]=n.useState(0),[h,g]=n.useState(""),H=n.useRef(null),m=n.useCallback(async()=>{r(!0);try{const d=await D.get("/api/dashboard/tool-stats");l(d)}catch{}finally{r(!1)}},[]),C=n.useCallback(async(d,N)=>{f(!0);try{const O={limit:String(Ct),offset:String(d)};N&&(O.tool=N);const A=await D.get("/api/dashboard/history",O);y(A.entries.map(gt)),E(A.total),w(A.hasMore)}catch{y([]),E(0),w(!1)}finally{f(!1)}},[]),q=n.useCallback(()=>{m(),C(x,h)},[C,m,x,h]),z=n.useCallback(async()=>{await D.post("/api/dashboard/tools/history/clear"),C(x,h)},[C,x,h]),F=n.useCallback(async()=>{await D.post("/api/dashboard/tools/statistics/clear"),m()},[m]);return n.useEffect(()=>{m()},[m]),n.useEffect(()=>{C(x,h)},[C,x,h]),n.useEffect(()=>{const d=new ot;H.current=d,d.connect();const N=d.on("command",()=>{m(),C(x,h)});return()=>{N(),d.disconnect(),H.current=null}},[C,m,x,h]),{statistics:s,statsLoading:_,history:v,historyTotal:B,historyHasMore:L,historyLoading:u,historyOffset:x,historyToolFilter:h,setHistoryOffset:P,setHistoryToolFilter:g,refresh:q,clearHistory:z,clearStatistics:F}}const jt="_page_16x6v_2",vt="_card_16x6v_12",kt="_cardToolbar_16x6v_19",Tt="_sectionTitle_16x6v_27",wt="_dangerButton_16x6v_33",Nt="_proBadge_16x6v_52",St="_statusOk_16x6v_67",Mt="_statusFallback_16x6v_76",Bt="_statusUnsupported_16x6v_85",Et="_statusWarning_16x6v_94",Lt="_statusError_16x6v_103",At="_tierBasic_16x6v_113",Rt="_tierPro_16x6v_117",Pt="_tierMixed_16x6v_122",Ht="_filterRow_16x6v_133",Ft="_filterLabel_16x6v_140",Ot="_filterSelect_16x6v_149",It="_expandedRow_16x6v_160",$t="_expandedSection_16x6v_165",Dt="_detailList_16x6v_175",Wt="_detailItem_16x6v_181",qt="_detailLabel_16x6v_187",zt="_detailValue_16x6v_192",Ut="_pre_16x6v_197",Vt="_pagination_16x6v_214",Kt="_pageInfo_16x6v_222",Gt="_btn_16x6v_228",Jt="_tierDistribution_16x6v_251",Zt="_tierBarWrap_16x6v_255",Qt="_tierBarBasic_16x6v_263",Xt="_tierBarPro_16x6v_268",Yt="_tierLabels_16x6v_273",ts="_statsTableWrap_16x6v_282",ss="_statsTable_16x6v_282",es="_sortableHeader_16x6v_313",as="_sortArrow_16x6v_318",os="_statsToolRow_16x6v_322",ls="_statsActionRow_16x6v_330",rs="_expandButton_16x6v_334",is="_expandIcon_16x6v_346",ns="_actionLabel_16x6v_351",cs="_emptyStats_16x6v_358",ds="_summaryLine_16x6v_364",a={page:jt,card:vt,cardToolbar:kt,sectionTitle:Tt,dangerButton:wt,proBadge:Nt,statusOk:St,statusFallback:Mt,statusUnsupported:Bt,statusWarning:Et,statusError:Lt,tierBasic:At,tierPro:Rt,tierMixed:Pt,filterRow:Ht,filterLabel:Ft,filterSelect:Ot,expandedRow:It,expandedSection:$t,detailList:Dt,detailItem:Wt,detailLabel:qt,detailValue:zt,pre:Ut,pagination:Vt,pageInfo:Kt,btn:Gt,tierDistribution:Jt,tierBarWrap:Zt,tierBarBasic:Qt,tierBarPro:Xt,tierLabels:Yt,statsTableWrap:ts,statsTable:ss,sortableHeader:es,sortArrow:as,statsToolRow:os,statsActionRow:ls,expandButton:rs,expandIcon:is,actionLabel:ns,emptyStats:cs,summaryLine:ds},U=50;function us(s){const l=new Date(s);return`${String(l.getHours()).padStart(2,"0")}:${String(l.getMinutes()).padStart(2,"0")}:${String(l.getSeconds()).padStart(2,"0")}`}function W(s){return typeof s!="number"||!Number.isFinite(s)?"-":s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`}function R(s,l){return l==="pro"?s("tier.pro","Pro"):l==="mixed"?s("tier.mixed","Mixed"):s("tier.basic","Basic")}function Z(s,l){return l!==s&&l.startsWith(`${s}_`)?l.slice(s.length+1):""}function ps(s,l){const _=Z(s,l);return _?`${s}.${_}`:s}function J(s){return typeof s=="string"&&s.length>0?s:void 0}function xs(s){if(!Array.isArray(s))return;const l=s.filter(_=>typeof _=="string"&&_.length>0);return l.length>0?l:void 0}function hs(s){const l=s.result??{};return{requestedCommand:s.requestedCommand??J(l.requestedCommand),executedCommand:s.executedCommand??J(l.executedCommand),alternatives:s.alternatives??xs(l.alternatives)}}function ms(s,l){switch(s.status){case"fallback":return{label:l("tools.badge.fallback","FALLBACK"),tooltip:l("tools.badge.fallback.tooltip","The requested Pro action succeeded via a Basic fallback."),className:a.statusFallback};case"unsupported":return{label:l("tools.badge.unsupported","UNSUPPORTED"),tooltip:l("tools.badge.unsupported.tooltip","The requested Pro action was blocked and no fallback ran."),className:a.statusUnsupported};case"warning":return{label:l("tools.badge.warn","WARN"),tooltip:l("tools.badge.warn.tooltip","The tool call failed as an expected caller, project, policy, or user-code issue."),className:a.statusWarning};case"error":return{label:l("tools.badge.err","FAILED"),tooltip:l("tools.badge.err.tooltip","The tool run failed."),className:a.statusError};default:return{label:l("tools.status.ok","OK"),tooltip:l("tools.status.ok.tooltip","The tool run completed successfully."),className:a.statusOk}}}function j(s,l){return e.jsxs("div",{className:a.detailItem,children:[e.jsx("span",{className:a.detailLabel,children:s}),e.jsx("span",{className:a.detailValue,children:l})]})}function ys(){const{t:s}=lt(),{trackEvent:l,trackPageView:_}=rt(),r=yt(),{show:v}=it(),[y,B]=n.useState("history"),[E,L]=n.useState(null),[w,u]=n.useState(null),[f,x]=n.useState(null),[P,h]=n.useState(!1),[g,H]=n.useState("totalCalls"),[m,C]=n.useState("desc"),q=n.useCallback(t=>{H(o=>o===t?(C(i=>i==="asc"?"desc":"asc"),t):(C("desc"),t))},[]),z=n.useMemo(()=>{var o;const t=new Set;return Object.keys(((o=r.statistics)==null?void 0:o.tools)??{}).forEach(i=>t.add(i)),r.history.forEach(i=>{i.tool&&t.add(i.tool)}),r.historyToolFilter&&t.add(r.historyToolFilter),Array.from(t).sort()},[r.history,r.historyToolFilter,r.statistics]),F=n.useMemo(()=>{var t;return(t=r.statistics)!=null&&t.tools?Object.values(r.statistics.tools).map(o=>{var G;const i=Object.entries(o.commands??{}).map(([p,c])=>({toolName:o.tool,commandName:c.command??p,label:Z(o.tool,c.command??p)||(c.command??p),tier:c.tier,totalCalls:c.totalCalls,successCount:c.successCount,fallbackCount:c.fallbackCount,unsupportedCount:c.unsupportedCount,warningCount:c.warningCount??0,failureCount:c.failureCount,totalExecutionTimeMs:c.totalExecutionTimeMs,avgExecutionTimeMs:c.avgExecutionTimeMs})),b=i.reduce((p,c)=>p+c.totalCalls,0),k=i.reduce((p,c)=>p+c.successCount,0),I=i.reduce((p,c)=>p+c.fallbackCount,0),$=i.reduce((p,c)=>p+c.unsupportedCount,0),st=i.reduce((p,c)=>p+c.warningCount,0),et=i.reduce((p,c)=>p+c.failureCount,0),K=i.reduce((p,c)=>p+c.totalExecutionTimeMs,0),at=new Set(i.map(p=>p.tier)).size>1?"mixed":((G=i[0])==null?void 0:G.tier)??o.tier;return{toolName:o.tool,tier:at,commands:i,totalCalls:b,successCount:k,fallbackCount:I,unsupportedCount:$,warningCount:st,failureCount:et,totalExecutionTimeMs:K,avgExecutionTimeMs:b>0?Math.round(K/b):0}}):[]},[r.statistics]),d=n.useCallback((t,o,i,b)=>e.jsx(M,{text:s(i,b),children:s(t,o)}),[s]),N=n.useMemo(()=>[...F].sort((o,i)=>{const b=o[g],k=i[g];if(typeof b=="number"&&typeof k=="number")return m==="asc"?b-k:k-b;const I=String(b??""),$=String(k??"");return m==="asc"?I.localeCompare($):$.localeCompare(I)}),[F,g,m]),O=n.useMemo(()=>[{key:"timestamp",label:d("tools.col.time","Time","tools.col.time.tooltip","When the tool run was recorded."),width:"80px",render:t=>us(t.timestamp)},{key:"toolName",label:d("tools.col.toolAction","Tool.Action","tools.col.toolAction.tooltip","Tool name and action that were executed."),render:t=>e.jsxs("span",{children:[ps(t.tool,t.command),t.tier==="pro"&&e.jsx(M,{text:s("tools.badge.pro.tooltip","This entry used a Pro-only tool or action."),children:e.jsx("span",{className:a.proBadge,children:s("tools.badge.pro","PRO")})})]})},{key:"executionTimeMs",label:d("tools.col.duration","Duration","tools.col.duration.tooltip","How long the tool took to finish."),width:"80px",render:t=>W(t.executionTimeMs)},{key:"status",label:d("tools.col.status","Status","tools.col.status.tooltip","Outcome of the recorded tool run."),width:"120px",render:t=>{const o=ms(t,s);return e.jsx(M,{text:o.tooltip,children:e.jsx("span",{className:o.className,children:o.label})})}},{key:"tier",label:d("tools.col.tier","Tier","tools.col.tier.tooltip","License tier required for the tool or action."),width:"60px",render:t=>e.jsx("span",{className:t.tier==="pro"?a.tierPro:a.tierBasic,children:R(s,t.tier)})}],[s,d]),A=n.useMemo(()=>[{key:"toolName",label:d("tools.col.tool","Tool","tools.col.tool.tooltip","Consolidated tool name in the statistics table."),sortable:!0},{key:"totalCalls",label:d("tools.col.calls","Calls","tools.col.calls.tooltip","Total number of recorded calls for this tool."),sortable:!0,width:"70px"},{key:"successCount",label:d("tools.col.ok","OK","tools.col.ok.tooltip","Number of direct successful runs."),sortable:!0,width:"70px"},{key:"fallbackCount",label:d("tools.col.fallback","FALLBACK","tools.col.fallback.tooltip","Number of runs that succeeded through fallback execution."),sortable:!0,width:"110px"},{key:"unsupportedCount",label:d("tools.col.unsupported","UNSUPPORTED","tools.col.unsupported.tooltip","Number of blocked runs without fallback execution."),sortable:!0,width:"130px"},{key:"warningCount",label:d("tools.col.warn","WARN","tools.col.warn.tooltip","Number of expected failures caused by caller input, project state, Roblox policy, or user code."),sortable:!0,width:"80px"},{key:"failureCount",label:d("tools.col.err","FAILED","tools.col.err.tooltip","Number of runs that failed."),sortable:!0,width:"70px"},{key:"avgExecutionTimeMs",label:d("tools.col.avgTime","Avg Time","tools.col.avgTime.tooltip","Average execution time across recorded calls."),sortable:!0,width:"90px",render:t=>W(t.avgExecutionTimeMs)},{key:"tier",label:d("tools.col.tier","Tier","tools.col.tierStats.tooltip","Basic, Pro, or Mixed summary for the tool statistics row."),sortable:!0,width:"70px",render:t=>e.jsx(M,{text:t.tier==="mixed"?s("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:t.tier==="pro"?a.tierPro:t.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(s,t.tier)})})}],[s,d]),S=n.useMemo(()=>{if(!r.statistics)return null;const t=r.statistics.tierSummary.basic.totalCalls,o=r.statistics.tierSummary.pro.totalCalls,i=t+o;if(i===0)return null;const b=Math.round(t/i*100),k=100-b;return{basic:t,pro:o,basicPct:b,proPct:k}},[r.statistics]),V=n.useCallback(t=>{u(o=>o===t?null:t)},[]),Q=n.useCallback(async()=>{if(f){h(!0);try{f==="history"?await r.clearHistory():await r.clearStatistics(),v(s("toast.clearSuccess","Cleared successfully"),"success"),x(null)}catch{v(s("toast.clearFailed","Failed to clear data"),"error")}finally{h(!1)}}},[f,v,s,r]),X=n.useCallback(t=>{const o=t==="history"?"tools_history":"tools_statistics";l("dashboard_click_event",{click_target:t==="history"?"tools_tab_history":"tools_tab_statistics",page:"tools",tab:o}),_({page:"tools",tab:o}),B(t)},[l,_]),Y=n.useCallback(t=>{const o=hs(t);return e.jsxs("div",{className:a.expandedRow,children:[e.jsxs("div",{className:a.expandedSection,children:[e.jsxs("strong",{children:[e.jsx(M,{text:s("tools.detail.params.tooltip","Input parameters passed to this tool run."),children:s("tools.detail.params","Parameters")}),":"]}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.parameters,null,2)})]}),t.result&&e.jsxs("div",{className:a.expandedSection,children:[e.jsxs("strong",{children:[e.jsx(M,{text:s("tools.detail.result.tooltip","Returned result payload for this tool run."),children:s("tools.detail.result","Result")}),":"]}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.result,null,2)})]}),(t.status==="fallback"||t.status==="unsupported"||t.status==="warning"||t.status==="error")&&e.jsx("div",{className:a.expandedSection,children:e.jsxs("div",{className:a.detailList,children:[t.status==="fallback"&&(o==null?void 0:o.requestedCommand)&&j(s("tools.detail.requestedCommand","Requested Command"),o.requestedCommand),t.status==="fallback"&&(o==null?void 0:o.executedCommand)&&j(s("tools.detail.executedCommand","Executed Command"),o.executedCommand),t.status==="fallback"&&(o==null?void 0:o.alternatives)&&j(s("tools.detail.alternatives","Alternatives"),o.alternatives.join(", ")),t.status==="unsupported"&&t.blockedMessage&&j(s("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage),t.status==="unsupported"&&j(s("tools.detail.noFallback","No Fallback"),s("tools.detail.noFallback.value","No fallback ran.")),t.status==="warning"&&t.warningMessage&&j(s("tools.detail.warningMessage","Warning Message"),t.warningMessage),t.status==="error"&&t.errorMessage&&j(s("tools.detail.errorMessage","Error Message"),t.errorMessage),t.status==="error"&&t.blockedMessage&&j(s("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage),t.status==="error"&&t.fallbackCommand&&j(s("tools.detail.executedCommand","Executed Command"),t.fallbackCommand)]})})]})},[s]),tt=["history","statistics"].map(t=>({key:t,label:s(`tools.tab.${t}`,t.charAt(0).toUpperCase()+t.slice(1))}));return e.jsxs("div",{className:a.page,children:[e.jsx(ct,{items:tt,value:y,onChange:X}),y==="history"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:s("tools.tab.history","History")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{l("dashboard_click_event",{click_target:"tools_clear_history",page:"tools",tab:"tools_history"}),x("history")},children:s("common.clear","Clear")})]}),e.jsx("div",{className:a.filterRow,children:e.jsxs("label",{className:a.filterLabel,children:[s("tools.filter.tool","Tool"),":",e.jsxs("select",{className:a.filterSelect,value:r.historyToolFilter,onChange:t=>{r.setHistoryToolFilter(t.target.value),r.setHistoryOffset(0)},children:[e.jsx("option",{value:"",children:s("tools.filter.all","All")}),z.map(t=>e.jsx("option",{value:t,children:t},t))]})]})}),e.jsx(ft,{columns:O,data:r.history,rowKey:t=>t.id,onRowClick:t=>L(o=>o===t.id?null:t.id),emptyMessage:s("tools.empty.history","No history entries"),expandedKey:E,renderExpandedRow:Y}),e.jsxs("div",{className:a.pagination,children:[e.jsx("button",{className:a.btn,disabled:r.historyOffset===0,title:s("tools.page.prev.tooltip","Go to the previous page of tool history results."),onClick:()=>r.setHistoryOffset(Math.max(0,r.historyOffset-U)),children:s("tools.page.prev","Prev")}),e.jsxs("span",{className:a.pageInfo,children:[r.historyOffset+1,"–",Math.min(r.historyOffset+U,r.historyTotal)," / ",r.historyTotal]}),e.jsx("button",{className:a.btn,disabled:!r.historyHasMore,title:s("tools.page.next.tooltip","Go to the next page of tool history results."),onClick:()=>r.setHistoryOffset(r.historyOffset+U),children:s("tools.page.next","Next")})]})]}),y==="statistics"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:s("tools.tab.statistics","Statistics")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{l("dashboard_click_event",{click_target:"tools_clear_statistics",page:"tools",tab:"tools_statistics"}),x("statistics")},children:s("common.clear","Clear")})]}),S&&e.jsxs("div",{className:a.tierDistribution,children:[e.jsxs("div",{className:a.tierBarWrap,children:[e.jsx("div",{className:a.tierBarBasic,style:{width:`${S.basicPct}%`}}),e.jsx("div",{className:a.tierBarPro,style:{width:`${S.proPct}%`}})]}),e.jsxs("div",{className:a.tierLabels,children:[e.jsxs("span",{children:[R(s,"basic")," ",S.basicPct,"% (",S.basic,")"]}),e.jsxs("span",{children:[R(s,"pro")," ",S.proPct,"% (",S.pro,")"]})]})]}),e.jsx("div",{className:a.statsTableWrap,children:e.jsxs("table",{className:a.statsTable,children:[e.jsx("thead",{children:e.jsx("tr",{children:A.map(t=>e.jsxs("th",{style:t.width?{width:t.width}:void 0,className:t.sortable?a.sortableHeader:void 0,onClick:t.sortable?()=>q(t.key):void 0,children:[e.jsx("span",{children:t.label}),t.sortable&&g===t.key&&e.jsx("span",{className:a.sortArrow,children:m==="asc"?"▴":"▾"})]},t.key))})}),e.jsx("tbody",{children:N.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:A.length,className:a.emptyStats,children:s("tools.empty.stats","No tool statistics")})}):N.map(t=>{const o=w===t.toolName;return e.jsxs(n.Fragment,{children:[e.jsxs("tr",{className:a.statsToolRow,onClick:()=>V(t.toolName),children:[e.jsx("td",{children:e.jsxs("button",{type:"button",className:a.expandButton,"aria-expanded":o,"aria-label":`${t.toolName} ${o?s("common.collapse","Collapse"):s("common.expand","Expand")}`,onClick:i=>{i.stopPropagation(),V(t.toolName)},children:[e.jsx("span",{className:a.expandIcon,"aria-hidden":"true",children:o?"▾":"▸"}),e.jsx("span",{children:t.toolName})]})}),e.jsx("td",{children:t.totalCalls}),e.jsx("td",{children:t.successCount}),e.jsx("td",{children:t.fallbackCount}),e.jsx("td",{children:t.unsupportedCount}),e.jsx("td",{children:t.warningCount}),e.jsx("td",{children:t.failureCount}),e.jsx("td",{children:W(t.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx(M,{text:t.tier==="mixed"?s("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:t.tier==="pro"?a.tierPro:t.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(s,t.tier)})})})]}),o&&t.commands.map(i=>e.jsxs("tr",{className:a.statsActionRow,children:[e.jsx("td",{children:e.jsx("span",{className:a.actionLabel,children:i.label})}),e.jsx("td",{children:i.totalCalls}),e.jsx("td",{children:i.successCount}),e.jsx("td",{children:i.fallbackCount}),e.jsx("td",{children:i.unsupportedCount}),e.jsx("td",{children:i.warningCount}),e.jsx("td",{children:i.failureCount}),e.jsx("td",{children:W(i.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx("span",{className:i.tier==="pro"?a.tierPro:a.tierBasic,children:R(s,i.tier)})})]},`${t.toolName}:${i.commandName}`))]},t.toolName)})})]})}),r.statistics&&e.jsxs("div",{className:a.summaryLine,children:[s("tools.summary.total","Total"),": ",r.statistics.totalCalls," ",s("tools.summary.calls","calls")," | ",s("tools.summary.sessions","Sessions"),": ",r.statistics.totalSessions]})]}),e.jsx(nt,{open:f!==null,title:f==="history"?s("tools.clear.history.title","Clear history?"):s("tools.clear.statistics.title","Clear statistics?"),message:f==="history"?s("tools.clear.history.message","This permanently removes the current place tools history."):s("tools.clear.statistics.message","This permanently resets the current place tool statistics."),cancelLabel:s("common.cancel","Cancel"),confirmLabel:s("common.clear","Clear"),loading:P,onCancel:()=>!P&&x(null),onConfirm:Q})]})}export{ys as Component};
|
|
1
|
+
import{j as e,r as n,a as D,D as ot,u as lt,i as rt,m as it}from"./index-VNIYQxwF.js";import{T as M}from"./TooltipText-BPEldl3x.js";import{C as nt}from"./ConfirmModal-C66ZwIur.js";import{T as ct}from"./Tabs-C9KNjyNX.js";const dt="_wrapper_hzgda_2",ut="_table_hzgda_7",pt="_sortable_hzgda_32",xt="_sortArrow_hzgda_41",ht="_clickable_hzgda_52",mt="_empty_hzgda_57",bt="_expandedRow_hzgda_65",_t="_expandedCell_hzgda_74",T={wrapper:dt,table:ut,sortable:pt,sortArrow:xt,clickable:ht,empty:mt,expandedRow:bt,expandedCell:_t};function ft({columns:s,data:l,sortBy:_,sortDir:r="asc",onSort:v,onRowClick:y,rowKey:B,emptyMessage:E,expandedKey:L,renderExpandedRow:w}){return e.jsx("div",{className:T.wrapper,children:e.jsxs("table",{className:T.table,children:[e.jsx("thead",{children:e.jsx("tr",{children:s.map(u=>e.jsxs("th",{style:u.width?{width:u.width}:void 0,className:u.sortable?T.sortable:void 0,onClick:u.sortable&&v?()=>v(u.key):void 0,children:[e.jsx("span",{children:u.label}),u.sortable&&_===u.key&&e.jsx("span",{className:T.sortArrow,children:r==="asc"?"▴":"▾"})]},u.key))})}),e.jsx("tbody",{children:l.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length,className:T.empty,children:E||"No data"})}):l.map((u,f)=>{const x=B?B(u):String(f),h=L!=null&&x===L&&w?w(u):null;return e.jsxs(n.Fragment,{children:[e.jsx("tr",{className:y?T.clickable:void 0,onClick:y?()=>y(u):void 0,children:s.map(g=>e.jsx("td",{children:g.render?g.render(u):String(u[g.key]??"")},g.key))}),h&&e.jsx("tr",{className:T.expandedRow,children:e.jsx("td",{colSpan:s.length,className:T.expandedCell,children:h})})]},x)})})]})})}function gt(s){return{...s,sequenceNumber:typeof s.sequenceNumber=="number"?s.sequenceNumber:void 0,executionTimeMs:typeof s.executionTimeMs=="number"?s.executionTimeMs:void 0}}const Ct=50;function yt(){const[s,l]=n.useState(null),[_,r]=n.useState(!0),[v,y]=n.useState([]),[B,E]=n.useState(0),[L,w]=n.useState(!1),[u,f]=n.useState(!0),[x,P]=n.useState(0),[h,g]=n.useState(""),H=n.useRef(null),m=n.useCallback(async()=>{r(!0);try{const d=await D.get("/api/dashboard/tool-stats");l(d)}catch{}finally{r(!1)}},[]),C=n.useCallback(async(d,N)=>{f(!0);try{const O={limit:String(Ct),offset:String(d)};N&&(O.tool=N);const A=await D.get("/api/dashboard/history",O);y(A.entries.map(gt)),E(A.total),w(A.hasMore)}catch{y([]),E(0),w(!1)}finally{f(!1)}},[]),q=n.useCallback(()=>{m(),C(x,h)},[C,m,x,h]),z=n.useCallback(async()=>{await D.post("/api/dashboard/tools/history/clear"),C(x,h)},[C,x,h]),F=n.useCallback(async()=>{await D.post("/api/dashboard/tools/statistics/clear"),m()},[m]);return n.useEffect(()=>{m()},[m]),n.useEffect(()=>{C(x,h)},[C,x,h]),n.useEffect(()=>{const d=new ot;H.current=d,d.connect();const N=d.on("command",()=>{m(),C(x,h)});return()=>{N(),d.disconnect(),H.current=null}},[C,m,x,h]),{statistics:s,statsLoading:_,history:v,historyTotal:B,historyHasMore:L,historyLoading:u,historyOffset:x,historyToolFilter:h,setHistoryOffset:P,setHistoryToolFilter:g,refresh:q,clearHistory:z,clearStatistics:F}}const jt="_page_16x6v_2",vt="_card_16x6v_12",kt="_cardToolbar_16x6v_19",Tt="_sectionTitle_16x6v_27",wt="_dangerButton_16x6v_33",Nt="_proBadge_16x6v_52",St="_statusOk_16x6v_67",Mt="_statusFallback_16x6v_76",Bt="_statusUnsupported_16x6v_85",Et="_statusWarning_16x6v_94",Lt="_statusError_16x6v_103",At="_tierBasic_16x6v_113",Rt="_tierPro_16x6v_117",Pt="_tierMixed_16x6v_122",Ht="_filterRow_16x6v_133",Ft="_filterLabel_16x6v_140",Ot="_filterSelect_16x6v_149",It="_expandedRow_16x6v_160",$t="_expandedSection_16x6v_165",Dt="_detailList_16x6v_175",Wt="_detailItem_16x6v_181",qt="_detailLabel_16x6v_187",zt="_detailValue_16x6v_192",Ut="_pre_16x6v_197",Vt="_pagination_16x6v_214",Kt="_pageInfo_16x6v_222",Gt="_btn_16x6v_228",Jt="_tierDistribution_16x6v_251",Zt="_tierBarWrap_16x6v_255",Qt="_tierBarBasic_16x6v_263",Xt="_tierBarPro_16x6v_268",Yt="_tierLabels_16x6v_273",ts="_statsTableWrap_16x6v_282",ss="_statsTable_16x6v_282",es="_sortableHeader_16x6v_313",as="_sortArrow_16x6v_318",os="_statsToolRow_16x6v_322",ls="_statsActionRow_16x6v_330",rs="_expandButton_16x6v_334",is="_expandIcon_16x6v_346",ns="_actionLabel_16x6v_351",cs="_emptyStats_16x6v_358",ds="_summaryLine_16x6v_364",a={page:jt,card:vt,cardToolbar:kt,sectionTitle:Tt,dangerButton:wt,proBadge:Nt,statusOk:St,statusFallback:Mt,statusUnsupported:Bt,statusWarning:Et,statusError:Lt,tierBasic:At,tierPro:Rt,tierMixed:Pt,filterRow:Ht,filterLabel:Ft,filterSelect:Ot,expandedRow:It,expandedSection:$t,detailList:Dt,detailItem:Wt,detailLabel:qt,detailValue:zt,pre:Ut,pagination:Vt,pageInfo:Kt,btn:Gt,tierDistribution:Jt,tierBarWrap:Zt,tierBarBasic:Qt,tierBarPro:Xt,tierLabels:Yt,statsTableWrap:ts,statsTable:ss,sortableHeader:es,sortArrow:as,statsToolRow:os,statsActionRow:ls,expandButton:rs,expandIcon:is,actionLabel:ns,emptyStats:cs,summaryLine:ds},U=50;function us(s){const l=new Date(s);return`${String(l.getHours()).padStart(2,"0")}:${String(l.getMinutes()).padStart(2,"0")}:${String(l.getSeconds()).padStart(2,"0")}`}function W(s){return typeof s!="number"||!Number.isFinite(s)?"-":s<1e3?`${s}ms`:`${(s/1e3).toFixed(1)}s`}function R(s,l){return l==="pro"?s("tier.pro","Pro"):l==="mixed"?s("tier.mixed","Mixed"):s("tier.basic","Basic")}function Z(s,l){return l!==s&&l.startsWith(`${s}_`)?l.slice(s.length+1):""}function ps(s,l){const _=Z(s,l);return _?`${s}.${_}`:s}function J(s){return typeof s=="string"&&s.length>0?s:void 0}function xs(s){if(!Array.isArray(s))return;const l=s.filter(_=>typeof _=="string"&&_.length>0);return l.length>0?l:void 0}function hs(s){const l=s.result??{};return{requestedCommand:s.requestedCommand??J(l.requestedCommand),executedCommand:s.executedCommand??J(l.executedCommand),alternatives:s.alternatives??xs(l.alternatives)}}function ms(s,l){switch(s.status){case"fallback":return{label:l("tools.badge.fallback","FALLBACK"),tooltip:l("tools.badge.fallback.tooltip","The requested Pro action succeeded via a Basic fallback."),className:a.statusFallback};case"unsupported":return{label:l("tools.badge.unsupported","UNSUPPORTED"),tooltip:l("tools.badge.unsupported.tooltip","The requested Pro action was blocked and no fallback ran."),className:a.statusUnsupported};case"warning":return{label:l("tools.badge.warn","WARN"),tooltip:l("tools.badge.warn.tooltip","The tool call failed as an expected caller, project, policy, or user-code issue."),className:a.statusWarning};case"error":return{label:l("tools.badge.err","FAILED"),tooltip:l("tools.badge.err.tooltip","The tool run failed."),className:a.statusError};default:return{label:l("tools.status.ok","OK"),tooltip:l("tools.status.ok.tooltip","The tool run completed successfully."),className:a.statusOk}}}function j(s,l){return e.jsxs("div",{className:a.detailItem,children:[e.jsx("span",{className:a.detailLabel,children:s}),e.jsx("span",{className:a.detailValue,children:l})]})}function ys(){const{t:s}=lt(),{trackEvent:l,trackPageView:_}=rt(),r=yt(),{show:v}=it(),[y,B]=n.useState("history"),[E,L]=n.useState(null),[w,u]=n.useState(null),[f,x]=n.useState(null),[P,h]=n.useState(!1),[g,H]=n.useState("totalCalls"),[m,C]=n.useState("desc"),q=n.useCallback(t=>{H(o=>o===t?(C(i=>i==="asc"?"desc":"asc"),t):(C("desc"),t))},[]),z=n.useMemo(()=>{var o;const t=new Set;return Object.keys(((o=r.statistics)==null?void 0:o.tools)??{}).forEach(i=>t.add(i)),r.history.forEach(i=>{i.tool&&t.add(i.tool)}),r.historyToolFilter&&t.add(r.historyToolFilter),Array.from(t).sort()},[r.history,r.historyToolFilter,r.statistics]),F=n.useMemo(()=>{var t;return(t=r.statistics)!=null&&t.tools?Object.values(r.statistics.tools).map(o=>{var G;const i=Object.entries(o.commands??{}).map(([p,c])=>({toolName:o.tool,commandName:c.command??p,label:Z(o.tool,c.command??p)||(c.command??p),tier:c.tier,totalCalls:c.totalCalls,successCount:c.successCount,fallbackCount:c.fallbackCount,unsupportedCount:c.unsupportedCount,warningCount:c.warningCount??0,failureCount:c.failureCount,totalExecutionTimeMs:c.totalExecutionTimeMs,avgExecutionTimeMs:c.avgExecutionTimeMs})),b=i.reduce((p,c)=>p+c.totalCalls,0),k=i.reduce((p,c)=>p+c.successCount,0),I=i.reduce((p,c)=>p+c.fallbackCount,0),$=i.reduce((p,c)=>p+c.unsupportedCount,0),st=i.reduce((p,c)=>p+c.warningCount,0),et=i.reduce((p,c)=>p+c.failureCount,0),K=i.reduce((p,c)=>p+c.totalExecutionTimeMs,0),at=new Set(i.map(p=>p.tier)).size>1?"mixed":((G=i[0])==null?void 0:G.tier)??o.tier;return{toolName:o.tool,tier:at,commands:i,totalCalls:b,successCount:k,fallbackCount:I,unsupportedCount:$,warningCount:st,failureCount:et,totalExecutionTimeMs:K,avgExecutionTimeMs:b>0?Math.round(K/b):0}}):[]},[r.statistics]),d=n.useCallback((t,o,i,b)=>e.jsx(M,{text:s(i,b),children:s(t,o)}),[s]),N=n.useMemo(()=>[...F].sort((o,i)=>{const b=o[g],k=i[g];if(typeof b=="number"&&typeof k=="number")return m==="asc"?b-k:k-b;const I=String(b??""),$=String(k??"");return m==="asc"?I.localeCompare($):$.localeCompare(I)}),[F,g,m]),O=n.useMemo(()=>[{key:"timestamp",label:d("tools.col.time","Time","tools.col.time.tooltip","When the tool run was recorded."),width:"80px",render:t=>us(t.timestamp)},{key:"toolName",label:d("tools.col.toolAction","Tool.Action","tools.col.toolAction.tooltip","Tool name and action that were executed."),render:t=>e.jsxs("span",{children:[ps(t.tool,t.command),t.tier==="pro"&&e.jsx(M,{text:s("tools.badge.pro.tooltip","This entry used a Pro-only tool or action."),children:e.jsx("span",{className:a.proBadge,children:s("tools.badge.pro","PRO")})})]})},{key:"executionTimeMs",label:d("tools.col.duration","Duration","tools.col.duration.tooltip","How long the tool took to finish."),width:"80px",render:t=>W(t.executionTimeMs)},{key:"status",label:d("tools.col.status","Status","tools.col.status.tooltip","Outcome of the recorded tool run."),width:"120px",render:t=>{const o=ms(t,s);return e.jsx(M,{text:o.tooltip,children:e.jsx("span",{className:o.className,children:o.label})})}},{key:"tier",label:d("tools.col.tier","Tier","tools.col.tier.tooltip","License tier required for the tool or action."),width:"60px",render:t=>e.jsx("span",{className:t.tier==="pro"?a.tierPro:a.tierBasic,children:R(s,t.tier)})}],[s,d]),A=n.useMemo(()=>[{key:"toolName",label:d("tools.col.tool","Tool","tools.col.tool.tooltip","Consolidated tool name in the statistics table."),sortable:!0},{key:"totalCalls",label:d("tools.col.calls","Calls","tools.col.calls.tooltip","Total number of recorded calls for this tool."),sortable:!0,width:"70px"},{key:"successCount",label:d("tools.col.ok","OK","tools.col.ok.tooltip","Number of direct successful runs."),sortable:!0,width:"70px"},{key:"fallbackCount",label:d("tools.col.fallback","FALLBACK","tools.col.fallback.tooltip","Number of runs that succeeded through fallback execution."),sortable:!0,width:"110px"},{key:"unsupportedCount",label:d("tools.col.unsupported","UNSUPPORTED","tools.col.unsupported.tooltip","Number of blocked runs without fallback execution."),sortable:!0,width:"130px"},{key:"warningCount",label:d("tools.col.warn","WARN","tools.col.warn.tooltip","Number of expected failures caused by caller input, project state, Roblox policy, or user code."),sortable:!0,width:"80px"},{key:"failureCount",label:d("tools.col.err","FAILED","tools.col.err.tooltip","Number of runs that failed."),sortable:!0,width:"70px"},{key:"avgExecutionTimeMs",label:d("tools.col.avgTime","Avg Time","tools.col.avgTime.tooltip","Average execution time across recorded calls."),sortable:!0,width:"90px",render:t=>W(t.avgExecutionTimeMs)},{key:"tier",label:d("tools.col.tier","Tier","tools.col.tierStats.tooltip","Basic, Pro, or Mixed summary for the tool statistics row."),sortable:!0,width:"70px",render:t=>e.jsx(M,{text:t.tier==="mixed"?s("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:t.tier==="pro"?a.tierPro:t.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(s,t.tier)})})}],[s,d]),S=n.useMemo(()=>{if(!r.statistics)return null;const t=r.statistics.tierSummary.basic.totalCalls,o=r.statistics.tierSummary.pro.totalCalls,i=t+o;if(i===0)return null;const b=Math.round(t/i*100),k=100-b;return{basic:t,pro:o,basicPct:b,proPct:k}},[r.statistics]),V=n.useCallback(t=>{u(o=>o===t?null:t)},[]),Q=n.useCallback(async()=>{if(f){h(!0);try{f==="history"?await r.clearHistory():await r.clearStatistics(),v(s("toast.clearSuccess","Cleared successfully"),"success"),x(null)}catch{v(s("toast.clearFailed","Failed to clear data"),"error")}finally{h(!1)}}},[f,v,s,r]),X=n.useCallback(t=>{const o=t==="history"?"tools_history":"tools_statistics";l("dashboard_click_event",{click_target:t==="history"?"tools_tab_history":"tools_tab_statistics",page:"tools",tab:o}),_({page:"tools",tab:o}),B(t)},[l,_]),Y=n.useCallback(t=>{const o=hs(t);return e.jsxs("div",{className:a.expandedRow,children:[e.jsxs("div",{className:a.expandedSection,children:[e.jsxs("strong",{children:[e.jsx(M,{text:s("tools.detail.params.tooltip","Input parameters passed to this tool run."),children:s("tools.detail.params","Parameters")}),":"]}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.parameters,null,2)})]}),t.result&&e.jsxs("div",{className:a.expandedSection,children:[e.jsxs("strong",{children:[e.jsx(M,{text:s("tools.detail.result.tooltip","Returned result payload for this tool run."),children:s("tools.detail.result","Result")}),":"]}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.result,null,2)})]}),(t.status==="fallback"||t.status==="unsupported"||t.status==="warning"||t.status==="error")&&e.jsx("div",{className:a.expandedSection,children:e.jsxs("div",{className:a.detailList,children:[t.status==="fallback"&&(o==null?void 0:o.requestedCommand)&&j(s("tools.detail.requestedCommand","Requested Command"),o.requestedCommand),t.status==="fallback"&&(o==null?void 0:o.executedCommand)&&j(s("tools.detail.executedCommand","Executed Command"),o.executedCommand),t.status==="fallback"&&(o==null?void 0:o.alternatives)&&j(s("tools.detail.alternatives","Alternatives"),o.alternatives.join(", ")),t.status==="unsupported"&&t.blockedMessage&&j(s("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage),t.status==="unsupported"&&j(s("tools.detail.noFallback","No Fallback"),s("tools.detail.noFallback.value","No fallback ran.")),t.status==="warning"&&t.warningMessage&&j(s("tools.detail.warningMessage","Warning Message"),t.warningMessage),t.status==="error"&&t.errorMessage&&j(s("tools.detail.errorMessage","Error Message"),t.errorMessage),t.status==="error"&&t.blockedMessage&&j(s("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage),t.status==="error"&&t.fallbackCommand&&j(s("tools.detail.executedCommand","Executed Command"),t.fallbackCommand)]})})]})},[s]),tt=["history","statistics"].map(t=>({key:t,label:s(`tools.tab.${t}`,t.charAt(0).toUpperCase()+t.slice(1))}));return e.jsxs("div",{className:a.page,children:[e.jsx(ct,{items:tt,value:y,onChange:X}),y==="history"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:s("tools.tab.history","History")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{l("dashboard_click_event",{click_target:"tools_clear_history",page:"tools",tab:"tools_history"}),x("history")},children:s("common.clear","Clear")})]}),e.jsx("div",{className:a.filterRow,children:e.jsxs("label",{className:a.filterLabel,children:[s("tools.filter.tool","Tool"),":",e.jsxs("select",{className:a.filterSelect,value:r.historyToolFilter,onChange:t=>{r.setHistoryToolFilter(t.target.value),r.setHistoryOffset(0)},children:[e.jsx("option",{value:"",children:s("tools.filter.all","All")}),z.map(t=>e.jsx("option",{value:t,children:t},t))]})]})}),e.jsx(ft,{columns:O,data:r.history,rowKey:t=>t.id,onRowClick:t=>L(o=>o===t.id?null:t.id),emptyMessage:s("tools.empty.history","No history entries"),expandedKey:E,renderExpandedRow:Y}),e.jsxs("div",{className:a.pagination,children:[e.jsx("button",{className:a.btn,disabled:r.historyOffset===0,title:s("tools.page.prev.tooltip","Go to the previous page of tool history results."),onClick:()=>r.setHistoryOffset(Math.max(0,r.historyOffset-U)),children:s("tools.page.prev","Prev")}),e.jsxs("span",{className:a.pageInfo,children:[r.historyOffset+1,"–",Math.min(r.historyOffset+U,r.historyTotal)," / ",r.historyTotal]}),e.jsx("button",{className:a.btn,disabled:!r.historyHasMore,title:s("tools.page.next.tooltip","Go to the next page of tool history results."),onClick:()=>r.setHistoryOffset(r.historyOffset+U),children:s("tools.page.next","Next")})]})]}),y==="statistics"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:s("tools.tab.statistics","Statistics")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{l("dashboard_click_event",{click_target:"tools_clear_statistics",page:"tools",tab:"tools_statistics"}),x("statistics")},children:s("common.clear","Clear")})]}),S&&e.jsxs("div",{className:a.tierDistribution,children:[e.jsxs("div",{className:a.tierBarWrap,children:[e.jsx("div",{className:a.tierBarBasic,style:{width:`${S.basicPct}%`}}),e.jsx("div",{className:a.tierBarPro,style:{width:`${S.proPct}%`}})]}),e.jsxs("div",{className:a.tierLabels,children:[e.jsxs("span",{children:[R(s,"basic")," ",S.basicPct,"% (",S.basic,")"]}),e.jsxs("span",{children:[R(s,"pro")," ",S.proPct,"% (",S.pro,")"]})]})]}),e.jsx("div",{className:a.statsTableWrap,children:e.jsxs("table",{className:a.statsTable,children:[e.jsx("thead",{children:e.jsx("tr",{children:A.map(t=>e.jsxs("th",{style:t.width?{width:t.width}:void 0,className:t.sortable?a.sortableHeader:void 0,onClick:t.sortable?()=>q(t.key):void 0,children:[e.jsx("span",{children:t.label}),t.sortable&&g===t.key&&e.jsx("span",{className:a.sortArrow,children:m==="asc"?"▴":"▾"})]},t.key))})}),e.jsx("tbody",{children:N.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:A.length,className:a.emptyStats,children:s("tools.empty.stats","No tool statistics")})}):N.map(t=>{const o=w===t.toolName;return e.jsxs(n.Fragment,{children:[e.jsxs("tr",{className:a.statsToolRow,onClick:()=>V(t.toolName),children:[e.jsx("td",{children:e.jsxs("button",{type:"button",className:a.expandButton,"aria-expanded":o,"aria-label":`${t.toolName} ${o?s("common.collapse","Collapse"):s("common.expand","Expand")}`,onClick:i=>{i.stopPropagation(),V(t.toolName)},children:[e.jsx("span",{className:a.expandIcon,"aria-hidden":"true",children:o?"▾":"▸"}),e.jsx("span",{children:t.toolName})]})}),e.jsx("td",{children:t.totalCalls}),e.jsx("td",{children:t.successCount}),e.jsx("td",{children:t.fallbackCount}),e.jsx("td",{children:t.unsupportedCount}),e.jsx("td",{children:t.warningCount}),e.jsx("td",{children:t.failureCount}),e.jsx("td",{children:W(t.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx(M,{text:t.tier==="mixed"?s("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:t.tier==="pro"?a.tierPro:t.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(s,t.tier)})})})]}),o&&t.commands.map(i=>e.jsxs("tr",{className:a.statsActionRow,children:[e.jsx("td",{children:e.jsx("span",{className:a.actionLabel,children:i.label})}),e.jsx("td",{children:i.totalCalls}),e.jsx("td",{children:i.successCount}),e.jsx("td",{children:i.fallbackCount}),e.jsx("td",{children:i.unsupportedCount}),e.jsx("td",{children:i.warningCount}),e.jsx("td",{children:i.failureCount}),e.jsx("td",{children:W(i.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx("span",{className:i.tier==="pro"?a.tierPro:a.tierBasic,children:R(s,i.tier)})})]},`${t.toolName}:${i.commandName}`))]},t.toolName)})})]})}),r.statistics&&e.jsxs("div",{className:a.summaryLine,children:[s("tools.summary.total","Total"),": ",r.statistics.totalCalls," ",s("tools.summary.calls","calls")," | ",s("tools.summary.sessions","Sessions"),": ",r.statistics.totalSessions]})]}),e.jsx(nt,{open:f!==null,title:f==="history"?s("tools.clear.history.title","Clear history?"):s("tools.clear.statistics.title","Clear statistics?"),message:f==="history"?s("tools.clear.history.message","This permanently removes the current place tools history."):s("tools.clear.statistics.message","This permanently resets the current place tool statistics."),cancelLabel:s("common.cancel","Cancel"),confirmLabel:s("common.clear","Clear"),loading:P,onCancel:()=>!P&&x(null),onConfirm:Q})]})}export{ys as Component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as p,p as r}from"./index-
|
|
1
|
+
import{j as p,p as r}from"./index-VNIYQxwF.js";function i({text:o,children:t}){return p.jsx(r,{text:o,children:t})}export{i as T};
|