@weppy/roblox-mcp 2.17.20 → 2.17.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dashboard/dist/assets/{AiPromptExamples-BLQgKnq1.js → AiPromptExamples-v7F0ZqtA.js} +1 -1
  3. package/dashboard/dist/assets/{AssetsPage-CAyaS2og.js → AssetsPage-BiFlajKz.js} +1 -1
  4. package/dashboard/dist/assets/{ChangelogPage-3HMHHgjw.js → ChangelogPage-CZ4M3zvA.js} +1 -1
  5. package/dashboard/dist/assets/{ConfirmModal-DtH41UBe.js → ConfirmModal-EJt_S9vY.js} +1 -1
  6. package/dashboard/dist/assets/{ConnectionPage-DEKNG3dL.js → ConnectionPage-n7saIQzt.js} +1 -1
  7. package/dashboard/dist/assets/{ContentScopedDialog-CO7HgbDh.js → ContentScopedDialog-BcNAWEg1.js} +1 -1
  8. package/dashboard/dist/assets/{ControlsPage-DALL8aLL.js → ControlsPage-BtjiFRSB.js} +1 -1
  9. package/dashboard/dist/assets/{DialogHeader-DGlG63xP.js → DialogHeader-BMv5alOx.js} +1 -1
  10. package/dashboard/dist/assets/{GameChangeDetail-DWovwQok.js → GameChangeDetail-BNoyNyoe.js} +1 -1
  11. package/dashboard/dist/assets/{InfoLabel-CH5CpR7R.js → InfoLabel-xpwjU19F.js} +1 -1
  12. package/dashboard/dist/assets/{OverviewPage-C3wYZrG8.js → OverviewPage-gmgRY2nN.js} +1 -1
  13. package/dashboard/dist/assets/{PageHeader-DfhSm4j-.js → PageHeader-C7zSPJ0K.js} +1 -1
  14. package/dashboard/dist/assets/{PlaceSelectOptions-CMtQalSy.js → PlaceSelectOptions-e39l4_SC.js} +1 -1
  15. package/dashboard/dist/assets/{PlaytestAiPromptExamples-DJFxefZu.js → PlaytestAiPromptExamples-DNcOx55_.js} +1 -1
  16. package/dashboard/dist/assets/{PlaytestPage-DU9ZdQ21.js → PlaytestPage-C1cvi3ce.js} +17 -22
  17. package/dashboard/dist/assets/{SettingsPage-OMdBse7E.js → SettingsPage-BMmYemqI.js} +1 -1
  18. package/dashboard/dist/assets/{SyncPage-D_yCFS3B.js → SyncPage-C1xj3Vtj.js} +1 -1
  19. package/dashboard/dist/assets/{Tabs-D9FkOjPv.js → Tabs-CJSfllHd.js} +1 -1
  20. package/dashboard/dist/assets/{TierPromoPanel-e1H_6c6Z.js → TierPromoPanel-Cj3f7idb.js} +1 -1
  21. package/dashboard/dist/assets/{ToolsPage-CKfktddT.js → ToolsPage-DxgcVWzx.js} +1 -1
  22. package/dashboard/dist/assets/{TooltipText-DSn3s49K.js → TooltipText-CKbtCUcM.js} +1 -1
  23. package/dashboard/dist/assets/{UiStudioPage-DD_9F7Lm.js → UiStudioPage-Ch9n11Rs.js} +1 -1
  24. package/dashboard/dist/assets/WhatsNewPage-C4uGwv-a.css +1 -0
  25. package/dashboard/dist/assets/WhatsNewPage-D91VijNf.js +1 -0
  26. package/dashboard/dist/assets/{bot-BQBLv2uC.js → bot-DBgSRd9L.js} +1 -1
  27. package/dashboard/dist/assets/{check-uNk3Ma2d.js → check-BGgW005M.js} +1 -1
  28. package/dashboard/dist/assets/{copy-D8MSHyQE.js → copy-B53fec-q.js} +1 -1
  29. package/dashboard/dist/assets/index-B-46k2zD.js +868 -0
  30. package/dashboard/dist/assets/{index-VXvX8jPK.css → index-CrljkNgf.css} +1 -1
  31. package/dashboard/dist/assets/{rotate-ccw-Dwy8_z07.js → rotate-ccw-C68bQzOX.js} +1 -1
  32. package/dashboard/dist/assets/{sample-requests-x7wuDmFr.js → sample-requests-Cb8_d2yO.js} +1 -1
  33. package/dashboard/dist/assets/{trash-2-Cw-jysM1.js → trash-2-DMaFDTK8.js} +1 -1
  34. package/dashboard/dist/assets/{useLiveUptime-BEJbC8rw.js → useLiveUptime-Dd5RwIEz.js} +1 -1
  35. package/dashboard/dist/assets/useSettings-DpFpA827.js +2 -0
  36. package/dashboard/dist/index.html +2 -2
  37. package/dist/index.js +140 -140
  38. package/package.json +1 -1
  39. package/roblox-plugin/WeppyRobloxMCP.rbxm +0 -0
  40. package/dashboard/dist/assets/WhatsNewPage-BmnQR1Zm.js +0 -1
  41. package/dashboard/dist/assets/WhatsNewPage-WMbbAUsL.css +0 -1
  42. package/dashboard/dist/assets/index-CJYQedSN.js +0 -858
  43. package/dashboard/dist/assets/useSettings-PZ2Tx5jE.js +0 -2
@@ -1,4 +1,4 @@
1
- import{c as re,u as Q,s as Pe,j as e,a as we,b as Se,r,R as Re,H as ye,K as He,T as ze,d as Y,g as De,e as Ae,A as $e,S as Be}from"./index-CJYQedSN.js";import{C as Ee}from"./ContentScopedDialog-CO7HgbDh.js";import{D as Te}from"./DialogHeader-DGlG63xP.js";import{C as he}from"./ConfirmModal-DtH41UBe.js";import{l as Me,m as Ie,c as Ue,s as a,u as Fe}from"./useSettings-PZ2Tx5jE.js";import{C as je}from"./check-uNk3Ma2d.js";import{T as Oe}from"./trash-2-Cw-jysM1.js";import{C as qe}from"./copy-D8MSHyQE.js";import{C as We,P as Ye}from"./PageHeader-DfhSm4j-.js";import{I as F}from"./InfoLabel-CH5CpR7R.js";import{T as v}from"./TooltipText-DSn3s49K.js";import{D as Ce,f as _e,r as Ge,s as Ke,a as Ne,d as ie,S as le,b as Ve}from"./sample-requests-x7wuDmFr.js";import"./ConfirmModal.module-DJksQHBd.js";/**
1
+ import{c as re,u as Q,s as Pe,j as e,a as we,b as Se,r,R as Re,H as ye,K as He,T as ze,d as Y,g as De,e as Ae,A as $e,S as Be}from"./index-B-46k2zD.js";import{C as Ee}from"./ContentScopedDialog-BcNAWEg1.js";import{D as Te}from"./DialogHeader-BMv5alOx.js";import{C as he}from"./ConfirmModal-EJt_S9vY.js";import{l as Me,m as Ie,c as Ue,s as a,u as Fe}from"./useSettings-DpFpA827.js";import{C as je}from"./check-BGgW005M.js";import{T as Oe}from"./trash-2-DMaFDTK8.js";import{C as qe}from"./copy-B53fec-q.js";import{C as We,P as Ye}from"./PageHeader-C7zSPJ0K.js";import{I as F}from"./InfoLabel-xpwjU19F.js";import{T as v}from"./TooltipText-CKbtCUcM.js";import{D as Ce,f as _e,r as Ge,s as Ke,a as Ne,d as ie,S as le,b as Ve}from"./sample-requests-Cb8_d2yO.js";import"./ConfirmModal.module-DJksQHBd.js";/**
2
2
  * @license lucide-react v1.8.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as l,d as z,h as ne,D as fe,u as ie,j as e,b as _e,a as Se,f as ve,k as xe,T as je}from"./index-CJYQedSN.js";import{B as H,a as J,P as we}from"./PageHeader-DfhSm4j-.js";import{I as Z}from"./InfoLabel-CH5CpR7R.js";import{T as O}from"./TooltipText-DSn3s49K.js";import{C as pe}from"./ConfirmModal-DtH41UBe.js";import{T as Ne}from"./TierPromoPanel-e1H_6c6Z.js";import"./ConfirmModal.module-DJksQHBd.js";const be=5e3,W={report:null,loading:!1,applying:!1,error:null};function Ie(t,a){if(a===null)return null;const _=t.filter(i=>i.placeId===a);return _.length===1?_[0]:a===0?null:_.find(i=>i.folderStatus==="canonical")??null}function ye(t,a){if(a===null||!Number.isSafeInteger(a)||a<0)return!1;const _=t.filter(i=>i.placeId===a);return a===0?_.length===1:_.length===0||_.some(i=>i.folderStatus==="canonical")}function oe(t,a){return a.placeId<=0||!Number.isSafeInteger(a.placeId)?!1:ye(t,a.placeId)&&(a.folderStatus==="canonical"||t.filter(_=>_.placeId===a.placeId).length===1)}function Re(){const[t,a]=l.useState([]),[_,i]=l.useState(null),[d,n]=l.useState(null),[N,R]=l.useState(!0),[D,j]=l.useState(null),[b,g]=l.useState([]),[C,u]=l.useState(!1),[A,E]=l.useState(null),[p,y]=l.useState(W),c=l.useRef(0),h=l.useRef(0),L=l.useRef(null),G=l.useRef(!1),B=l.useRef(null),U=l.useRef(0),q=l.useRef(null),M=l.useRef(new Set),$=l.useCallback(async()=>{const o=++c.current;try{const[f,m]=await Promise.all([z.get("/api/dashboard/sync/targets"),z.get("/api/dashboard/place-summary")]);if(o!==c.current)return;a(f.targets??[]),i(m),j(null)}catch(f){if(o!==c.current)return;a([]),i(null),j(f instanceof Error?f.message:String(f))}finally{o===c.current&&R(!1)}},[]),k=l.useMemo(()=>(_==null?void 0:_.places)??[],[_]),Q=l.useMemo(()=>new Set(t.map(o=>o.placeId).filter(o=>typeof o=="number")),[t]),K=l.useMemo(()=>k.filter(o=>o.placeId===0||!Q.has(o.placeId)),[Q,k]);l.useEffect(()=>{N||D||n(o=>{if((o==null?void 0:o.kind)==="target"&&t.some(m=>m.clientId===o.clientId)||(o==null?void 0:o.kind)==="stored"&&K.some(m=>m.placeId===o.placeId&&m.placeDirName===o.placeDirName&&oe(k,m)))return o;if(t[0])return{kind:"target",clientId:t[0].clientId};const f=K.find(m=>oe(k,m));return f?{kind:"stored",placeId:f.placeId,placeDirName:f.placeDirName}:null})},[N,k,D,K,t]);const Y=(d==null?void 0:d.kind)==="target"?t.find(o=>o.clientId===d.clientId)??null:null,v=(Y==null?void 0:Y.placeId)??((d==null?void 0:d.kind)==="stored"?d.placeId:null),X=(d==null?void 0:d.kind)==="stored"?K.find(o=>o.placeId===d.placeId&&o.placeDirName===d.placeDirName)??null:Ie(k,v),w=(d==null?void 0:d.kind)==="stored"?X!==null&&oe(k,X):ye(k,v),V=(d==null?void 0:d.kind)==="target"?`target:${d.clientId}:${v??"none"}`:(d==null?void 0:d.kind)==="stored"?`stored:${d.placeDirName}`:null;L.current=v,G.current=w,B.current=V;const r=p.applying||V!==null&&M.current.has(V),x=l.useCallback(async(o,f=!1)=>{var F,te;if(o===null){y(W);return}const m=B.current;if(m!==null&&M.current.has(m)||((F=q.current)==null?void 0:F.key)===m)return;const S=++U.current;q.current={key:m,id:S},y(T=>{var se;return f&&((se=T.report)==null?void 0:se.status)==="not_required"?T:{...T,loading:!0,error:null,progress:null}});const P=()=>S===U.current&&m===B.current&&!(m!==null&&M.current.has(m));try{const T=await z.get("/api/sync/migration",{placeId:String(o)});if(!P())return;y({...W,report:T,error:T.status==="blocked"?"migration_blocked":null})}catch(T){if(!P())return;T instanceof ne&&(T.status===404||T.status===503)?y(W):y(se=>({...se,loading:!1,progress:null,error:T instanceof ne&&T.error==="migration_in_progress"?"migration_in_progress":"unknown"}))}finally{((te=q.current)==null?void 0:te.id)===S&&(q.current=null)}},[]),I=l.useCallback(async(o,f,m=!1)=>{const S=++h.current;if(m||(g([]),E(null)),o===null||!f){u(!1),y(W);return}m||u(!0);const P=z.get("/api/dashboard/sync/history",{placeId:String(o),limit:"30"}).then(F=>{S===h.current&&(g(F.entries??[]),E(null))}).catch(F=>{S===h.current&&E(F instanceof Error?F.message:String(F))}).finally(()=>{S===h.current&&u(!1)});await Promise.all([P,x(o,m)])},[x]);l.useEffect(()=>(U.current+=1,q.current=null,y(W),I(v,w),()=>{h.current+=1,U.current+=1}),[I,v,w,(d==null?void 0:d.kind)==="target"?d.clientId:d==null?void 0:d.placeDirName]);const ee=l.useCallback(()=>{$(),I(v,w)},[I,$,v,w]),ue=l.useCallback(async()=>{w&&await x(v)},[x,v,w]),ge=l.useCallback(async()=>{var m;const o=p.report;if(!o||o.status!=="ready"||p.loading||p.applying||!w||o.placeId!==v)return;const f=B.current;if(!(f===null||M.current.has(f))&&((m=q.current)==null?void 0:m.key)!==f){M.current.add(f),U.current+=1,y(S=>({...S,loading:!1,applying:!0,error:null,progress:null}));try{const S=await z.post("/api/sync/migration",{placeId:o.placeId,fromVersion:2,previewFingerprint:o.previewFingerprint,apply:!0});if(M.current.delete(f),B.current!==f||L.current!==o.placeId)return;y({...W,report:S}),$()}catch(S){if(M.current.delete(f),B.current!==f||L.current!==o.placeId)return;if(S instanceof ne&&S.status===409&&(S.error==="preview_stale"||S.error==="migration_blocked")){if(await x(o.placeId),B.current!==f||L.current!==o.placeId)return;y(P=>({...P,applying:!1,error:S.error}))}else y(P=>({...P,applying:!1,progress:null,error:S instanceof ne&&S.error==="migration_in_progress"?"migration_in_progress":"unknown"}))}}},[x,$,p,v,w]);l.useEffect(()=>{if(!p.loading&&!r||v===null||!w)return;let o=!1,f;const m=V,S=async()=>{var P;try{const F=await z.get("/api/sync/migration/progress",{placeId:String(v)});!o&&B.current===m&&((P=F.progress)==null?void 0:P.placeId)===v&&y(te=>({...te,progress:F.progress}))}catch{}finally{o||(f=setTimeout(()=>void S(),1e3))}};return S(),()=>{o=!0,f&&clearTimeout(f)}},[p.loading,r,v,V,w]);const he=l.useCallback(async o=>{if((await z.post(`/api/dashboard/sync/history/clear?placeId=${encodeURIComponent(String(o))}`)).placeId!==o)throw new Error("Cleared Place differs from the confirmed Place.");L.current===o&&G.current&&I(o,!0)},[I]);l.useEffect(()=>{$();const o=()=>{$(),L.current!==null&&G.current&&I(L.current,!0,!0)},f=setInterval(o,be),m=new fe;m.connect();const S=m.on("sync",o),P=m.on("connection",o);return()=>{clearInterval(f),S(),P(),m.disconnect(),c.current+=1}},[I,$]);const me=p.report&&p.report.placeId!==v?W:{...p,applying:r};return{targets:t,places:k,selection:d,selectedTarget:Y,selectedPlace:X,selectedPlaceId:v,storageSafe:w,history:b,historyLoading:C,historyError:A,loading:N,snapshotError:D,migration:me,selectTarget:o=>n({kind:"target",clientId:o}),selectStored:o=>n({kind:"stored",placeId:o.placeId,placeDirName:o.placeDirName}),refresh:ee,refreshMigration:ue,applyMigration:ge,clearHistory:he}}const ke="_page_1hoev_2",Pe="_detailsStack_1hoev_9",De="_refreshButton_1hoev_15",Ce="_targetRow_1hoev_29",Ee="_storedRow_1hoev_30",Le="_storedDisclosure_1hoev_31",Te="_targetList_1hoev_33",Ae="_storedList_1hoev_33",Be="_targetRowSelected_1hoev_53",Me="_targetIdentity_1hoev_54",Fe="_targetStudio_1hoev_54",Oe="_targetState_1hoev_54",$e="_stateNote_1hoev_57",He="_selectedScope_1hoev_94",Ue="_sharedNote_1hoev_109",qe="_emptyMessage_1hoev_109",Ve="_errorMessage_1hoev_110",We="_card_1hoev_113",Ge="_cardHeader_1hoev_120",Ke="_clearButton_1hoev_132",Ye="_statusRow_1hoev_158",ze="_metaItem_1hoev_165",Xe="_statusGrid_1hoev_171",Ze="_forwardStatusReason_1hoev_191",Je="_migrationPanel_1hoev_199",Qe="_migrationHeader_1hoev_206",et="_migrationTitle_1hoev_213",tt="_migrationDescription_1hoev_222",st="_migrationLedger_1hoev_230",nt="_migrationLedgerItem_1hoev_237",ot="_migrationLedgerBlocked_1hoev_262",at="_migrationSection_1hoev_266",it="_migrationList_1hoev_280",rt="_migrationRow_1hoev_292",ct="_migrationOperation_1hoev_305",lt="_migrationRowBody_1hoev_310",dt="_migrationNotice_1hoev_331",pt="_migrationActions_1hoev_340",yt="_migrationButton_1hoev_346",ut="_migrationError_1hoev_353",gt="_migrationDisclosure_1hoev_354",ht="_migrationPagination_1hoev_356",mt="_migrationProgressHeading_1hoev_356",ft="_migrationProgressMeta_1hoev_356",_t="_migrationProgress_1hoev_356",St="_policySummary_1hoev_403",vt="_policySummaryItem_1hoev_414",xt="_policyPrimaryValue_1hoev_439",jt="_policyReviewNotice_1hoev_445",wt="_policyApplySection_1hoev_456",Nt="_policyApplyHeader_1hoev_460",bt="_policyApplyTitle_1hoev_464",It="_policyApplyDescription_1hoev_472",Rt="_policyInfoLabel_1hoev_480",kt="_policySafetyRow_1hoev_491",Pt="_policySafetyLabel_1hoev_503",Dt="_policySafetyBadge_1hoev_509",Ct="_policyDisclosure_1hoev_513",Et="_policyDisclosureIcon_1hoev_545",Lt="_policyDisclosureIconOpen_1hoev_552",Tt="_policyScopeList_1hoev_556",At="_policyScopeRow_1hoev_563",Bt="_policyScopeName_1hoev_577",Mt="_policyDirectionRail_1hoev_589",Ft="_policyDirectionEndpoint_1hoev_605",Ot="_policyDirectionEndpointStudio_1hoev_612",$t="_policyDirectionArrow_1hoev_616",Ht="_forwardBadge_1hoev_659",Ut="_logContainer_1hoev_674",qt="_logEntry_1hoev_681",Vt="_logTime_1hoev_693",Wt="_logType_1hoev_699",Gt="_logTypeWrite_1hoev_708",Kt="_logTypeUpdate_1hoev_712",Yt="_logTypeDelete_1hoev_716",zt="_logTypeIdle_1hoev_720",Xt="_logPath_1hoev_724",Zt="_logEmpty_1hoev_731",s={page:ke,detailsStack:Pe,refreshButton:De,targetRow:Ce,storedRow:Ee,storedDisclosure:Le,targetList:Te,storedList:Ae,targetRowSelected:Be,targetIdentity:Me,targetStudio:Fe,targetState:Oe,stateNote:$e,selectedScope:He,sharedNote:Ue,emptyMessage:qe,errorMessage:Ve,card:We,cardHeader:Ge,clearButton:Ke,statusRow:Ye,metaItem:ze,statusGrid:Xe,forwardStatusReason:Ze,migrationPanel:Je,migrationHeader:Qe,migrationTitle:et,migrationDescription:tt,migrationLedger:st,migrationLedgerItem:nt,migrationLedgerBlocked:ot,migrationSection:at,migrationList:it,migrationRow:rt,migrationOperation:ct,migrationRowBody:lt,migrationNotice:dt,migrationActions:pt,migrationButton:yt,migrationError:ut,migrationDisclosure:gt,migrationPagination:ht,migrationProgressHeading:mt,migrationProgressMeta:ft,migrationProgress:_t,policySummary:St,policySummaryItem:vt,policyPrimaryValue:xt,policyReviewNotice:jt,policyApplySection:wt,policyApplyHeader:Nt,policyApplyTitle:bt,policyApplyDescription:It,policyInfoLabel:Rt,policySafetyRow:kt,policySafetyLabel:Pt,policySafetyBadge:Dt,policyDisclosure:Ct,policyDisclosureIcon:Et,policyDisclosureIconOpen:Lt,policyScopeList:Tt,policyScopeRow:At,policyScopeName:Bt,policyDirectionRail:Mt,policyDirectionEndpoint:Ft,policyDirectionEndpointStudio:Ot,policyDirectionArrow:$t,forwardBadge:Ht,logContainer:Ut,logEntry:qt,logTime:Vt,logType:Wt,logTypeWrite:Gt,logTypeUpdate:Kt,logTypeDelete:Yt,logTypeIdle:zt,logPath:Xt,logEmpty:Zt},ae=50;function Jt(t){return t==="add"?"success":t==="delete"?"danger":"accent"}function re({title:t,items:a,renderItem:_}){const{t:i}=ie(),d=l.useId(),n=l.useRef(null),[N,R]=l.useState(!1),[D,j]=l.useState(0),b=Math.max(0,Math.ceil(a.length/ae)-1),g=Math.min(D,b),C=g*ae,u=Math.min(C+ae,a.length),A=E=>{var p,y;j(E),(y=(p=n.current)==null?void 0:p.scrollTo)==null||y.call(p,{top:0})};return e.jsxs("div",{className:s.migrationSection,children:[e.jsxs(J,{variant:"ghost",className:s.migrationDisclosure,"aria-expanded":N,"aria-controls":d,onClick:()=>R(!N),children:[e.jsxs("span",{children:[t," (",a.length.toLocaleString(),")"]}),e.jsx("span",{"aria-hidden":"true",children:N?"−":"+"})]}),e.jsx("div",{id:d,hidden:!N,children:N&&e.jsxs("div",{children:[e.jsx("ul",{ref:n,className:s.migrationList,tabIndex:0,"aria-label":t,children:a.slice(C,u).map((E,p)=>_(E,C+p))}),e.jsxs("div",{className:s.migrationPagination,children:[e.jsxs("span",{children:[C+1,"–",u," / ",a.length.toLocaleString()]}),b>0&&e.jsxs("div",{children:[e.jsx(J,{variant:"secondary",disabled:g===0,onClick:()=>A(g-1),children:i("sync.migration.previous","Previous")}),e.jsx(J,{variant:"secondary",disabled:g===b,onClick:()=>A(g+1),children:i("sync.migration.next","Next")})]})]})]},g)})]})}function Qt({migration:t,onRefresh:a,onApply:_}){const{t:i}=ie(),[d,n]=l.useState(!1),[N,R]=l.useState(0),D=l.useRef(null),j=!!(t!=null&&t.loading||t!=null&&t.applying),b=t==null?void 0:t.progress,g=(b==null?void 0:b.status)==="running"&&b.operation===(t!=null&&t.applying?"apply":"preview")?b:null,C=g==null?void 0:g.startedAt;l.useEffect(()=>{if(!j){R(0);return}const c=C?Date.parse(C):Date.now(),h=()=>R(Math.max(0,Math.floor((Date.now()-c)/1e3)));h();const L=setInterval(h,1e3);return()=>clearInterval(L)},[j,C]);const u=t==null?void 0:t.report;if(!t||(u==null?void 0:u.status)==="not_required"||!u&&!j&&!t.error)return null;const A=(u==null?void 0:u.status)==="blocked",E=(u==null?void 0:u.status)==="ready"&&!j,p=()=>{n(!1),_(),requestAnimationFrame(()=>{var c;return(c=D.current)==null?void 0:c.focus()})},y=[...new Set((u==null?void 0:u.blockers.map(c=>c.reason))??[])];return e.jsxs("section",{ref:D,tabIndex:-1,className:`${s.card} ${s.migrationPanel}`,"aria-labelledby":"sync-migration-title",children:[e.jsxs("div",{className:s.migrationHeader,children:[e.jsxs("div",{children:[e.jsx("h2",{id:"sync-migration-title",className:s.migrationTitle,children:u?i("sync.migration.title","Sync format update available"):i("sync.migration.checking","Checking sync format")}),e.jsx("p",{className:s.migrationDescription,children:i("sync.migration.description","Review the metadata changes before updating this place from sync format v2 to v3.")})]}),u&&e.jsx(H,{variant:A?"warning":"accent",children:j?t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.refreshing","Refreshing…"):A?i("sync.migration.status.blocked","Blocked"):i("sync.migration.status.ready","Ready to review")})]}),u&&e.jsx("div",{className:s.migrationLedger,"aria-label":i("sync.migration.preview","Review changes"),children:["add","modify","delete","blocked"].map(c=>e.jsxs("div",{className:`${s.migrationLedgerItem} ${c==="blocked"&&A?s.migrationLedgerBlocked:""}`,children:[e.jsx("span",{children:i(`sync.migration.summary.${c}`,c)}),e.jsx("strong",{children:u.summary[c].toLocaleString()})]},c))}),j&&e.jsxs("div",{className:s.migrationProgress,children:[e.jsxs("div",{role:"status",className:s.migrationProgressHeading,children:[e.jsx("span",{children:t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.refreshing","Refreshing…")}),g&&e.jsx("span",{children:i(`sync.migration.phase.${g.phase}`,g.phase)})]}),e.jsx("progress",{"aria-label":i("sync.migration.progress","Update progress"),...g!=null&&g.total&&g.total>0?{value:g.completed,max:g.total}:{}}),e.jsxs("div",{className:s.migrationProgressMeta,children:[e.jsx("span",{"aria-live":"off",children:i("sync.migration.elapsed","Elapsed {seconds}s").replace("{seconds}",String(N))}),(g==null?void 0:g.total)!==null&&(g==null?void 0:g.total)!==void 0&&e.jsxs("span",{children:[g.completed.toLocaleString()," / ",g.total.toLocaleString()]})]}),e.jsx("p",{children:i("sync.migration.wait","Large places can take a while. You can keep browsing while this runs.")})]}),e.jsxs("div",{className:s.migrationNotice,"aria-live":"polite",children:[(A||t.error==="migration_blocked")&&e.jsx("span",{children:i("sync.migration.blocked","Resolve sync conflicts before updating")}),y.map(c=>e.jsx("span",{children:i(`sync.migration.reason.${c}`,c.replace(/_/g," "))},c)),t.error==="preview_stale"&&e.jsx("span",{children:i("sync.migration.stale","Preview changed. Review the latest diff.")}),t.error==="migration_in_progress"&&e.jsx("span",{children:i("sync.migration.inProgress","An update is already running for this place. Wait, then refresh the preview.")}),t.error==="unknown"&&e.jsx("span",{className:s.migrationError,children:i("sync.migration.error","Could not update the sync format. Try again.")})]}),e.jsxs("div",{className:s.migrationActions,children:[e.jsx(J,{variant:"secondary",className:s.migrationButton,disabled:j,onClick:()=>void a(),children:t.loading?i("sync.migration.refreshing","Refreshing…"):i("sync.migration.refresh","Refresh preview")}),u&&e.jsx(J,{variant:"primary",className:s.migrationButton,disabled:!E,onClick:()=>n(!0),children:t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.apply","Apply update")})]}),u&&u.changes.length>0&&e.jsx(re,{title:i("sync.migration.changes","Metadata changes"),items:u.changes,renderItem:c=>e.jsxs("li",{className:s.migrationRow,children:[e.jsx(H,{variant:Jt(c.operation),className:s.migrationOperation,children:i(`sync.migration.operation.${c.operation}`,c.operation)}),e.jsxs("div",{className:s.migrationRowBody,children:[e.jsx("code",{children:c.path}),e.jsx("span",{children:i(`sync.migration.reason.${c.reason}`,c.reason.replace(/_/g," "))})]})]},`${c.operation}:${c.path}`)}),u&&u.blockers.length>0&&e.jsx(re,{title:i("sync.migration.blockers","Items to resolve"),items:u.blockers,renderItem:(c,h)=>e.jsxs("li",{className:s.migrationRow,children:[e.jsx(H,{variant:"warning",className:s.migrationOperation,children:i("sync.migration.summary.blocked","Blocked")}),e.jsxs("div",{className:s.migrationRowBody,children:[c.path&&e.jsx("code",{children:c.path}),e.jsx("span",{children:i(`sync.migration.reason.${c.reason}`,c.reason.replace(/_/g," "))})]})]},`${c.reason}:${c.path??h}`)}),e.jsx(pe,{open:d,title:i("sync.migration.confirm.title","Apply sync format update?"),message:i("sync.migration.confirm.message","Back up and update the listed sync metadata. Your Luau source files will not change."),cancelLabel:i("common.cancel","Cancel"),confirmLabel:i("sync.migration.apply","Apply update"),onCancel:()=>n(!1),onConfirm:p})]})}const es=["scriptSource","properties","structure","serviceProperties"];function ts(t){const a=new Date(t);return`${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}function ss(t){switch(t){case"fullSyncComplete":case"write":return s.logTypeWrite;case"fullSyncStart":case"fullSyncProgress":case"update":return s.logTypeUpdate;case"fullSyncFailed":case"delete":return s.logTypeDelete;default:return s.logTypeIdle}}const ce={unknown:"neutral",off:"neutral",idle:"neutral",initializing:"info",syncing:"success",paused:"warning",error:"error"},le={unknown:"Unknown",off:"Sync OFF",idle:"Waiting",initializing:"Initializing",syncing:"Syncing",paused:"Paused",error:"Error"},ns={inactive:"Change sending off",active:"Change sending enabled",paused_play:"Paused for Play",reconciling:"Checking Edit changes",blocked:"Changes need attention",unknown:"Sending status unknown"},os={inactive:"neutral",active:"success",paused_play:"warning",reconciling:"info",blocked:"error",unknown:"neutral"};function as(t,a){switch(a){case"conflict_review":case"manual_review":return t("sync.forwardStatus.reason.review","Review changes in the Studio Plugin.");case"edit_changed_during_reconciliation":return t("sync.forwardStatus.reason.editChanged","Edit changed during the check. Inspect Sync in the Studio Plugin.");case"pre_check_failed":case"reverse_apply_failed":case"reconciliation_failed":case"sync_error":case"update_failed":case"acknowledgement_missing":case"ACK_EXPIRED":case"ACK_ID_REUSED":case"SYNC_DIRECTION_REVERSE":return t("sync.forwardStatus.reason.failed","Changes could not be confirmed. Inspect Sync in the Studio Plugin.");default:return t("sync.forwardStatus.reason.fallback","Check the Studio Plugin for details.")}}function is(t,a){const _={studio_first:"Studio First",bidirectional_review:"Bidirectional",local_code_studio_world:"Local Code, Studio World",custom:"Custom"};return t(`sync.policy.preset.${a}`,_[a])}function de(t,a){return a==="auto"?t("sync.policy.apply.auto","Auto apply"):t("sync.policy.apply.manual","Review first")}function rs(t,a){const _={forward:"Studio → Local",reverse:"Local → Studio",bidirectional:"Both ways"};return t(`sync.policy.direction.${a}`,_[a])}function cs(t){return{forward:"←",reverse:"→",bidirectional:"⇄"}[t]}function ls(t,a){const _={forward:"Studio changes are written to local files.",reverse:"Local file changes are applied to Studio.",bidirectional:"Changes can move from Studio to local files and from local files to Studio."};return t(`sync.policy.direction.${a}.tooltip`,_[a])}function ds(t,a){return a?t("sync.policy.safety.auto","Auto delete to Studio"):t("sync.policy.safety.review","Review before delete")}function ps(t,a){return a?t("sync.policy.safety.auto.tooltip","Deleting local files may automatically remove matching Studio instances. This is separate from UI Studio automatic cleanup."):t("sync.policy.safety.review.tooltip","Local file deletions wait for review before matching Studio instances are removed. This is separate from UI Studio automatic cleanup.")}function ys(t,a){switch(a){case"fullSyncStart":return t("sync.log.type.fullSyncStart","START");case"fullSyncProgress":return t("sync.log.type.fullSyncProgress","PROGRESS");case"fullSyncComplete":return t("sync.log.type.fullSyncComplete","COMPLETE");case"fullSyncFailed":return t("sync.log.type.fullSyncFailed","FAILED");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 us(t,a){switch(a){case"fullSyncStart":return t("sync.log.type.fullSyncStart.tooltip","Full Sync started.");case"fullSyncProgress":return t("sync.log.type.fullSyncProgress.tooltip","Full Sync is saving the snapshot.");case"fullSyncComplete":return t("sync.log.type.fullSyncComplete.tooltip","Full Sync completed successfully.");case"fullSyncFailed":return t("sync.log.type.fullSyncFailed.tooltip","Full Sync ended without completing the snapshot.");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 xs(){var K,Y,v,X,w,V;const{t}=ie(),{trackEvent:a}=_e(),{level:_}=Se(),{tier:i,loading:d}=ve(),n=Re(),{show:N}=xe(),[R,D]=l.useState(null),[j,b]=l.useState(!1),[g,C]=l.useState(!1),[u,A]=l.useState(!1),E=!d&&i==="basic",p=n.selectedTarget,y=p==null?void 0:p.sync,c=(y==null?void 0:y.forwardSyncStatus)??"unknown",h=p?{...p.sync.status,syncEnabled:p.sync.syncEnabled,policy:p.sync.policy,policyCapabilities:p.sync.policyCapabilities,policyReviewRequired:p.sync.policyReviewRequired}:null,L=(p==null?void 0:p.placeName)??((K=n.selectedPlace)==null?void 0:K.placeName)??t("sync.targets.unknownPlace","Unknown place"),G=n.selectedPlaceId===null?L:L+" · "+n.selectedPlaceId,B=n.storageSafe?(h==null?void 0:h.instanceCount)??((Y=n.selectedPlace)==null?void 0:Y.instanceCount):null,U=n.storageSafe?(h==null?void 0:h.scriptCount)??((v=n.selectedPlace)==null?void 0:v.scriptCount):null,q=new Set(n.targets.map(r=>r.placeId)),M=n.places.filter(r=>r.placeId===0||!q.has(r.placeId)),$=e.jsx(we,{title:t("page.sync.title","Sync"),description:t("page.sync.description","Monitor Studio to local sync status, direction, apply mode, and recent sync logs."),helpTopicId:"sync",helpState:{connectionLevel:_,tier:i}}),k=n.history,Q=async()=>{if(R){b(!0);try{await n.clearHistory(R.placeId),N(t("toast.clearSuccess","Cleared successfully"),"success"),D(null)}catch{N(t("toast.clearFailed","Failed to clear data"),"error")}finally{b(!1)}}};return e.jsxs("div",{className:s.page,children:[$,e.jsxs("section",{className:s.card,"aria-label":t("sync.targets.title","Connected Studios"),children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[t("sync.targets.title","Connected Studios")," (",n.targets.length,")"]}),e.jsx("button",{type:"button",className:s.refreshButton,onClick:n.refresh,children:t("sync.targets.refresh","Refresh")})]}),n.loading?e.jsx("p",{className:s.emptyMessage,children:t("sync.targets.loading","Loading Studio Sync status…")}):n.snapshotError?e.jsxs("p",{className:s.errorMessage,role:"alert",children:[t("sync.targets.unavailable","Studio Sync status is unavailable. Retry to check the current state.")," ",n.snapshotError]}):n.targets.length===0?e.jsx("p",{className:s.emptyMessage,children:t("sync.targets.empty","No Studio is connected. Connect the WEPPY Plugin to see live Sync status.")}):e.jsx("div",{className:s.targetList,children:n.targets.map(r=>{var I;const x=((I=n.selection)==null?void 0:I.kind)==="target"&&n.selection.clientId===r.clientId;return e.jsxs("button",{type:"button",className:`${s.targetRow} ${x?s.targetRowSelected:""}`,"aria-pressed":x,onClick:()=>n.selectTarget(r.clientId),children:[e.jsxs("span",{className:s.targetIdentity,children:[e.jsx(O,{text:r.placeName||t("sync.targets.unknownPlace","Unknown place"),children:e.jsx("strong",{children:r.placeName||t("sync.targets.unknownPlace","Unknown place")})}),e.jsxs("span",{children:[t("sync.targets.placeId","Place ID"),": ",r.placeId??"—"]})]}),e.jsxs("span",{className:s.targetStudio,children:[e.jsx(O,{text:r.clientId,children:e.jsxs("span",{children:[t("sync.targets.studioId","Studio ID"),": ",r.targetAlias]})}),e.jsx("span",{children:t("sync.targets.connected","Connected")})]}),e.jsxs("span",{className:s.targetState,children:[e.jsx(H,{variant:ce[r.sync.state],shape:"pill",children:t("sync.targets.state."+r.sync.state,le[r.sync.state])}),r.sync.syncEnabled===null&&e.jsx("span",{className:s.stateNote,children:t("sync.targets.notReported","Not reported yet")})]})]},r.clientId)})})]}),M.length>0&&e.jsxs("section",{className:s.card,"aria-label":t("sync.stored.title","Stored places"),children:[e.jsxs("button",{type:"button",className:s.storedDisclosure,"aria-expanded":u,onClick:()=>A(r=>!r),children:[e.jsxs("span",{children:[t("sync.stored.title","Stored places")," (",M.length,")"]}),e.jsx("span",{"aria-hidden":"true",children:u?"⌃":"⌄"})]}),u&&e.jsx("div",{className:s.storedList,children:M.map(r=>{var ee;const x=oe(n.places,r),I=((ee=n.selection)==null?void 0:ee.kind)==="stored"&&n.selection.placeDirName===r.placeDirName;return e.jsxs("button",{type:"button",className:`${s.storedRow} ${I?s.targetRowSelected:""}`,disabled:!x,"aria-pressed":I,onClick:()=>n.selectStored(r),children:[e.jsxs("span",{children:[r.placeName," · ",r.placeId]}),e.jsx("span",{children:x?t("sync.stored.data","Stored data"):t("sync.stored.ambiguous","Storage location unconfirmed")})]},r.placeDirName)})})]}),n.selection&&!n.snapshotError&&e.jsxs("div",{className:s.selectedScope,children:[e.jsx("span",{children:t("sync.detail.scope","Viewing Sync details for")}),e.jsx("strong",{children:G}),p&&e.jsxs("span",{children:[t("sync.targets.studioId","Studio ID"),": ",p.targetAlias]}),e.jsx("span",{children:t("sync.detail.readOnly","Viewing details does not change Studio routing.")})]}),!n.selection&&!n.loading&&!n.snapshotError&&e.jsx("p",{className:s.emptyMessage,children:t("sync.detail.empty","Select a connected Studio or stored place to view details.")}),n.selection&&!n.snapshotError&&e.jsxs("div",{className:s.detailsStack,children:[e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsx(O,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),E&&e.jsx(O,{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:[y?e.jsx(H,{variant:ce[y.state],shape:"pill",children:t("sync.targets.state."+y.state,le[y.state])}):e.jsx(H,{variant:"neutral",shape:"pill",children:t("sync.stored.data","Stored data")}),e.jsx("span",{className:s.metaItem,children:G})]}),(y==null?void 0:y.state)==="unknown"&&e.jsx("p",{className:s.emptyMessage,children:t("sync.detail.unknown","This Studio has not reported its Sync state yet.")}),(y==null?void 0:y.state)==="error"&&e.jsx("p",{className:s.errorMessage,role:"alert",children:t("sync.detail.error","Sync reported an error. Check the Studio Plugin for details.")}),e.jsxs("dl",{className:s.statusGrid,children:[p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.forwardStatus.label","Change sending"),tooltip:t("sync.forwardStatus.tooltip","This reports whether Edit changes can be sent. Enabled does not confirm every local file is current.")})}),e.jsxs("dd",{children:[e.jsx(H,{variant:os[c],shape:"pill",children:t("sync.forwardStatus."+c,ns[c])}),c==="blocked"&&e.jsx("span",{className:s.forwardStatusReason,children:as(t,y==null?void 0:y.forwardSyncReason)})]}),(y==null?void 0:y.forwardSyncObservedAt)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:t("sync.forwardStatus.observedAt","Observed")}),e.jsx("dd",{children:new Date(y.forwardSyncObservedAt).toLocaleString()})]})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:t("sync.targets.studioId","Studio ID")}),e.jsx("dd",{children:p.targetAlias}),e.jsx("dt",{children:t("sync.targets.connectionId","Connection ID")}),e.jsx("dd",{children:p.clientId})]}),(h==null?void 0:h.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.status.path","Place Root"),tooltip:t("sync.status.path.tooltip","Local filesystem root currently used for this place sync output.")})}),e.jsx("dd",{children:h.syncRoot})]}),((X=n.selectedPlace)==null?void 0:X.placeDirName)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.detail.placeFolder","Place folder"),tooltip:t("sync.detail.placeFolder.tooltip","The stored folder shared by Studios opening this Place.")})}),e.jsx("dd",{children:n.selectedPlace.placeDirName})]}),B!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:B})]}),U!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:U})]})]}),e.jsx("p",{className:s.sharedNote,children:t("sync.detail.sharedData","Path, counts, and log belong to the Place and are shared by Studios opening it.")})]}),n.storageSafe&&e.jsx(Qt,{migration:n.migration,onRefresh:n.refreshMigration,onApply:n.applyMigration},[n.selection.kind==="target"?n.selection.clientId:n.selection.placeDirName,n.selectedPlaceId,(V=(w=n.migration)==null?void 0:w.report)==null?void 0:V.previewFingerprint].join(":")),(h==null?void 0:h.policy)&&e.jsxs("div",{className:s.card,children:[e.jsx("div",{className:s.cardHeader,children:e.jsx(O,{text:t("sync.policy.title.tooltip","Effective Sync policy reported by the connected Studio plugin."),children:t("sync.policy.title","Sync Policy")})}),e.jsxs("dl",{className:s.policySummary,children:[e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.activation","Activation")}),e.jsx("dd",{children:e.jsx(H,{variant:h.syncEnabled?"success":"neutral",children:h.syncEnabled?t("sync.policy.activation.on","Sync ON"):t("sync.policy.activation.off","Sync OFF")})})]}),e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.preset","Workflow")}),e.jsx("dd",{className:s.policyPrimaryValue,children:is(t,h.policy.preset)})]})]}),h.policyReviewRequired&&e.jsx("div",{className:s.policyReviewNotice,role:"status",children:t("sync.policy.reviewRequired","Review this policy in the Studio plugin before starting Sync.")}),e.jsxs("section",{className:s.policyApplySection,"aria-labelledby":"sync-policy-apply-title",children:[e.jsxs("div",{className:s.policyApplyHeader,children:[e.jsx("h3",{id:"sync-policy-apply-title",className:s.policyApplyTitle,children:t("sync.policy.apply.title","How local changes apply to Studio")}),e.jsx("p",{className:s.policyApplyDescription,children:t("sync.policy.apply.description","Shows whether changes made locally are reviewed first or applied to Studio automatically.")})]}),e.jsxs("dl",{className:s.policySummary,children:[e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(O,{text:t("sync.policy.apply.content.tooltip","Script Source, property, and Service property changes made locally. Instance creation, deletion, renaming, and moves are Structure changes."),children:e.jsx("span",{className:s.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.content","Content changes")})})}),e.jsx("dd",{children:de(t,h.policy.apply.contentChanges)})]}),e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(O,{text:t("sync.policy.apply.structure.tooltip","Instance creation, deletion, renaming, and moves made locally. Automatic local deletion additionally requires the separate delete option below."),children:e.jsx("span",{className:s.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.structure","Structure changes")})})}),e.jsx("dd",{children:de(t,h.policy.apply.structureChanges)})]})]}),e.jsxs("div",{className:s.policySafetyRow,children:[e.jsx("span",{className:s.policySafetyLabel,children:t("sync.policy.safety.localDeletes","Local delete → Studio instance removal")}),e.jsx(O,{text:ps(t,h.policy.autoApplyLocalDeletesToStudio),children:e.jsx(H,{variant:h.policy.autoApplyLocalDeletesToStudio?"warning":"neutral",className:s.policySafetyBadge,tabIndex:0,children:ds(t,h.policy.autoApplyLocalDeletesToStudio)})})]})]}),e.jsxs("button",{type:"button",className:s.policyDisclosure,"aria-expanded":g,"aria-controls":"sync-policy-scope-panel",onClick:()=>C(r=>!r),children:[e.jsx("span",{children:t("sync.policy.scope.disclosure","Scope directions")}),e.jsx("span",{"aria-hidden":"true",className:`${s.policyDisclosureIcon} ${g?s.policyDisclosureIconOpen:""}`,children:"⌄"})]}),g&&e.jsx("div",{id:"sync-policy-scope-panel",className:s.policyScopeList,children:es.map(r=>{const x=h.policy.directions[r];return e.jsxs("div",{className:s.policyScopeRow,"data-testid":"sync-policy-scope-row",children:[e.jsx("span",{className:s.policyScopeName,children:t(`sync.policy.scope.${r}`,r)}),e.jsx(O,{text:ls(t,x),children:e.jsxs("span",{className:s.policyDirectionRail,"data-testid":"sync-policy-direction-rail",role:"img","aria-label":rs(t,x),tabIndex:0,children:[e.jsx("span",{className:s.policyDirectionEndpoint,children:t("sync.policy.endpoint.local","Local")}),e.jsx("span",{className:s.policyDirectionArrow,"aria-hidden":"true",children:cs(x)}),e.jsx("span",{className:`${s.policyDirectionEndpoint} ${s.policyDirectionEndpointStudio}`,children:t("sync.policy.endpoint.studio","Studio")})]})})]},r)})})]}),e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[t("sync.log.title","Sync Log")," · ",t("sync.log.shared","Shared Place log")]}),e.jsx("button",{className:s.clearButton,type:"button",disabled:!n.storageSafe||n.selectedPlaceId===null,onClick:()=>{n.selectedPlaceId!==null&&(a("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),D({placeId:n.selectedPlaceId,label:G}))},children:t("common.clear","Clear")})]}),e.jsx("div",{className:s.logContainer,children:n.storageSafe?n.historyError?e.jsxs("div",{className:s.errorMessage,role:"alert",children:[t("sync.log.unavailable","The Place log could not be loaded. Retry to check it.")," ",n.historyError]}):n.historyLoading&&k.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.loading","Loading Place log…")}):k.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.empty","No sync events yet")}):k.map((r,x)=>e.jsxs("div",{className:s.logEntry,children:[e.jsx("span",{className:s.logTime,children:ts(r.timestamp)}),e.jsx(O,{text:us(t,r.type),children:e.jsx("span",{className:`${s.logType} ${ss(r.type)}`,children:ys(t,r.type)})}),e.jsxs("span",{className:s.logPath,children:[r.path,r.details?` — ${r.details}`:""]})]},x)):e.jsx("div",{className:s.logEmpty,children:t("sync.log.unsafe","This Place has no confirmed storage location for log access.")})})]}),E&&e.jsx(Ne,{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:je.sync})]}),e.jsx(pe,{open:R!==null,title:t("sync.clear.title","Clear sync log?"),message:t("sync.clear.selectedMessage","This permanently removes the shared Sync log for {place}.").replace("{place}",(R==null?void 0:R.label)??""),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:j,onCancel:()=>!j&&D(null),onConfirm:Q})]})}export{xs as Component};
1
+ import{r as l,d as z,h as ne,D as fe,u as ie,j as e,b as _e,a as Se,f as ve,k as xe,T as je}from"./index-B-46k2zD.js";import{B as H,a as J,P as we}from"./PageHeader-C7zSPJ0K.js";import{I as Z}from"./InfoLabel-xpwjU19F.js";import{T as O}from"./TooltipText-CKbtCUcM.js";import{C as pe}from"./ConfirmModal-EJt_S9vY.js";import{T as Ne}from"./TierPromoPanel-Cj3f7idb.js";import"./ConfirmModal.module-DJksQHBd.js";const be=5e3,W={report:null,loading:!1,applying:!1,error:null};function Ie(t,a){if(a===null)return null;const _=t.filter(i=>i.placeId===a);return _.length===1?_[0]:a===0?null:_.find(i=>i.folderStatus==="canonical")??null}function ye(t,a){if(a===null||!Number.isSafeInteger(a)||a<0)return!1;const _=t.filter(i=>i.placeId===a);return a===0?_.length===1:_.length===0||_.some(i=>i.folderStatus==="canonical")}function oe(t,a){return a.placeId<=0||!Number.isSafeInteger(a.placeId)?!1:ye(t,a.placeId)&&(a.folderStatus==="canonical"||t.filter(_=>_.placeId===a.placeId).length===1)}function Re(){const[t,a]=l.useState([]),[_,i]=l.useState(null),[d,n]=l.useState(null),[N,R]=l.useState(!0),[D,j]=l.useState(null),[b,g]=l.useState([]),[C,u]=l.useState(!1),[A,E]=l.useState(null),[p,y]=l.useState(W),c=l.useRef(0),h=l.useRef(0),L=l.useRef(null),G=l.useRef(!1),B=l.useRef(null),U=l.useRef(0),q=l.useRef(null),M=l.useRef(new Set),$=l.useCallback(async()=>{const o=++c.current;try{const[f,m]=await Promise.all([z.get("/api/dashboard/sync/targets"),z.get("/api/dashboard/place-summary")]);if(o!==c.current)return;a(f.targets??[]),i(m),j(null)}catch(f){if(o!==c.current)return;a([]),i(null),j(f instanceof Error?f.message:String(f))}finally{o===c.current&&R(!1)}},[]),k=l.useMemo(()=>(_==null?void 0:_.places)??[],[_]),Q=l.useMemo(()=>new Set(t.map(o=>o.placeId).filter(o=>typeof o=="number")),[t]),K=l.useMemo(()=>k.filter(o=>o.placeId===0||!Q.has(o.placeId)),[Q,k]);l.useEffect(()=>{N||D||n(o=>{if((o==null?void 0:o.kind)==="target"&&t.some(m=>m.clientId===o.clientId)||(o==null?void 0:o.kind)==="stored"&&K.some(m=>m.placeId===o.placeId&&m.placeDirName===o.placeDirName&&oe(k,m)))return o;if(t[0])return{kind:"target",clientId:t[0].clientId};const f=K.find(m=>oe(k,m));return f?{kind:"stored",placeId:f.placeId,placeDirName:f.placeDirName}:null})},[N,k,D,K,t]);const Y=(d==null?void 0:d.kind)==="target"?t.find(o=>o.clientId===d.clientId)??null:null,v=(Y==null?void 0:Y.placeId)??((d==null?void 0:d.kind)==="stored"?d.placeId:null),X=(d==null?void 0:d.kind)==="stored"?K.find(o=>o.placeId===d.placeId&&o.placeDirName===d.placeDirName)??null:Ie(k,v),w=(d==null?void 0:d.kind)==="stored"?X!==null&&oe(k,X):ye(k,v),V=(d==null?void 0:d.kind)==="target"?`target:${d.clientId}:${v??"none"}`:(d==null?void 0:d.kind)==="stored"?`stored:${d.placeDirName}`:null;L.current=v,G.current=w,B.current=V;const r=p.applying||V!==null&&M.current.has(V),x=l.useCallback(async(o,f=!1)=>{var F,te;if(o===null){y(W);return}const m=B.current;if(m!==null&&M.current.has(m)||((F=q.current)==null?void 0:F.key)===m)return;const S=++U.current;q.current={key:m,id:S},y(T=>{var se;return f&&((se=T.report)==null?void 0:se.status)==="not_required"?T:{...T,loading:!0,error:null,progress:null}});const P=()=>S===U.current&&m===B.current&&!(m!==null&&M.current.has(m));try{const T=await z.get("/api/sync/migration",{placeId:String(o)});if(!P())return;y({...W,report:T,error:T.status==="blocked"?"migration_blocked":null})}catch(T){if(!P())return;T instanceof ne&&(T.status===404||T.status===503)?y(W):y(se=>({...se,loading:!1,progress:null,error:T instanceof ne&&T.error==="migration_in_progress"?"migration_in_progress":"unknown"}))}finally{((te=q.current)==null?void 0:te.id)===S&&(q.current=null)}},[]),I=l.useCallback(async(o,f,m=!1)=>{const S=++h.current;if(m||(g([]),E(null)),o===null||!f){u(!1),y(W);return}m||u(!0);const P=z.get("/api/dashboard/sync/history",{placeId:String(o),limit:"30"}).then(F=>{S===h.current&&(g(F.entries??[]),E(null))}).catch(F=>{S===h.current&&E(F instanceof Error?F.message:String(F))}).finally(()=>{S===h.current&&u(!1)});await Promise.all([P,x(o,m)])},[x]);l.useEffect(()=>(U.current+=1,q.current=null,y(W),I(v,w),()=>{h.current+=1,U.current+=1}),[I,v,w,(d==null?void 0:d.kind)==="target"?d.clientId:d==null?void 0:d.placeDirName]);const ee=l.useCallback(()=>{$(),I(v,w)},[I,$,v,w]),ue=l.useCallback(async()=>{w&&await x(v)},[x,v,w]),ge=l.useCallback(async()=>{var m;const o=p.report;if(!o||o.status!=="ready"||p.loading||p.applying||!w||o.placeId!==v)return;const f=B.current;if(!(f===null||M.current.has(f))&&((m=q.current)==null?void 0:m.key)!==f){M.current.add(f),U.current+=1,y(S=>({...S,loading:!1,applying:!0,error:null,progress:null}));try{const S=await z.post("/api/sync/migration",{placeId:o.placeId,fromVersion:2,previewFingerprint:o.previewFingerprint,apply:!0});if(M.current.delete(f),B.current!==f||L.current!==o.placeId)return;y({...W,report:S}),$()}catch(S){if(M.current.delete(f),B.current!==f||L.current!==o.placeId)return;if(S instanceof ne&&S.status===409&&(S.error==="preview_stale"||S.error==="migration_blocked")){if(await x(o.placeId),B.current!==f||L.current!==o.placeId)return;y(P=>({...P,applying:!1,error:S.error}))}else y(P=>({...P,applying:!1,progress:null,error:S instanceof ne&&S.error==="migration_in_progress"?"migration_in_progress":"unknown"}))}}},[x,$,p,v,w]);l.useEffect(()=>{if(!p.loading&&!r||v===null||!w)return;let o=!1,f;const m=V,S=async()=>{var P;try{const F=await z.get("/api/sync/migration/progress",{placeId:String(v)});!o&&B.current===m&&((P=F.progress)==null?void 0:P.placeId)===v&&y(te=>({...te,progress:F.progress}))}catch{}finally{o||(f=setTimeout(()=>void S(),1e3))}};return S(),()=>{o=!0,f&&clearTimeout(f)}},[p.loading,r,v,V,w]);const he=l.useCallback(async o=>{if((await z.post(`/api/dashboard/sync/history/clear?placeId=${encodeURIComponent(String(o))}`)).placeId!==o)throw new Error("Cleared Place differs from the confirmed Place.");L.current===o&&G.current&&I(o,!0)},[I]);l.useEffect(()=>{$();const o=()=>{$(),L.current!==null&&G.current&&I(L.current,!0,!0)},f=setInterval(o,be),m=new fe;m.connect();const S=m.on("sync",o),P=m.on("connection",o);return()=>{clearInterval(f),S(),P(),m.disconnect(),c.current+=1}},[I,$]);const me=p.report&&p.report.placeId!==v?W:{...p,applying:r};return{targets:t,places:k,selection:d,selectedTarget:Y,selectedPlace:X,selectedPlaceId:v,storageSafe:w,history:b,historyLoading:C,historyError:A,loading:N,snapshotError:D,migration:me,selectTarget:o=>n({kind:"target",clientId:o}),selectStored:o=>n({kind:"stored",placeId:o.placeId,placeDirName:o.placeDirName}),refresh:ee,refreshMigration:ue,applyMigration:ge,clearHistory:he}}const ke="_page_1hoev_2",Pe="_detailsStack_1hoev_9",De="_refreshButton_1hoev_15",Ce="_targetRow_1hoev_29",Ee="_storedRow_1hoev_30",Le="_storedDisclosure_1hoev_31",Te="_targetList_1hoev_33",Ae="_storedList_1hoev_33",Be="_targetRowSelected_1hoev_53",Me="_targetIdentity_1hoev_54",Fe="_targetStudio_1hoev_54",Oe="_targetState_1hoev_54",$e="_stateNote_1hoev_57",He="_selectedScope_1hoev_94",Ue="_sharedNote_1hoev_109",qe="_emptyMessage_1hoev_109",Ve="_errorMessage_1hoev_110",We="_card_1hoev_113",Ge="_cardHeader_1hoev_120",Ke="_clearButton_1hoev_132",Ye="_statusRow_1hoev_158",ze="_metaItem_1hoev_165",Xe="_statusGrid_1hoev_171",Ze="_forwardStatusReason_1hoev_191",Je="_migrationPanel_1hoev_199",Qe="_migrationHeader_1hoev_206",et="_migrationTitle_1hoev_213",tt="_migrationDescription_1hoev_222",st="_migrationLedger_1hoev_230",nt="_migrationLedgerItem_1hoev_237",ot="_migrationLedgerBlocked_1hoev_262",at="_migrationSection_1hoev_266",it="_migrationList_1hoev_280",rt="_migrationRow_1hoev_292",ct="_migrationOperation_1hoev_305",lt="_migrationRowBody_1hoev_310",dt="_migrationNotice_1hoev_331",pt="_migrationActions_1hoev_340",yt="_migrationButton_1hoev_346",ut="_migrationError_1hoev_353",gt="_migrationDisclosure_1hoev_354",ht="_migrationPagination_1hoev_356",mt="_migrationProgressHeading_1hoev_356",ft="_migrationProgressMeta_1hoev_356",_t="_migrationProgress_1hoev_356",St="_policySummary_1hoev_403",vt="_policySummaryItem_1hoev_414",xt="_policyPrimaryValue_1hoev_439",jt="_policyReviewNotice_1hoev_445",wt="_policyApplySection_1hoev_456",Nt="_policyApplyHeader_1hoev_460",bt="_policyApplyTitle_1hoev_464",It="_policyApplyDescription_1hoev_472",Rt="_policyInfoLabel_1hoev_480",kt="_policySafetyRow_1hoev_491",Pt="_policySafetyLabel_1hoev_503",Dt="_policySafetyBadge_1hoev_509",Ct="_policyDisclosure_1hoev_513",Et="_policyDisclosureIcon_1hoev_545",Lt="_policyDisclosureIconOpen_1hoev_552",Tt="_policyScopeList_1hoev_556",At="_policyScopeRow_1hoev_563",Bt="_policyScopeName_1hoev_577",Mt="_policyDirectionRail_1hoev_589",Ft="_policyDirectionEndpoint_1hoev_605",Ot="_policyDirectionEndpointStudio_1hoev_612",$t="_policyDirectionArrow_1hoev_616",Ht="_forwardBadge_1hoev_659",Ut="_logContainer_1hoev_674",qt="_logEntry_1hoev_681",Vt="_logTime_1hoev_693",Wt="_logType_1hoev_699",Gt="_logTypeWrite_1hoev_708",Kt="_logTypeUpdate_1hoev_712",Yt="_logTypeDelete_1hoev_716",zt="_logTypeIdle_1hoev_720",Xt="_logPath_1hoev_724",Zt="_logEmpty_1hoev_731",s={page:ke,detailsStack:Pe,refreshButton:De,targetRow:Ce,storedRow:Ee,storedDisclosure:Le,targetList:Te,storedList:Ae,targetRowSelected:Be,targetIdentity:Me,targetStudio:Fe,targetState:Oe,stateNote:$e,selectedScope:He,sharedNote:Ue,emptyMessage:qe,errorMessage:Ve,card:We,cardHeader:Ge,clearButton:Ke,statusRow:Ye,metaItem:ze,statusGrid:Xe,forwardStatusReason:Ze,migrationPanel:Je,migrationHeader:Qe,migrationTitle:et,migrationDescription:tt,migrationLedger:st,migrationLedgerItem:nt,migrationLedgerBlocked:ot,migrationSection:at,migrationList:it,migrationRow:rt,migrationOperation:ct,migrationRowBody:lt,migrationNotice:dt,migrationActions:pt,migrationButton:yt,migrationError:ut,migrationDisclosure:gt,migrationPagination:ht,migrationProgressHeading:mt,migrationProgressMeta:ft,migrationProgress:_t,policySummary:St,policySummaryItem:vt,policyPrimaryValue:xt,policyReviewNotice:jt,policyApplySection:wt,policyApplyHeader:Nt,policyApplyTitle:bt,policyApplyDescription:It,policyInfoLabel:Rt,policySafetyRow:kt,policySafetyLabel:Pt,policySafetyBadge:Dt,policyDisclosure:Ct,policyDisclosureIcon:Et,policyDisclosureIconOpen:Lt,policyScopeList:Tt,policyScopeRow:At,policyScopeName:Bt,policyDirectionRail:Mt,policyDirectionEndpoint:Ft,policyDirectionEndpointStudio:Ot,policyDirectionArrow:$t,forwardBadge:Ht,logContainer:Ut,logEntry:qt,logTime:Vt,logType:Wt,logTypeWrite:Gt,logTypeUpdate:Kt,logTypeDelete:Yt,logTypeIdle:zt,logPath:Xt,logEmpty:Zt},ae=50;function Jt(t){return t==="add"?"success":t==="delete"?"danger":"accent"}function re({title:t,items:a,renderItem:_}){const{t:i}=ie(),d=l.useId(),n=l.useRef(null),[N,R]=l.useState(!1),[D,j]=l.useState(0),b=Math.max(0,Math.ceil(a.length/ae)-1),g=Math.min(D,b),C=g*ae,u=Math.min(C+ae,a.length),A=E=>{var p,y;j(E),(y=(p=n.current)==null?void 0:p.scrollTo)==null||y.call(p,{top:0})};return e.jsxs("div",{className:s.migrationSection,children:[e.jsxs(J,{variant:"ghost",className:s.migrationDisclosure,"aria-expanded":N,"aria-controls":d,onClick:()=>R(!N),children:[e.jsxs("span",{children:[t," (",a.length.toLocaleString(),")"]}),e.jsx("span",{"aria-hidden":"true",children:N?"−":"+"})]}),e.jsx("div",{id:d,hidden:!N,children:N&&e.jsxs("div",{children:[e.jsx("ul",{ref:n,className:s.migrationList,tabIndex:0,"aria-label":t,children:a.slice(C,u).map((E,p)=>_(E,C+p))}),e.jsxs("div",{className:s.migrationPagination,children:[e.jsxs("span",{children:[C+1,"–",u," / ",a.length.toLocaleString()]}),b>0&&e.jsxs("div",{children:[e.jsx(J,{variant:"secondary",disabled:g===0,onClick:()=>A(g-1),children:i("sync.migration.previous","Previous")}),e.jsx(J,{variant:"secondary",disabled:g===b,onClick:()=>A(g+1),children:i("sync.migration.next","Next")})]})]})]},g)})]})}function Qt({migration:t,onRefresh:a,onApply:_}){const{t:i}=ie(),[d,n]=l.useState(!1),[N,R]=l.useState(0),D=l.useRef(null),j=!!(t!=null&&t.loading||t!=null&&t.applying),b=t==null?void 0:t.progress,g=(b==null?void 0:b.status)==="running"&&b.operation===(t!=null&&t.applying?"apply":"preview")?b:null,C=g==null?void 0:g.startedAt;l.useEffect(()=>{if(!j){R(0);return}const c=C?Date.parse(C):Date.now(),h=()=>R(Math.max(0,Math.floor((Date.now()-c)/1e3)));h();const L=setInterval(h,1e3);return()=>clearInterval(L)},[j,C]);const u=t==null?void 0:t.report;if(!t||(u==null?void 0:u.status)==="not_required"||!u&&!j&&!t.error)return null;const A=(u==null?void 0:u.status)==="blocked",E=(u==null?void 0:u.status)==="ready"&&!j,p=()=>{n(!1),_(),requestAnimationFrame(()=>{var c;return(c=D.current)==null?void 0:c.focus()})},y=[...new Set((u==null?void 0:u.blockers.map(c=>c.reason))??[])];return e.jsxs("section",{ref:D,tabIndex:-1,className:`${s.card} ${s.migrationPanel}`,"aria-labelledby":"sync-migration-title",children:[e.jsxs("div",{className:s.migrationHeader,children:[e.jsxs("div",{children:[e.jsx("h2",{id:"sync-migration-title",className:s.migrationTitle,children:u?i("sync.migration.title","Sync format update available"):i("sync.migration.checking","Checking sync format")}),e.jsx("p",{className:s.migrationDescription,children:i("sync.migration.description","Review the metadata changes before updating this place from sync format v2 to v3.")})]}),u&&e.jsx(H,{variant:A?"warning":"accent",children:j?t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.refreshing","Refreshing…"):A?i("sync.migration.status.blocked","Blocked"):i("sync.migration.status.ready","Ready to review")})]}),u&&e.jsx("div",{className:s.migrationLedger,"aria-label":i("sync.migration.preview","Review changes"),children:["add","modify","delete","blocked"].map(c=>e.jsxs("div",{className:`${s.migrationLedgerItem} ${c==="blocked"&&A?s.migrationLedgerBlocked:""}`,children:[e.jsx("span",{children:i(`sync.migration.summary.${c}`,c)}),e.jsx("strong",{children:u.summary[c].toLocaleString()})]},c))}),j&&e.jsxs("div",{className:s.migrationProgress,children:[e.jsxs("div",{role:"status",className:s.migrationProgressHeading,children:[e.jsx("span",{children:t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.refreshing","Refreshing…")}),g&&e.jsx("span",{children:i(`sync.migration.phase.${g.phase}`,g.phase)})]}),e.jsx("progress",{"aria-label":i("sync.migration.progress","Update progress"),...g!=null&&g.total&&g.total>0?{value:g.completed,max:g.total}:{}}),e.jsxs("div",{className:s.migrationProgressMeta,children:[e.jsx("span",{"aria-live":"off",children:i("sync.migration.elapsed","Elapsed {seconds}s").replace("{seconds}",String(N))}),(g==null?void 0:g.total)!==null&&(g==null?void 0:g.total)!==void 0&&e.jsxs("span",{children:[g.completed.toLocaleString()," / ",g.total.toLocaleString()]})]}),e.jsx("p",{children:i("sync.migration.wait","Large places can take a while. You can keep browsing while this runs.")})]}),e.jsxs("div",{className:s.migrationNotice,"aria-live":"polite",children:[(A||t.error==="migration_blocked")&&e.jsx("span",{children:i("sync.migration.blocked","Resolve sync conflicts before updating")}),y.map(c=>e.jsx("span",{children:i(`sync.migration.reason.${c}`,c.replace(/_/g," "))},c)),t.error==="preview_stale"&&e.jsx("span",{children:i("sync.migration.stale","Preview changed. Review the latest diff.")}),t.error==="migration_in_progress"&&e.jsx("span",{children:i("sync.migration.inProgress","An update is already running for this place. Wait, then refresh the preview.")}),t.error==="unknown"&&e.jsx("span",{className:s.migrationError,children:i("sync.migration.error","Could not update the sync format. Try again.")})]}),e.jsxs("div",{className:s.migrationActions,children:[e.jsx(J,{variant:"secondary",className:s.migrationButton,disabled:j,onClick:()=>void a(),children:t.loading?i("sync.migration.refreshing","Refreshing…"):i("sync.migration.refresh","Refresh preview")}),u&&e.jsx(J,{variant:"primary",className:s.migrationButton,disabled:!E,onClick:()=>n(!0),children:t.applying?i("sync.migration.applying","Applying…"):i("sync.migration.apply","Apply update")})]}),u&&u.changes.length>0&&e.jsx(re,{title:i("sync.migration.changes","Metadata changes"),items:u.changes,renderItem:c=>e.jsxs("li",{className:s.migrationRow,children:[e.jsx(H,{variant:Jt(c.operation),className:s.migrationOperation,children:i(`sync.migration.operation.${c.operation}`,c.operation)}),e.jsxs("div",{className:s.migrationRowBody,children:[e.jsx("code",{children:c.path}),e.jsx("span",{children:i(`sync.migration.reason.${c.reason}`,c.reason.replace(/_/g," "))})]})]},`${c.operation}:${c.path}`)}),u&&u.blockers.length>0&&e.jsx(re,{title:i("sync.migration.blockers","Items to resolve"),items:u.blockers,renderItem:(c,h)=>e.jsxs("li",{className:s.migrationRow,children:[e.jsx(H,{variant:"warning",className:s.migrationOperation,children:i("sync.migration.summary.blocked","Blocked")}),e.jsxs("div",{className:s.migrationRowBody,children:[c.path&&e.jsx("code",{children:c.path}),e.jsx("span",{children:i(`sync.migration.reason.${c.reason}`,c.reason.replace(/_/g," "))})]})]},`${c.reason}:${c.path??h}`)}),e.jsx(pe,{open:d,title:i("sync.migration.confirm.title","Apply sync format update?"),message:i("sync.migration.confirm.message","Back up and update the listed sync metadata. Your Luau source files will not change."),cancelLabel:i("common.cancel","Cancel"),confirmLabel:i("sync.migration.apply","Apply update"),onCancel:()=>n(!1),onConfirm:p})]})}const es=["scriptSource","properties","structure","serviceProperties"];function ts(t){const a=new Date(t);return`${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}function ss(t){switch(t){case"fullSyncComplete":case"write":return s.logTypeWrite;case"fullSyncStart":case"fullSyncProgress":case"update":return s.logTypeUpdate;case"fullSyncFailed":case"delete":return s.logTypeDelete;default:return s.logTypeIdle}}const ce={unknown:"neutral",off:"neutral",idle:"neutral",initializing:"info",syncing:"success",paused:"warning",error:"error"},le={unknown:"Unknown",off:"Sync OFF",idle:"Waiting",initializing:"Initializing",syncing:"Syncing",paused:"Paused",error:"Error"},ns={inactive:"Change sending off",active:"Change sending enabled",paused_play:"Paused for Play",reconciling:"Checking Edit changes",blocked:"Changes need attention",unknown:"Sending status unknown"},os={inactive:"neutral",active:"success",paused_play:"warning",reconciling:"info",blocked:"error",unknown:"neutral"};function as(t,a){switch(a){case"conflict_review":case"manual_review":return t("sync.forwardStatus.reason.review","Review changes in the Studio Plugin.");case"edit_changed_during_reconciliation":return t("sync.forwardStatus.reason.editChanged","Edit changed during the check. Inspect Sync in the Studio Plugin.");case"pre_check_failed":case"reverse_apply_failed":case"reconciliation_failed":case"sync_error":case"update_failed":case"acknowledgement_missing":case"ACK_EXPIRED":case"ACK_ID_REUSED":case"SYNC_DIRECTION_REVERSE":return t("sync.forwardStatus.reason.failed","Changes could not be confirmed. Inspect Sync in the Studio Plugin.");default:return t("sync.forwardStatus.reason.fallback","Check the Studio Plugin for details.")}}function is(t,a){const _={studio_first:"Studio First",bidirectional_review:"Bidirectional",local_code_studio_world:"Local Code, Studio World",custom:"Custom"};return t(`sync.policy.preset.${a}`,_[a])}function de(t,a){return a==="auto"?t("sync.policy.apply.auto","Auto apply"):t("sync.policy.apply.manual","Review first")}function rs(t,a){const _={forward:"Studio → Local",reverse:"Local → Studio",bidirectional:"Both ways"};return t(`sync.policy.direction.${a}`,_[a])}function cs(t){return{forward:"←",reverse:"→",bidirectional:"⇄"}[t]}function ls(t,a){const _={forward:"Studio changes are written to local files.",reverse:"Local file changes are applied to Studio.",bidirectional:"Changes can move from Studio to local files and from local files to Studio."};return t(`sync.policy.direction.${a}.tooltip`,_[a])}function ds(t,a){return a?t("sync.policy.safety.auto","Auto delete to Studio"):t("sync.policy.safety.review","Review before delete")}function ps(t,a){return a?t("sync.policy.safety.auto.tooltip","Deleting local files may automatically remove matching Studio instances. This is separate from UI Studio automatic cleanup."):t("sync.policy.safety.review.tooltip","Local file deletions wait for review before matching Studio instances are removed. This is separate from UI Studio automatic cleanup.")}function ys(t,a){switch(a){case"fullSyncStart":return t("sync.log.type.fullSyncStart","START");case"fullSyncProgress":return t("sync.log.type.fullSyncProgress","PROGRESS");case"fullSyncComplete":return t("sync.log.type.fullSyncComplete","COMPLETE");case"fullSyncFailed":return t("sync.log.type.fullSyncFailed","FAILED");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 us(t,a){switch(a){case"fullSyncStart":return t("sync.log.type.fullSyncStart.tooltip","Full Sync started.");case"fullSyncProgress":return t("sync.log.type.fullSyncProgress.tooltip","Full Sync is saving the snapshot.");case"fullSyncComplete":return t("sync.log.type.fullSyncComplete.tooltip","Full Sync completed successfully.");case"fullSyncFailed":return t("sync.log.type.fullSyncFailed.tooltip","Full Sync ended without completing the snapshot.");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 xs(){var K,Y,v,X,w,V;const{t}=ie(),{trackEvent:a}=_e(),{level:_}=Se(),{tier:i,loading:d}=ve(),n=Re(),{show:N}=xe(),[R,D]=l.useState(null),[j,b]=l.useState(!1),[g,C]=l.useState(!1),[u,A]=l.useState(!1),E=!d&&i==="basic",p=n.selectedTarget,y=p==null?void 0:p.sync,c=(y==null?void 0:y.forwardSyncStatus)??"unknown",h=p?{...p.sync.status,syncEnabled:p.sync.syncEnabled,policy:p.sync.policy,policyCapabilities:p.sync.policyCapabilities,policyReviewRequired:p.sync.policyReviewRequired}:null,L=(p==null?void 0:p.placeName)??((K=n.selectedPlace)==null?void 0:K.placeName)??t("sync.targets.unknownPlace","Unknown place"),G=n.selectedPlaceId===null?L:L+" · "+n.selectedPlaceId,B=n.storageSafe?(h==null?void 0:h.instanceCount)??((Y=n.selectedPlace)==null?void 0:Y.instanceCount):null,U=n.storageSafe?(h==null?void 0:h.scriptCount)??((v=n.selectedPlace)==null?void 0:v.scriptCount):null,q=new Set(n.targets.map(r=>r.placeId)),M=n.places.filter(r=>r.placeId===0||!q.has(r.placeId)),$=e.jsx(we,{title:t("page.sync.title","Sync"),description:t("page.sync.description","Monitor Studio to local sync status, direction, apply mode, and recent sync logs."),helpTopicId:"sync",helpState:{connectionLevel:_,tier:i}}),k=n.history,Q=async()=>{if(R){b(!0);try{await n.clearHistory(R.placeId),N(t("toast.clearSuccess","Cleared successfully"),"success"),D(null)}catch{N(t("toast.clearFailed","Failed to clear data"),"error")}finally{b(!1)}}};return e.jsxs("div",{className:s.page,children:[$,e.jsxs("section",{className:s.card,"aria-label":t("sync.targets.title","Connected Studios"),children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[t("sync.targets.title","Connected Studios")," (",n.targets.length,")"]}),e.jsx("button",{type:"button",className:s.refreshButton,onClick:n.refresh,children:t("sync.targets.refresh","Refresh")})]}),n.loading?e.jsx("p",{className:s.emptyMessage,children:t("sync.targets.loading","Loading Studio Sync status…")}):n.snapshotError?e.jsxs("p",{className:s.errorMessage,role:"alert",children:[t("sync.targets.unavailable","Studio Sync status is unavailable. Retry to check the current state.")," ",n.snapshotError]}):n.targets.length===0?e.jsx("p",{className:s.emptyMessage,children:t("sync.targets.empty","No Studio is connected. Connect the WEPPY Plugin to see live Sync status.")}):e.jsx("div",{className:s.targetList,children:n.targets.map(r=>{var I;const x=((I=n.selection)==null?void 0:I.kind)==="target"&&n.selection.clientId===r.clientId;return e.jsxs("button",{type:"button",className:`${s.targetRow} ${x?s.targetRowSelected:""}`,"aria-pressed":x,onClick:()=>n.selectTarget(r.clientId),children:[e.jsxs("span",{className:s.targetIdentity,children:[e.jsx(O,{text:r.placeName||t("sync.targets.unknownPlace","Unknown place"),children:e.jsx("strong",{children:r.placeName||t("sync.targets.unknownPlace","Unknown place")})}),e.jsxs("span",{children:[t("sync.targets.placeId","Place ID"),": ",r.placeId??"—"]})]}),e.jsxs("span",{className:s.targetStudio,children:[e.jsx(O,{text:r.clientId,children:e.jsxs("span",{children:[t("sync.targets.studioId","Studio ID"),": ",r.targetAlias]})}),e.jsx("span",{children:t("sync.targets.connected","Connected")})]}),e.jsxs("span",{className:s.targetState,children:[e.jsx(H,{variant:ce[r.sync.state],shape:"pill",children:t("sync.targets.state."+r.sync.state,le[r.sync.state])}),r.sync.syncEnabled===null&&e.jsx("span",{className:s.stateNote,children:t("sync.targets.notReported","Not reported yet")})]})]},r.clientId)})})]}),M.length>0&&e.jsxs("section",{className:s.card,"aria-label":t("sync.stored.title","Stored places"),children:[e.jsxs("button",{type:"button",className:s.storedDisclosure,"aria-expanded":u,onClick:()=>A(r=>!r),children:[e.jsxs("span",{children:[t("sync.stored.title","Stored places")," (",M.length,")"]}),e.jsx("span",{"aria-hidden":"true",children:u?"⌃":"⌄"})]}),u&&e.jsx("div",{className:s.storedList,children:M.map(r=>{var ee;const x=oe(n.places,r),I=((ee=n.selection)==null?void 0:ee.kind)==="stored"&&n.selection.placeDirName===r.placeDirName;return e.jsxs("button",{type:"button",className:`${s.storedRow} ${I?s.targetRowSelected:""}`,disabled:!x,"aria-pressed":I,onClick:()=>n.selectStored(r),children:[e.jsxs("span",{children:[r.placeName," · ",r.placeId]}),e.jsx("span",{children:x?t("sync.stored.data","Stored data"):t("sync.stored.ambiguous","Storage location unconfirmed")})]},r.placeDirName)})})]}),n.selection&&!n.snapshotError&&e.jsxs("div",{className:s.selectedScope,children:[e.jsx("span",{children:t("sync.detail.scope","Viewing Sync details for")}),e.jsx("strong",{children:G}),p&&e.jsxs("span",{children:[t("sync.targets.studioId","Studio ID"),": ",p.targetAlias]}),e.jsx("span",{children:t("sync.detail.readOnly","Viewing details does not change Studio routing.")})]}),!n.selection&&!n.loading&&!n.snapshotError&&e.jsx("p",{className:s.emptyMessage,children:t("sync.detail.empty","Select a connected Studio or stored place to view details.")}),n.selection&&!n.snapshotError&&e.jsxs("div",{className:s.detailsStack,children:[e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsx(O,{text:t("sync.status.title.tooltip","Current Studio and local file sync status for this place."),children:t("sync.status.title","Sync Status")}),E&&e.jsx(O,{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:[y?e.jsx(H,{variant:ce[y.state],shape:"pill",children:t("sync.targets.state."+y.state,le[y.state])}):e.jsx(H,{variant:"neutral",shape:"pill",children:t("sync.stored.data","Stored data")}),e.jsx("span",{className:s.metaItem,children:G})]}),(y==null?void 0:y.state)==="unknown"&&e.jsx("p",{className:s.emptyMessage,children:t("sync.detail.unknown","This Studio has not reported its Sync state yet.")}),(y==null?void 0:y.state)==="error"&&e.jsx("p",{className:s.errorMessage,role:"alert",children:t("sync.detail.error","Sync reported an error. Check the Studio Plugin for details.")}),e.jsxs("dl",{className:s.statusGrid,children:[p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.forwardStatus.label","Change sending"),tooltip:t("sync.forwardStatus.tooltip","This reports whether Edit changes can be sent. Enabled does not confirm every local file is current.")})}),e.jsxs("dd",{children:[e.jsx(H,{variant:os[c],shape:"pill",children:t("sync.forwardStatus."+c,ns[c])}),c==="blocked"&&e.jsx("span",{className:s.forwardStatusReason,children:as(t,y==null?void 0:y.forwardSyncReason)})]}),(y==null?void 0:y.forwardSyncObservedAt)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:t("sync.forwardStatus.observedAt","Observed")}),e.jsx("dd",{children:new Date(y.forwardSyncObservedAt).toLocaleString()})]})]}),p&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:t("sync.targets.studioId","Studio ID")}),e.jsx("dd",{children:p.targetAlias}),e.jsx("dt",{children:t("sync.targets.connectionId","Connection ID")}),e.jsx("dd",{children:p.clientId})]}),(h==null?void 0:h.syncRoot)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.status.path","Place Root"),tooltip:t("sync.status.path.tooltip","Local filesystem root currently used for this place sync output.")})}),e.jsx("dd",{children:h.syncRoot})]}),((X=n.selectedPlace)==null?void 0:X.placeDirName)&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{label:t("sync.detail.placeFolder","Place folder"),tooltip:t("sync.detail.placeFolder.tooltip","The stored folder shared by Studios opening this Place.")})}),e.jsx("dd",{children:n.selectedPlace.placeDirName})]}),B!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:B})]}),U!=null&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{children:e.jsx(Z,{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:U})]})]}),e.jsx("p",{className:s.sharedNote,children:t("sync.detail.sharedData","Path, counts, and log belong to the Place and are shared by Studios opening it.")})]}),n.storageSafe&&e.jsx(Qt,{migration:n.migration,onRefresh:n.refreshMigration,onApply:n.applyMigration},[n.selection.kind==="target"?n.selection.clientId:n.selection.placeDirName,n.selectedPlaceId,(V=(w=n.migration)==null?void 0:w.report)==null?void 0:V.previewFingerprint].join(":")),(h==null?void 0:h.policy)&&e.jsxs("div",{className:s.card,children:[e.jsx("div",{className:s.cardHeader,children:e.jsx(O,{text:t("sync.policy.title.tooltip","Effective Sync policy reported by the connected Studio plugin."),children:t("sync.policy.title","Sync Policy")})}),e.jsxs("dl",{className:s.policySummary,children:[e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.activation","Activation")}),e.jsx("dd",{children:e.jsx(H,{variant:h.syncEnabled?"success":"neutral",children:h.syncEnabled?t("sync.policy.activation.on","Sync ON"):t("sync.policy.activation.off","Sync OFF")})})]}),e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:t("sync.policy.preset","Workflow")}),e.jsx("dd",{className:s.policyPrimaryValue,children:is(t,h.policy.preset)})]})]}),h.policyReviewRequired&&e.jsx("div",{className:s.policyReviewNotice,role:"status",children:t("sync.policy.reviewRequired","Review this policy in the Studio plugin before starting Sync.")}),e.jsxs("section",{className:s.policyApplySection,"aria-labelledby":"sync-policy-apply-title",children:[e.jsxs("div",{className:s.policyApplyHeader,children:[e.jsx("h3",{id:"sync-policy-apply-title",className:s.policyApplyTitle,children:t("sync.policy.apply.title","How local changes apply to Studio")}),e.jsx("p",{className:s.policyApplyDescription,children:t("sync.policy.apply.description","Shows whether changes made locally are reviewed first or applied to Studio automatically.")})]}),e.jsxs("dl",{className:s.policySummary,children:[e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(O,{text:t("sync.policy.apply.content.tooltip","Script Source, property, and Service property changes made locally. Instance creation, deletion, renaming, and moves are Structure changes."),children:e.jsx("span",{className:s.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.content","Content changes")})})}),e.jsx("dd",{children:de(t,h.policy.apply.contentChanges)})]}),e.jsxs("div",{className:s.policySummaryItem,children:[e.jsx("dt",{children:e.jsx(O,{text:t("sync.policy.apply.structure.tooltip","Instance creation, deletion, renaming, and moves made locally. Automatic local deletion additionally requires the separate delete option below."),children:e.jsx("span",{className:s.policyInfoLabel,tabIndex:0,children:t("sync.policy.apply.structure","Structure changes")})})}),e.jsx("dd",{children:de(t,h.policy.apply.structureChanges)})]})]}),e.jsxs("div",{className:s.policySafetyRow,children:[e.jsx("span",{className:s.policySafetyLabel,children:t("sync.policy.safety.localDeletes","Local delete → Studio instance removal")}),e.jsx(O,{text:ps(t,h.policy.autoApplyLocalDeletesToStudio),children:e.jsx(H,{variant:h.policy.autoApplyLocalDeletesToStudio?"warning":"neutral",className:s.policySafetyBadge,tabIndex:0,children:ds(t,h.policy.autoApplyLocalDeletesToStudio)})})]})]}),e.jsxs("button",{type:"button",className:s.policyDisclosure,"aria-expanded":g,"aria-controls":"sync-policy-scope-panel",onClick:()=>C(r=>!r),children:[e.jsx("span",{children:t("sync.policy.scope.disclosure","Scope directions")}),e.jsx("span",{"aria-hidden":"true",className:`${s.policyDisclosureIcon} ${g?s.policyDisclosureIconOpen:""}`,children:"⌄"})]}),g&&e.jsx("div",{id:"sync-policy-scope-panel",className:s.policyScopeList,children:es.map(r=>{const x=h.policy.directions[r];return e.jsxs("div",{className:s.policyScopeRow,"data-testid":"sync-policy-scope-row",children:[e.jsx("span",{className:s.policyScopeName,children:t(`sync.policy.scope.${r}`,r)}),e.jsx(O,{text:ls(t,x),children:e.jsxs("span",{className:s.policyDirectionRail,"data-testid":"sync-policy-direction-rail",role:"img","aria-label":rs(t,x),tabIndex:0,children:[e.jsx("span",{className:s.policyDirectionEndpoint,children:t("sync.policy.endpoint.local","Local")}),e.jsx("span",{className:s.policyDirectionArrow,"aria-hidden":"true",children:cs(x)}),e.jsx("span",{className:`${s.policyDirectionEndpoint} ${s.policyDirectionEndpointStudio}`,children:t("sync.policy.endpoint.studio","Studio")})]})})]},r)})})]}),e.jsxs("div",{className:s.card,children:[e.jsxs("div",{className:s.cardHeader,children:[e.jsxs("span",{children:[t("sync.log.title","Sync Log")," · ",t("sync.log.shared","Shared Place log")]}),e.jsx("button",{className:s.clearButton,type:"button",disabled:!n.storageSafe||n.selectedPlaceId===null,onClick:()=>{n.selectedPlaceId!==null&&(a("dashboard_click_event",{click_target:"sync_clear_log",page:"sync"}),D({placeId:n.selectedPlaceId,label:G}))},children:t("common.clear","Clear")})]}),e.jsx("div",{className:s.logContainer,children:n.storageSafe?n.historyError?e.jsxs("div",{className:s.errorMessage,role:"alert",children:[t("sync.log.unavailable","The Place log could not be loaded. Retry to check it.")," ",n.historyError]}):n.historyLoading&&k.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.loading","Loading Place log…")}):k.length===0?e.jsx("div",{className:s.logEmpty,children:t("sync.log.empty","No sync events yet")}):k.map((r,x)=>e.jsxs("div",{className:s.logEntry,children:[e.jsx("span",{className:s.logTime,children:ts(r.timestamp)}),e.jsx(O,{text:us(t,r.type),children:e.jsx("span",{className:`${s.logType} ${ss(r.type)}`,children:ys(t,r.type)})}),e.jsxs("span",{className:s.logPath,children:[r.path,r.details?` — ${r.details}`:""]})]},x)):e.jsx("div",{className:s.logEmpty,children:t("sync.log.unsafe","This Place has no confirmed storage location for log access.")})})]}),E&&e.jsx(Ne,{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:je.sync})]}),e.jsx(pe,{open:R!==null,title:t("sync.clear.title","Clear sync log?"),message:t("sync.clear.selectedMessage","This permanently removes the shared Sync log for {place}.").replace("{place}",(R==null?void 0:R.label)??""),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:j,onCancel:()=>!j&&D(null),onConfirm:Q})]})}export{xs as Component};
@@ -1 +1 @@
1
- import{u as W,r as f,j as a,C as O,G as U,g as z,w as G,p as V,q as k,t as A}from"./index-CJYQedSN.js";import{B as w}from"./PageHeader-DfhSm4j-.js";import{P as Y,a as H}from"./PlaceSelectOptions-CMtQalSy.js";const Q="_scope_1i8qy_1",J="_main_1i8qy_13",X="_label_1i8qy_22",Z="_selectorLabel_1i8qy_30",ee="_placeSelect_1i8qy_38",ce="_name_1i8qy_54",le="_id_1i8qy_65",ae="_scopeBadge_1i8qy_72",te="_copy_1i8qy_76",ne="_note_1i8qy_88",se="_folderDetails_1i8qy_92",oe="_shortcuts_1i8qy_96",re="_shortcutsTrigger_1i8qy_103",ie="_shortcutLink_1i8qy_126",pe="_shortcutsPopover_1i8qy_131",o={scope:Q,main:J,label:X,selectorLabel:Z,placeSelect:ee,name:ce,id:le,scopeBadge:ae,copy:te,note:ne,folderDetails:se,shortcuts:oe,shortcutsTrigger:re,shortcutLink:ie,shortcutsPopover:pe};function R(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function h(e,c){return V(e.places,c)}function M(e){var c;return e.lastActivePlaceId!==null?e.lastActivePlaceId:((c=e.places[0])==null?void 0:c.placeId)??null}function L(e){var c;if(e.pluginConnected&&e.activePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.activePlaceId);if(h(e,e.activePlaceId)||l.length===0)return e.activePlaceId}if(e.lastActivePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.lastActivePlaceId);if(h(e,e.lastActivePlaceId)||l.length===0)return e.lastActivePlaceId}return((c=G(e.places))==null?void 0:c.placeId)??null}function de(e,c,l){var n;return c?((n=h(e,typeof l=="number"?l:null))==null?void 0:n.placeId)??L(e):e.pluginConnected&&e.activePlaceId!==null?e.activePlaceId:M(e)}function D(e,c){const l=h(e,c);return(l==null?void 0:l.universeId)!==void 0?l.universeId:c===e.activePlaceId?e.activeUniverseId??null:c===e.lastActivePlaceId?e.lastActiveUniverseId??null:null}function ue(e,c,l){if(!R(e))return[];const n=[];return R(c)&&n.push({label:l("placeScope.shortcuts.settings","Place settings"),href:`https://create.roblox.com/dashboard/creations/experiences/${c}/places/${e}/configure`},{label:l("placeScope.shortcuts.experience","Experience management"),href:`https://create.roblox.com/dashboard/creations/experiences/${c}/overview`}),n.push({label:l("placeScope.shortcuts.roblox","View on Roblox"),href:`https://www.roblox.com/games/${e}`}),n}function fe(e,c){if(e.pluginConnected&&e.activePlaceId!==null){const s=h(e,e.activePlaceId),t=s?k(e.places,s.placeId):!1,i=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(e.activePlaceId));return{label:c("placeScope.current.label","Current Place"),placeId:e.activePlaceId,placeName:e.activePlaceName??(t?i:s==null?void 0:s.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.connected","Studio connected"),connected:(s==null?void 0:s.isConnected)??!0,folderUnresolved:t,hasSyncMetadata:s?A(e.places,s):void 0,note:null}}const l=M(e),n=h(e,l);if(l!==null){const s=l===e.lastActivePlaceId?e.lastActivePlaceName:null,t=n?k(e.places,n.placeId):!1,i=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(l));return{label:c("placeScope.lastActive.label","Last Active Place"),placeId:l,placeName:s??(t?i:n==null?void 0:n.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.stored","Stored data"),connected:!1,folderUnresolved:t,hasSyncMetadata:n?A(e.places,n):void 0,note:c("placeScope.stored.note","No connected Studio currently has this place open.")}}return{label:c("placeScope.noPlace.label","Place scope"),placeId:null,placeName:c("placeScope.noPlace.value","No place data available yet"),badge:c("placeScope.noPlace.badge","No place"),connected:!1,folderUnresolved:!1,hasSyncMetadata:void 0,note:c("placeScope.noPlace.note","Connect WEPPY Plugin and sync a place to create place-scoped data.")}}function ve(e,c,l){const n=typeof c=="number"?h(e,c):null,s=L(e),t=(n==null?void 0:n.placeId)??s,i=h(e,t);if(t===null)return{label:l("placeScope.noPlace.label","Place scope"),placeId:null,placeName:l("placeScope.noPlace.value","No place data available yet"),badge:l("placeScope.noPlace.badge","No place"),connected:!1,folderUnresolved:!1,hasSyncMetadata:void 0,note:l("placeScope.noPlace.note","Connect WEPPY Plugin and sync a place to create place-scoped data.")};const b=(i==null?void 0:i.isConnected)??!1,u=e.activePlaceId===t,d=t===e.lastActivePlaceId?e.lastActivePlaceName:null,v=u?e.activePlaceName:null,P=i?k(e.places,i.placeId):!1,_=l("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(t));return{label:u?l("placeScope.current.label","Current Place"):l("placeScope.selected.label","Selected Place"),placeId:t,placeName:v??d??(P?_:i==null?void 0:i.placeName)??l("placeScope.unknownPlace","Unknown place"),badge:b?l("placeScope.connected","Studio connected"):l("placeScope.stored","Stored data"),connected:b,folderUnresolved:P,hasSyncMetadata:i?A(e.places,i):void 0,note:b?null:l("placeScope.stored.note","No connected Studio currently has this place open.")}}function he(e,c){switch(e){case"sync":return c("placeScope.surface.sync","Sync status and logs use this place.");case"changelog":return c("placeScope.surface.changelog","Changelog sessions use this place.");case"playtest":return c("placeScope.surface.playtest","Playtest reports use this place.");case"uiStudio":return c("placeScope.surface.uiStudio","UI captures and change history use this place.");case"tools":return c("placeScope.surface.tools","Tool history and statistics use this place.")}}function je({surface:e,selectable:c=!1,selectedPlaceId:l=null,onSelectedPlaceIdChange:n}){const{t:s}=W(),[t,i]=f.useState(null),[b,u]=f.useState(!0),[d,v]=f.useState(null),P=f.useRef(null),_=f.useRef(null),B=f.useId();f.useEffect(()=>{let r=!1;async function S(){try{const x=await z();r||i(x)}catch{r||i(null)}finally{r||u(!1)}}return S(),()=>{r=!0}},[]),f.useEffect(()=>{if(!c||!t)return;const r=L(t);(typeof l!="number"||!h(t,l))&&l!==r&&(n==null||n(r))},[n,c,l,t]);const E=t?de(t,c,l):null,m=t?D(t,E):null,j=`${E??"none"}:${m??"none"}`;if(f.useEffect(()=>{v(r=>r===j?r:null)},[j]),f.useEffect(()=>{function r(){v(null)}function S(I){var g;d!==null&&!((g=P.current)!=null&&g.contains(I.target))&&r()}function x(I){var g;d!==null&&I.key==="Escape"&&(I.preventDefault(),r(),(g=_.current)==null||g.focus())}return document.addEventListener("pointerdown",S),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",x)}},[d]),b)return a.jsx("div",{className:o.scope,"aria-live":"polite",children:a.jsx("span",{className:o.label,children:s("placeScope.loading","Loading place scope...")})});if(!t)return a.jsx("div",{className:o.scope,"aria-live":"polite",children:a.jsx("span",{className:o.label,children:s("placeScope.unavailable","Place scope unavailable")})});const p=c?ve(t,l,s):fe(t,s),$=O(t),C=typeof p.placeId=="number"?String(p.placeId):"",F=c&&t.places.length>0,K=D(t,p.placeId),q=ue(p.placeId,K,s),T=j,y=d===T;return a.jsxs("div",{className:o.scope,"aria-live":"polite",children:[a.jsxs("div",{className:o.main,children:[F?a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:o.selectorLabel,children:[a.jsx("span",{className:o.label,children:s("placeScope.selector.label","Place data")}),a.jsxs("select",{className:o.placeSelect,value:C,onChange:r=>{const S=Number.parseInt(r.currentTarget.value,10);v(null),n==null||n(Number.isInteger(S)?S:null)},children:[p.placeId===null?a.jsx("option",{value:"",disabled:!0,children:s("placeScope.selector.noneSelectable","No selectable Place folder")}):null,a.jsx(Y,{places:t.places,confirmedNames:$,t:s})]})]}),a.jsx("span",{className:o.label,children:p.label}),a.jsx("span",{className:o.name,children:p.placeName})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:o.label,children:p.label}),a.jsx("span",{className:o.name,children:p.placeName})]}),p.placeId!==null?a.jsx("span",{className:o.id,children:p.placeId}):null,a.jsx(w,{variant:p.connected?"success":"neutral",shape:"pill",className:o.scopeBadge,children:p.badge}),p.folderUnresolved?a.jsx(w,{variant:"neutral",shape:"pill",className:o.scopeBadge,children:s("placeScope.folder.unresolved","Representative folder unconfirmed")}):null,p.hasSyncMetadata===!1?a.jsx(w,{variant:"neutral",shape:"pill",className:o.scopeBadge,children:s("placeScope.folder.noSyncHistory","No sync history")}):null]}),a.jsxs("div",{className:o.copy,children:[a.jsx("span",{children:he(e,s)}),p.note?a.jsx("span",{className:o.note,children:p.note}):null]}),t.places.some(r=>U(r)==="duplicate"||U(r)==="unresolved")?a.jsx("div",{className:o.folderDetails,children:a.jsx(H,{places:t.places,t:s})}):null,q.length>0?a.jsxs("div",{className:o.shortcuts,ref:P,children:[a.jsxs("button",{ref:_,type:"button",className:o.shortcutsTrigger,"aria-controls":B,"aria-expanded":y,onClick:()=>{v(y?null:T)},children:[s("placeScope.shortcuts.trigger","Quick links"),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),y?a.jsx("div",{id:B,className:o.shortcutsPopover,role:"group","aria-label":s("placeScope.shortcuts.label","Place shortcuts"),children:q.map(r=>a.jsxs("a",{className:o.shortcutLink,href:r.href,target:"_blank",rel:"noopener noreferrer",children:[a.jsx("span",{children:r.label}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]},r.href))}):null]}):null]})}const be="_tabBar_jefog_2",Se="_tabs_jefog_9",Pe="_actions_jefog_14",ge="_tab_jefog_2",Ne="_tabActive_jefog_52",N={tabBar:be,tabs:Se,actions:Pe,tab:ge,tabActive:Ne};function ye({items:e,value:c,onChange:l,ariaLabel:n,className:s,rightActions:t}){const i=f.useRef(null),b=f.useRef(null);return f.useEffect(()=>{const u=()=>{const d=i.current,v=b.current;!d||!v||typeof d.scrollTo!="function"||d.scrollTo({left:Math.max(0,v.offsetLeft+v.offsetWidth/2-d.clientWidth/2),behavior:"auto"})};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[c]),a.jsxs("div",{ref:i,className:[N.tabBar,s].filter(Boolean).join(" "),role:"tablist","aria-label":n,children:[a.jsx("div",{className:N.tabs,children:e.map(u=>{const d=u.key===c;return a.jsx("button",{ref:d?b:void 0,type:"button",role:"tab","aria-selected":d,"data-testid":u.testId,className:[N.tab,d?N.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(u.key),children:u.label},u.key)})}),t?a.jsx("div",{className:N.actions,children:t}):null]})}export{je as C,ye as T};
1
+ import{u as W,r as f,j as a,G as O,J as U,g as z,w as G,p as V,q as k,t as A}from"./index-B-46k2zD.js";import{B as w}from"./PageHeader-C7zSPJ0K.js";import{P as Y,a as H}from"./PlaceSelectOptions-e39l4_SC.js";const J="_scope_1i8qy_1",Q="_main_1i8qy_13",X="_label_1i8qy_22",Z="_selectorLabel_1i8qy_30",ee="_placeSelect_1i8qy_38",ce="_name_1i8qy_54",le="_id_1i8qy_65",ae="_scopeBadge_1i8qy_72",te="_copy_1i8qy_76",ne="_note_1i8qy_88",se="_folderDetails_1i8qy_92",oe="_shortcuts_1i8qy_96",re="_shortcutsTrigger_1i8qy_103",ie="_shortcutLink_1i8qy_126",pe="_shortcutsPopover_1i8qy_131",o={scope:J,main:Q,label:X,selectorLabel:Z,placeSelect:ee,name:ce,id:le,scopeBadge:ae,copy:te,note:ne,folderDetails:se,shortcuts:oe,shortcutsTrigger:re,shortcutLink:ie,shortcutsPopover:pe};function R(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0}function h(e,c){return V(e.places,c)}function M(e){var c;return e.lastActivePlaceId!==null?e.lastActivePlaceId:((c=e.places[0])==null?void 0:c.placeId)??null}function L(e){var c;if(e.pluginConnected&&e.activePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.activePlaceId);if(h(e,e.activePlaceId)||l.length===0)return e.activePlaceId}if(e.lastActivePlaceId!==null){const l=e.places.filter(n=>n.placeId===e.lastActivePlaceId);if(h(e,e.lastActivePlaceId)||l.length===0)return e.lastActivePlaceId}return((c=G(e.places))==null?void 0:c.placeId)??null}function de(e,c,l){var n;return c?((n=h(e,typeof l=="number"?l:null))==null?void 0:n.placeId)??L(e):e.pluginConnected&&e.activePlaceId!==null?e.activePlaceId:M(e)}function D(e,c){const l=h(e,c);return(l==null?void 0:l.universeId)!==void 0?l.universeId:c===e.activePlaceId?e.activeUniverseId??null:c===e.lastActivePlaceId?e.lastActiveUniverseId??null:null}function ue(e,c,l){if(!R(e))return[];const n=[];return R(c)&&n.push({label:l("placeScope.shortcuts.settings","Place settings"),href:`https://create.roblox.com/dashboard/creations/experiences/${c}/places/${e}/configure`},{label:l("placeScope.shortcuts.experience","Experience management"),href:`https://create.roblox.com/dashboard/creations/experiences/${c}/overview`}),n.push({label:l("placeScope.shortcuts.roblox","View on Roblox"),href:`https://www.roblox.com/games/${e}`}),n}function fe(e,c){if(e.pluginConnected&&e.activePlaceId!==null){const s=h(e,e.activePlaceId),t=s?k(e.places,s.placeId):!1,i=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(e.activePlaceId));return{label:c("placeScope.current.label","Current Place"),placeId:e.activePlaceId,placeName:e.activePlaceName??(t?i:s==null?void 0:s.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.connected","Studio connected"),connected:(s==null?void 0:s.isConnected)??!0,folderUnresolved:t,hasSyncMetadata:s?A(e.places,s):void 0,note:null}}const l=M(e),n=h(e,l);if(l!==null){const s=l===e.lastActivePlaceId?e.lastActivePlaceName:null,t=n?k(e.places,n.placeId):!1,i=c("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(l));return{label:c("placeScope.lastActive.label","Last Active Place"),placeId:l,placeName:s??(t?i:n==null?void 0:n.placeName)??c("placeScope.unknownPlace","Unknown place"),badge:c("placeScope.stored","Stored data"),connected:!1,folderUnresolved:t,hasSyncMetadata:n?A(e.places,n):void 0,note:c("placeScope.stored.note","No connected Studio currently has this place open.")}}return{label:c("placeScope.noPlace.label","Place scope"),placeId:null,placeName:c("placeScope.noPlace.value","No place data available yet"),badge:c("placeScope.noPlace.badge","No place"),connected:!1,folderUnresolved:!1,hasSyncMetadata:void 0,note:c("placeScope.noPlace.note","Connect WEPPY Plugin and sync a place to create place-scoped data.")}}function ve(e,c,l){const n=typeof c=="number"?h(e,c):null,s=L(e),t=(n==null?void 0:n.placeId)??s,i=h(e,t);if(t===null)return{label:l("placeScope.noPlace.label","Place scope"),placeId:null,placeName:l("placeScope.noPlace.value","No place data available yet"),badge:l("placeScope.noPlace.badge","No place"),connected:!1,folderUnresolved:!1,hasSyncMetadata:void 0,note:l("placeScope.noPlace.note","Connect WEPPY Plugin and sync a place to create place-scoped data.")};const b=(i==null?void 0:i.isConnected)??!1,u=e.activePlaceId===t,d=t===e.lastActivePlaceId?e.lastActivePlaceName:null,v=u?e.activePlaceName:null,P=i?k(e.places,i.placeId):!1,_=l("placeScope.folder.unresolvedPlace","Place {placeId}").replace("{placeId}",String(t));return{label:u?l("placeScope.current.label","Current Place"):l("placeScope.selected.label","Selected Place"),placeId:t,placeName:v??d??(P?_:i==null?void 0:i.placeName)??l("placeScope.unknownPlace","Unknown place"),badge:b?l("placeScope.connected","Studio connected"):l("placeScope.stored","Stored data"),connected:b,folderUnresolved:P,hasSyncMetadata:i?A(e.places,i):void 0,note:b?null:l("placeScope.stored.note","No connected Studio currently has this place open.")}}function he(e,c){switch(e){case"sync":return c("placeScope.surface.sync","Sync status and logs use this place.");case"changelog":return c("placeScope.surface.changelog","Changelog sessions use this place.");case"playtest":return c("placeScope.surface.playtest","Playtest reports use this place.");case"uiStudio":return c("placeScope.surface.uiStudio","UI captures and change history use this place.");case"tools":return c("placeScope.surface.tools","Tool history and statistics use this place.")}}function je({surface:e,selectable:c=!1,selectedPlaceId:l=null,onSelectedPlaceIdChange:n}){const{t:s}=W(),[t,i]=f.useState(null),[b,u]=f.useState(!0),[d,v]=f.useState(null),P=f.useRef(null),_=f.useRef(null),B=f.useId();f.useEffect(()=>{let r=!1;async function S(){try{const x=await z();r||i(x)}catch{r||i(null)}finally{r||u(!1)}}return S(),()=>{r=!0}},[]),f.useEffect(()=>{if(!c||!t)return;const r=L(t);(typeof l!="number"||!h(t,l))&&l!==r&&(n==null||n(r))},[n,c,l,t]);const E=t?de(t,c,l):null,m=t?D(t,E):null,j=`${E??"none"}:${m??"none"}`;if(f.useEffect(()=>{v(r=>r===j?r:null)},[j]),f.useEffect(()=>{function r(){v(null)}function S(I){var g;d!==null&&!((g=P.current)!=null&&g.contains(I.target))&&r()}function x(I){var g;d!==null&&I.key==="Escape"&&(I.preventDefault(),r(),(g=_.current)==null||g.focus())}return document.addEventListener("pointerdown",S),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",S),document.removeEventListener("keydown",x)}},[d]),b)return a.jsx("div",{className:o.scope,"aria-live":"polite",children:a.jsx("span",{className:o.label,children:s("placeScope.loading","Loading place scope...")})});if(!t)return a.jsx("div",{className:o.scope,"aria-live":"polite",children:a.jsx("span",{className:o.label,children:s("placeScope.unavailable","Place scope unavailable")})});const p=c?ve(t,l,s):fe(t,s),$=O(t),C=typeof p.placeId=="number"?String(p.placeId):"",F=c&&t.places.length>0,K=D(t,p.placeId),q=ue(p.placeId,K,s),T=j,y=d===T;return a.jsxs("div",{className:o.scope,"aria-live":"polite",children:[a.jsxs("div",{className:o.main,children:[F?a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:o.selectorLabel,children:[a.jsx("span",{className:o.label,children:s("placeScope.selector.label","Place data")}),a.jsxs("select",{className:o.placeSelect,value:C,onChange:r=>{const S=Number.parseInt(r.currentTarget.value,10);v(null),n==null||n(Number.isInteger(S)?S:null)},children:[p.placeId===null?a.jsx("option",{value:"",disabled:!0,children:s("placeScope.selector.noneSelectable","No selectable Place folder")}):null,a.jsx(Y,{places:t.places,confirmedNames:$,t:s})]})]}),a.jsx("span",{className:o.label,children:p.label}),a.jsx("span",{className:o.name,children:p.placeName})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:o.label,children:p.label}),a.jsx("span",{className:o.name,children:p.placeName})]}),p.placeId!==null?a.jsx("span",{className:o.id,children:p.placeId}):null,a.jsx(w,{variant:p.connected?"success":"neutral",shape:"pill",className:o.scopeBadge,children:p.badge}),p.folderUnresolved?a.jsx(w,{variant:"neutral",shape:"pill",className:o.scopeBadge,children:s("placeScope.folder.unresolved","Representative folder unconfirmed")}):null,p.hasSyncMetadata===!1?a.jsx(w,{variant:"neutral",shape:"pill",className:o.scopeBadge,children:s("placeScope.folder.noSyncHistory","No sync history")}):null]}),a.jsxs("div",{className:o.copy,children:[a.jsx("span",{children:he(e,s)}),p.note?a.jsx("span",{className:o.note,children:p.note}):null]}),t.places.some(r=>U(r)==="duplicate"||U(r)==="unresolved")?a.jsx("div",{className:o.folderDetails,children:a.jsx(H,{places:t.places,t:s})}):null,q.length>0?a.jsxs("div",{className:o.shortcuts,ref:P,children:[a.jsxs("button",{ref:_,type:"button",className:o.shortcutsTrigger,"aria-controls":B,"aria-expanded":y,onClick:()=>{v(y?null:T)},children:[s("placeScope.shortcuts.trigger","Quick links"),a.jsx("span",{"aria-hidden":"true",children:"↗"})]}),y?a.jsx("div",{id:B,className:o.shortcutsPopover,role:"group","aria-label":s("placeScope.shortcuts.label","Place shortcuts"),children:q.map(r=>a.jsxs("a",{className:o.shortcutLink,href:r.href,target:"_blank",rel:"noopener noreferrer",children:[a.jsx("span",{children:r.label}),a.jsx("span",{"aria-hidden":"true",children:"↗"})]},r.href))}):null]}):null]})}const be="_tabBar_jefog_2",Se="_tabs_jefog_9",Pe="_actions_jefog_14",ge="_tab_jefog_2",Ne="_tabActive_jefog_52",N={tabBar:be,tabs:Se,actions:Pe,tab:ge,tabActive:Ne};function ye({items:e,value:c,onChange:l,ariaLabel:n,className:s,rightActions:t}){const i=f.useRef(null),b=f.useRef(null);return f.useEffect(()=>{const u=()=>{const d=i.current,v=b.current;!d||!v||typeof d.scrollTo!="function"||d.scrollTo({left:Math.max(0,v.offsetLeft+v.offsetWidth/2-d.clientWidth/2),behavior:"auto"})};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[c]),a.jsxs("div",{ref:i,className:[N.tabBar,s].filter(Boolean).join(" "),role:"tablist","aria-label":n,children:[a.jsx("div",{className:N.tabs,children:e.map(u=>{const d=u.key===c;return a.jsx("button",{ref:d?b:void 0,type:"button",role:"tab","aria-selected":d,"data-testid":u.testId,className:[N.tab,d?N.tabActive:""].filter(Boolean).join(" "),onClick:()=>l(u.key),children:u.label},u.key)})}),t?a.jsx("div",{className:N.actions,children:t}):null]})}export{je as C,ye as T};
@@ -1 +1 @@
1
- import{b as m,e as d,z as h,j as n}from"./index-CJYQedSN.js";const x="_actions_z7b39_60",f="_btn_z7b39_68",j="_btnPrimary_z7b39_99",z="_panel_z7b39_109",I="_panelIcon_z7b39_116",N="_panelTitle_z7b39_122",u="_panelDesc_z7b39_132",v="_benefitList_z7b39_140",y="_benefitItem_z7b39_149",e={actions:x,btn:f,btnPrimary:j,panel:z,panelIcon:I,panelTitle:N,panelDesc:u,benefitList:v,benefitItem:y};function g({icon:a,title:s,description:c,benefits:l,upgradeLabel:i,upgradeHref:r}){const{trackEvent:o}=m(),{pathname:_,search:b}=d(),p=h(_,b);return n.jsxs("div",{className:e.panel,children:[a&&n.jsx("div",{className:e.panelIcon,children:a}),n.jsx("div",{className:e.panelTitle,children:s}),n.jsx("div",{className:e.panelDesc,children:c}),n.jsx("ul",{className:e.benefitList,children:l.map(t=>n.jsx("li",{className:e.benefitItem,children:t},t))}),n.jsx("div",{className:e.actions,children:n.jsx("a",{className:`${e.btn} ${e.btnPrimary}`,href:r,target:"_blank",rel:"noreferrer",onClick:()=>o("dashboard_click_event",{click_target:"upgrade_cta",placement:"tier_panel",...p}),children:i})})]})}export{g as T};
1
+ import{b as m,e as d,B as h,j as n}from"./index-B-46k2zD.js";const x="_actions_z7b39_60",f="_btn_z7b39_68",j="_btnPrimary_z7b39_99",z="_panel_z7b39_109",I="_panelIcon_z7b39_116",N="_panelTitle_z7b39_122",u="_panelDesc_z7b39_132",v="_benefitList_z7b39_140",y="_benefitItem_z7b39_149",e={actions:x,btn:f,btnPrimary:j,panel:z,panelIcon:I,panelTitle:N,panelDesc:u,benefitList:v,benefitItem:y};function g({icon:a,title:s,description:c,benefits:l,upgradeLabel:i,upgradeHref:r}){const{trackEvent:o}=m(),{pathname:_,search:b}=d(),p=h(_,b);return n.jsxs("div",{className:e.panel,children:[a&&n.jsx("div",{className:e.panelIcon,children:a}),n.jsx("div",{className:e.panelTitle,children:s}),n.jsx("div",{className:e.panelDesc,children:c}),n.jsx("ul",{className:e.benefitList,children:l.map(t=>n.jsx("li",{className:e.benefitItem,children:t},t))}),n.jsx("div",{className:e.actions,children:n.jsx("a",{className:`${e.btn} ${e.btnPrimary}`,href:r,target:"_blank",rel:"noreferrer",onClick:()=>o("dashboard_click_event",{click_target:"upgrade_cta",placement:"tier_panel",...p}),children:i})})]})}export{g as T};
@@ -1 +1 @@
1
- import{j as e,r as i,d as I,D as ht,u as at,X as mt,b as bt,k as xt}from"./index-CJYQedSN.js";import{P as ft}from"./PageHeader-DfhSm4j-.js";import{T as M}from"./TooltipText-DSn3s49K.js";import{C as _t}from"./ConfirmModal-DtH41UBe.js";import{C as gt}from"./ContentScopedDialog-CO7HgbDh.js";import{C as jt,T as yt}from"./Tabs-D9FkOjPv.js";import"./ConfirmModal.module-DJksQHBd.js";import"./PlaceSelectOptions-CMtQalSy.js";const Ct="_wrapper_1s3lp_2",kt="_table_1s3lp_7",Tt="_sortable_1s3lp_32",Nt="_sortArrow_1s3lp_41",St="_clickable_1s3lp_52",wt="_empty_1s3lp_57",A={wrapper:Ct,table:kt,sortable:Tt,sortArrow:Nt,clickable:St,empty:wt};function vt({columns:t,data:o,sortBy:c,sortDir:k="asc",onSort:b,onRowClick:l,rowKey:N,emptyMessage:S}){return e.jsx("div",{className:A.wrapper,children:e.jsxs("table",{className:A.table,children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map(h=>e.jsxs("th",{style:h.width?{width:h.width}:void 0,className:h.sortable?A.sortable:void 0,onClick:h.sortable&&b?()=>b(h.key):void 0,children:[e.jsx("span",{children:h.label}),h.sortable&&c===h.key&&e.jsx("span",{className:A.sortArrow,children:k==="asc"?"▴":"▾"})]},h.key))})}),e.jsx("tbody",{children:o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:A.empty,children:S||"No data"})}):o.map((h,w)=>{const C=N?N(h):String(w);return e.jsx("tr",{className:l?A.clickable:void 0,tabIndex:l?-1:void 0,onClick:l?_=>l(h,_.currentTarget):void 0,children:t.map(_=>e.jsx("td",{children:_.render?_.render(h):String(h[_.key]??"")},_.key))},C)})})]})})}function Mt(t){return{...t,sequenceNumber:typeof t.sequenceNumber=="number"?t.sequenceNumber:void 0,executionTimeMs:typeof t.executionTimeMs=="number"?t.executionTimeMs:void 0}}const Bt=50;function Pt(t){if(typeof t=="number")return{placeId:String(t)}}function Y(t,o){return typeof o!="number"?t:`${t}?placeId=${encodeURIComponent(String(o))}`}function Lt(t){const o=(t==null?void 0:t.placeId)??null,[c,k]=i.useState(null),[b,l]=i.useState(!0),[N,S]=i.useState([]),[h,w]=i.useState(0),[C,_]=i.useState(!1),[U,O]=i.useState(!0),[m,E]=i.useState(0),[g,F]=i.useState(""),B=i.useRef(null),T=i.useCallback(async()=>{l(!0);try{const j=Pt(o),u=j?await I.get("/api/dashboard/tool-stats",j):await I.get("/api/dashboard/tool-stats");k(u)}catch{}finally{l(!1)}},[o]),x=i.useCallback(async(j,u)=>{O(!0);try{const P={limit:String(Bt),offset:String(j)};u&&(P.tool=u),typeof o=="number"&&(P.placeId=String(o));const H=await I.get("/api/dashboard/history",P);S(H.entries.map(Mt)),w(H.total),_(H.hasMore)}catch{S([]),w(0),_(!1)}finally{O(!1)}},[o]),D=i.useCallback(()=>{T(),x(m,g)},[x,T,m,g]),V=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/history/clear",o)),x(m,g)},[x,m,g,o]),K=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/statistics/clear",o)),T()},[T,o]);return i.useEffect(()=>{T()},[T]),i.useEffect(()=>{x(m,g)},[x,m,g]),i.useEffect(()=>{const j=new ht;B.current=j,j.connect();const u=j.on("command",()=>{T(),x(m,g)});return()=>{u(),j.disconnect(),B.current=null}},[x,T,m,g]),{statistics:c,statsLoading:b,history:N,historyTotal:h,historyHasMore:C,historyLoading:U,historyOffset:m,historyToolFilter:g,setHistoryOffset:E,setHistoryToolFilter:F,refresh:D,clearHistory:V,clearStatistics:K}}const Et="_page_1rtjt_2",Ht="_card_1rtjt_14",At="_cardToolbar_1rtjt_21",Rt="_sectionTitle_1rtjt_29",It="_dangerButton_1rtjt_36",Ot="_proBadge_1rtjt_55",Ft="_statusOk_1rtjt_70",Dt="_statusFallback_1rtjt_83",$t="_statusUnsupported_1rtjt_96",qt="_statusWarning_1rtjt_109",Wt="_statusError_1rtjt_122",Ut="_tierBasic_1rtjt_136",Vt="_tierPro_1rtjt_140",Kt="_tierMixed_1rtjt_145",Gt="_filterRow_1rtjt_156",zt="_filterLabel_1rtjt_163",Jt="_filterSelect_1rtjt_172",Qt="_detailsButton_1rtjt_187",Zt="_detailShell_1rtjt_210",Xt="_detailHeader_1rtjt_218",Yt="_detailHeading_1rtjt_229",te="_detailTitle_1rtjt_236",ee="_detailRecordName_1rtjt_243",se="_detailHeaderActions_1rtjt_252",ae="_detailCloseButton_1rtjt_259",oe="_detailBody_1rtjt_282",le="_detailSection_1rtjt_294",re="_detailList_1rtjt_313",ie="_detailItem_1rtjt_319",ne="_detailLabel_1rtjt_326",ce="_detailValue_1rtjt_331",de="_pre_1rtjt_337",ue="_pagination_1rtjt_355",pe="_pageInfo_1rtjt_363",he="_btn_1rtjt_369",me="_tierDistribution_1rtjt_397",be="_tierBarWrap_1rtjt_401",xe="_tierBarBasic_1rtjt_409",fe="_tierBarPro_1rtjt_414",_e="_tierLabels_1rtjt_419",ge="_statsTableWrap_1rtjt_428",je="_statsTable_1rtjt_428",ye="_sortableHeader_1rtjt_460",Ce="_sortArrow_1rtjt_465",ke="_statsToolRow_1rtjt_469",Te="_statsActionRow_1rtjt_477",Ne="_expandButton_1rtjt_481",Se="_expandIcon_1rtjt_493",we="_actionLabel_1rtjt_498",ve="_emptyStats_1rtjt_505",Me="_summaryLine_1rtjt_511",a={page:Et,card:Ht,cardToolbar:At,sectionTitle:Rt,dangerButton:It,proBadge:Ot,statusOk:Ft,statusFallback:Dt,statusUnsupported:$t,statusWarning:qt,statusError:Wt,tierBasic:Ut,tierPro:Vt,tierMixed:Kt,filterRow:Gt,filterLabel:zt,filterSelect:Jt,detailsButton:Qt,detailShell:Zt,detailHeader:Xt,detailHeading:Yt,detailTitle:te,detailRecordName:ee,detailHeaderActions:se,detailCloseButton:ae,detailBody:oe,detailSection:le,detailList:re,detailItem:ie,detailLabel:ne,detailValue:ce,pre:de,pagination:ue,pageInfo:pe,btn:he,tierDistribution:me,tierBarWrap:be,tierBarBasic:xe,tierBarPro:fe,tierLabels:_e,statsTableWrap:ge,statsTable:je,sortableHeader:ye,sortArrow:Ce,statsToolRow:ke,statsActionRow:Te,expandButton:Ne,expandIcon:Se,actionLabel:we,emptyStats:ve,summaryLine:Me},Be=new Set(["clientId","placeId","pinnedTarget","recentPriority","globalQueue"]);function tt(t){return typeof t=="string"&&t.length>0?t:void 0}function Pe(t){if(!Array.isArray(t))return;const o=t.filter(c=>typeof c=="string"&&c.length>0);return o.length>0?o:void 0}function Le(t){const o=t.result??{};return{requestedCommand:t.requestedCommand??tt(o.requestedCommand),executedCommand:t.executedCommand??tt(o.executedCommand),alternatives:t.alternatives??Pe(o.alternatives)}}function ot(t,o){switch(t.status){case"fallback":return{label:o("tools.badge.fallback","FALLBACK"),tooltip:o("tools.badge.fallback.tooltip","The requested Pro action succeeded via a Basic fallback."),className:a.statusFallback};case"unsupported":return{label:o("tools.badge.unsupported","UNSUPPORTED"),tooltip:o("tools.badge.unsupported.tooltip","The requested Pro action was blocked and no fallback ran."),className:a.statusUnsupported};case"warning":return{label:o("tools.badge.warn","WARN"),tooltip:o("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:o("tools.badge.err","FAILED"),tooltip:o("tools.badge.err.tooltip","The tool run failed."),className:a.statusError};default:return{label:o("tools.status.ok","OK"),tooltip:o("tools.status.ok.tooltip","The tool run completed successfully."),className:a.statusOk}}}function y(t,o){return e.jsxs("div",{className:a.detailItem,children:[e.jsx("span",{className:a.detailLabel,children:t}),e.jsx("span",{className:a.detailValue,children:o})]})}function Ee(t){if(!t||typeof t!="object")return;const o=t;if(typeof o.selectionMode=="string"&&Be.has(o.selectionMode))return o}function et(t){if(!(!t||typeof t!="object"||!("routing"in t)))return Ee(t.routing)}function He(t){return t.routing??et(t.result)??et(t.data)}function Ae(t,o){return t.requestedClientId?t.requestedClientId:t.requestedPlaceId!==void 0?t.requestedPlaceId:o("tools.history.routing.none","No Studio target named")}function Re(t){return t.actualPlaceName?`${t.actualPlaceName} · ${t.actualPlaceId??"-"}`:t.actualClientId??"-"}function Ie({entry:t,onClose:o}){const{t:c}=at(),k=ot(t,c),b=Le(t),l=He(t);return e.jsxs("div",{className:a.detailShell,children:[e.jsxs("header",{className:a.detailHeader,children:[e.jsxs("div",{className:a.detailHeading,children:[e.jsx("span",{className:a.detailTitle,children:c("tools.detail.title","Tool execution")}),e.jsx("span",{className:a.detailRecordName,children:t.command})]}),e.jsxs("div",{className:a.detailHeaderActions,children:[e.jsx(M,{text:k.tooltip,children:e.jsx("span",{className:k.className,children:k.label})}),e.jsx("button",{type:"button",className:a.detailCloseButton,onClick:o,"aria-label":c("common.close","Close"),children:e.jsx(mt,{size:18,"aria-hidden":"true"})})]})]}),e.jsxs("div",{className:a.detailBody,children:[e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:e.jsx(M,{text:c("tools.detail.params.tooltip","Input parameters passed to this tool run."),children:c("tools.detail.params","Parameters")})}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.parameters,null,2)})]}),t.result&&e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:e.jsx(M,{text:c("tools.detail.result.tooltip","Returned result payload for this tool run."),children:c("tools.detail.result","Result")})}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.result,null,2)})]}),l&&e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:c("tools.history.routing","Routing")}),e.jsxs("div",{className:a.detailList,children:[y(c("tools.history.routing.mode","Mode"),l.selectionMode),y(c("tools.history.routing.requested","Requested"),Ae(l,c)),y(c("tools.history.routing.actual","Actual"),Re(l))]})]}),(t.status==="fallback"||t.status==="unsupported"||t.status==="warning"||t.status==="error")&&e.jsx("section",{className:a.detailSection,children:e.jsxs("div",{className:a.detailList,children:[t.status==="fallback"&&b.requestedCommand?y(c("tools.detail.requestedCommand","Requested Command"),b.requestedCommand):null,t.status==="fallback"&&b.executedCommand?y(c("tools.detail.executedCommand","Executed Command"),b.executedCommand):null,t.status==="fallback"&&b.alternatives?y(c("tools.detail.alternatives","Alternatives"),b.alternatives.join(", ")):null,t.status==="unsupported"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="unsupported"?y(c("tools.detail.noFallback","No Fallback"),c("tools.detail.noFallback.value","No fallback ran.")):null,t.status==="warning"&&t.warningMessage?y(c("tools.detail.warningMessage","Warning Message"),t.warningMessage):null,t.status==="error"&&t.errorMessage?y(c("tools.detail.errorMessage","Error Message"),t.errorMessage):null,t.status==="error"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="error"&&t.fallbackCommand?y(c("tools.detail.executedCommand","Executed Command"),t.fallbackCommand):null]})})]})]})}const G=50;function Oe(t){const o=new Date(t);return`${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}:${String(o.getSeconds()).padStart(2,"0")}`}function W(t){return typeof t!="number"||!Number.isFinite(t)?"-":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function R(t,o){return o==="pro"?t("tier.pro","Pro"):o==="mixed"?t("tier.mixed","Mixed"):t("tier.basic","Basic")}function lt(t,o){return o!==t&&o.startsWith(`${t}_`)?o.slice(t.length+1):""}function st(t,o){const c=lt(t,o);return c?`${t}.${c}`:t}function ze(){const{t}=at(),{trackEvent:o,trackPageView:c}=bt(),[k,b]=i.useState(null),l=Lt({placeId:k}),{show:N}=xt(),[S,h]=i.useState("history"),[w,C]=i.useState(null),_=i.useRef(null),[U,O]=i.useState(null),[m,E]=i.useState(null),[g,F]=i.useState(!1),[B,T]=i.useState("totalCalls"),[x,D]=i.useState("desc"),V=i.useCallback(s=>{T(n=>n===s?(D(r=>r==="asc"?"desc":"asc"),s):(D("desc"),s))},[]),K=i.useMemo(()=>{var n;const s=new Set;return Object.keys(((n=l.statistics)==null?void 0:n.tools)??{}).forEach(r=>s.add(r)),l.history.forEach(r=>{r.tool&&s.add(r.tool)}),l.historyToolFilter&&s.add(l.historyToolFilter),Array.from(s).sort()},[l.history,l.historyToolFilter,l.statistics]),j=i.useMemo(()=>{var s;return(s=l.statistics)!=null&&s.tools?Object.values(l.statistics.tools).map(n=>{var X;const r=Object.entries(n.commands??{}).map(([p,d])=>({toolName:n.tool,commandName:d.command??p,label:lt(n.tool,d.command??p)||(d.command??p),tier:d.tier,totalCalls:d.totalCalls,successCount:d.successCount,fallbackCount:d.fallbackCount,unsupportedCount:d.unsupportedCount,warningCount:d.warningCount??0,failureCount:d.failureCount,totalExecutionTimeMs:d.totalExecutionTimeMs,avgExecutionTimeMs:d.avgExecutionTimeMs})),f=r.reduce((p,d)=>p+d.totalCalls,0),v=r.reduce((p,d)=>p+d.successCount,0),$=r.reduce((p,d)=>p+d.fallbackCount,0),q=r.reduce((p,d)=>p+d.unsupportedCount,0),dt=r.reduce((p,d)=>p+d.warningCount,0),ut=r.reduce((p,d)=>p+d.failureCount,0),Z=r.reduce((p,d)=>p+d.totalExecutionTimeMs,0),pt=new Set(r.map(p=>p.tier)).size>1?"mixed":((X=r[0])==null?void 0:X.tier)??n.tier;return{toolName:n.tool,tier:pt,commands:r,totalCalls:f,successCount:v,fallbackCount:$,unsupportedCount:q,warningCount:dt,failureCount:ut,totalExecutionTimeMs:Z,avgExecutionTimeMs:f>0?Math.round(Z/f):0}}):[]},[l.statistics]),u=i.useCallback((s,n,r,f)=>e.jsx(M,{text:t(r,f),children:t(s,n)}),[t]),P=i.useCallback((s,n)=>{_.current=n,C(s)},[]),H=i.useCallback(()=>{C(null)},[]),z=i.useMemo(()=>[...j].sort((n,r)=>{const f=n[B],v=r[B];if(typeof f=="number"&&typeof v=="number")return x==="asc"?f-v:v-f;const $=String(f??""),q=String(v??"");return x==="asc"?$.localeCompare(q):q.localeCompare($)}),[j,B,x]),rt=i.useMemo(()=>[{key:"timestamp",label:u("tools.col.time","Time","tools.col.time.tooltip","When the tool run was recorded."),width:"80px",render:s=>Oe(s.timestamp)},{key:"toolName",label:u("tools.col.toolAction","Tool.Action","tools.col.toolAction.tooltip","Tool name and action that were executed."),render:s=>e.jsxs("span",{children:[st(s.tool,s.command),s.tier==="pro"&&e.jsx(M,{text:t("tools.badge.pro.tooltip","This entry used a Pro-only tool or action."),children:e.jsx("span",{className:a.proBadge,children:t("tools.badge.pro","PRO")})})]})},{key:"executionTimeMs",label:u("tools.col.duration","Duration","tools.col.duration.tooltip","How long the tool took to finish."),width:"80px",render:s=>W(s.executionTimeMs)},{key:"status",label:u("tools.col.status","Status","tools.col.status.tooltip","Outcome of the recorded tool run."),width:"120px",render:s=>{const n=ot(s,t);return e.jsx(M,{text:n.tooltip,children:e.jsx("span",{className:n.className,children:n.label})})}},{key:"tier",label:u("tools.col.tier","Tier","tools.col.tier.tooltip","License tier required for the tool or action."),width:"60px",render:s=>e.jsx("span",{className:s.tier==="pro"?a.tierPro:a.tierBasic,children:R(t,s.tier)})},{key:"details",label:t("tools.detail.open","Details"),width:"84px",render:s=>{const n=st(s.tool,s.command);return e.jsx("button",{type:"button",className:a.detailsButton,"aria-haspopup":"dialog","aria-label":t("tools.detail.openLabel","View details for {command}").replace("{command}",n),onClick:r=>{r.stopPropagation(),P(s,r.currentTarget)},children:t("tools.detail.open","Details")})}}],[P,t,u]),J=i.useMemo(()=>[{key:"toolName",label:u("tools.col.tool","Tool","tools.col.tool.tooltip","Consolidated tool name in the statistics table."),sortable:!0},{key:"totalCalls",label:u("tools.col.calls","Calls","tools.col.calls.tooltip","Total number of recorded calls for this tool."),sortable:!0,width:"70px"},{key:"successCount",label:u("tools.col.ok","OK","tools.col.ok.tooltip","Number of direct successful runs."),sortable:!0,width:"70px"},{key:"fallbackCount",label:u("tools.col.fallback","FALLBACK","tools.col.fallback.tooltip","Number of runs that succeeded through fallback execution."),sortable:!0,width:"110px"},{key:"unsupportedCount",label:u("tools.col.unsupported","UNSUPPORTED","tools.col.unsupported.tooltip","Number of blocked runs without fallback execution."),sortable:!0,width:"130px"},{key:"warningCount",label:u("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:u("tools.col.err","FAILED","tools.col.err.tooltip","Number of runs that failed."),sortable:!0,width:"70px"},{key:"avgExecutionTimeMs",label:u("tools.col.avgTime","Avg Time","tools.col.avgTime.tooltip","Average execution time across recorded calls."),sortable:!0,width:"90px",render:s=>W(s.avgExecutionTimeMs)},{key:"tier",label:u("tools.col.tier","Tier","tools.col.tierStats.tooltip","Basic, Pro, or Mixed summary for the tool statistics row."),sortable:!0,width:"70px",render:s=>e.jsx(M,{text:s.tier==="mixed"?t("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:s.tier==="pro"?a.tierPro:s.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(t,s.tier)})})}],[t,u]),L=i.useMemo(()=>{if(!l.statistics)return null;const s=l.statistics.tierSummary.basic.totalCalls,n=l.statistics.tierSummary.pro.totalCalls,r=s+n;if(r===0)return null;const f=Math.round(s/r*100),v=100-f;return{basic:s,pro:n,basicPct:f,proPct:v}},[l.statistics]),Q=i.useCallback(s=>{O(n=>n===s?null:s)},[]),it=i.useCallback(async()=>{if(m){F(!0);try{m==="history"?await l.clearHistory():await l.clearStatistics(),N(t("toast.clearSuccess","Cleared successfully"),"success"),E(null)}catch{N(t("toast.clearFailed","Failed to clear data"),"error")}finally{F(!1)}}},[m,N,t,l]),nt=i.useCallback(s=>{const n=s==="history"?"tools_history":"tools_statistics";o("dashboard_click_event",{click_target:s==="history"?"tools_tab_history":"tools_tab_statistics",page:"tools",tab:n}),c({page:"tools",tab:n}),C(null),h(s)},[o,c]),ct=["history","statistics"].map(s=>({key:s,label:t(`tools.tab.${s}`,s.charAt(0).toUpperCase()+s.slice(1))}));return e.jsxs("div",{className:a.page,children:[e.jsx(ft,{title:t("page.tools.title","Tools"),description:t("page.tools.description","Inspect tool history, outcomes, fallback details, and usage statistics."),helpTopicId:"tools"}),e.jsx(jt,{surface:"tools",selectable:!0,selectedPlaceId:k,onSelectedPlaceIdChange:s=>{C(null),b(s),l.setHistoryOffset(0)}}),e.jsx(yt,{items:ct,value:S,onChange:nt}),S==="history"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:t("tools.tab.history","History")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{o("dashboard_click_event",{click_target:"tools_clear_history",page:"tools",tab:"tools_history"}),E("history")},children:t("common.clear","Clear")})]}),e.jsx("div",{className:a.filterRow,children:e.jsxs("label",{className:a.filterLabel,children:[t("tools.filter.tool","Tool"),":",e.jsxs("select",{className:a.filterSelect,value:l.historyToolFilter,onChange:s=>{C(null),l.setHistoryToolFilter(s.target.value),l.setHistoryOffset(0)},children:[e.jsx("option",{value:"",children:t("tools.filter.all","All")}),K.map(s=>e.jsx("option",{value:s,children:s},s))]})]})}),e.jsx(vt,{columns:rt,data:l.history,rowKey:s=>s.id,onRowClick:(s,n)=>P(s,n),emptyMessage:t("tools.empty.history","No tool history entries for this place")}),e.jsxs("div",{className:a.pagination,children:[e.jsx("button",{className:a.btn,disabled:l.historyOffset===0,title:t("tools.page.prev.tooltip","Go to the previous page of tool history results."),onClick:()=>{C(null),l.setHistoryOffset(Math.max(0,l.historyOffset-G))},children:t("tools.page.prev","Prev")}),e.jsxs("span",{className:a.pageInfo,children:[l.historyOffset+1,"–",Math.min(l.historyOffset+G,l.historyTotal)," / ",l.historyTotal]}),e.jsx("button",{className:a.btn,disabled:!l.historyHasMore,title:t("tools.page.next.tooltip","Go to the next page of tool history results."),onClick:()=>{C(null),l.setHistoryOffset(l.historyOffset+G)},children:t("tools.page.next","Next")})]})]}),S==="statistics"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:t("tools.tab.statistics","Statistics")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{o("dashboard_click_event",{click_target:"tools_clear_statistics",page:"tools",tab:"tools_statistics"}),E("statistics")},children:t("common.clear","Clear")})]}),L&&e.jsxs("div",{className:a.tierDistribution,children:[e.jsxs("div",{className:a.tierBarWrap,children:[e.jsx("div",{className:a.tierBarBasic,style:{width:`${L.basicPct}%`}}),e.jsx("div",{className:a.tierBarPro,style:{width:`${L.proPct}%`}})]}),e.jsxs("div",{className:a.tierLabels,children:[e.jsxs("span",{children:[R(t,"basic")," ",L.basicPct,"% (",L.basic,")"]}),e.jsxs("span",{children:[R(t,"pro")," ",L.proPct,"% (",L.pro,")"]})]})]}),e.jsx("div",{className:a.statsTableWrap,children:e.jsxs("table",{className:a.statsTable,children:[e.jsx("thead",{children:e.jsx("tr",{children:J.map(s=>e.jsxs("th",{style:s.width?{width:s.width}:void 0,className:s.sortable?a.sortableHeader:void 0,onClick:s.sortable?()=>V(s.key):void 0,children:[e.jsx("span",{children:s.label}),s.sortable&&B===s.key&&e.jsx("span",{className:a.sortArrow,children:x==="asc"?"▴":"▾"})]},s.key))})}),e.jsx("tbody",{children:z.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:J.length,className:a.emptyStats,children:t("tools.empty.stats","No tool statistics for this place")})}):z.map(s=>{const n=U===s.toolName;return e.jsxs(i.Fragment,{children:[e.jsxs("tr",{className:a.statsToolRow,onClick:()=>Q(s.toolName),children:[e.jsx("td",{children:e.jsxs("button",{type:"button",className:a.expandButton,"aria-expanded":n,"aria-label":`${s.toolName} ${n?t("common.collapse","Collapse"):t("common.expand","Expand")}`,onClick:r=>{r.stopPropagation(),Q(s.toolName)},children:[e.jsx("span",{className:a.expandIcon,"aria-hidden":"true",children:n?"▾":"▸"}),e.jsx("span",{children:s.toolName})]})}),e.jsx("td",{children:s.totalCalls}),e.jsx("td",{children:s.successCount}),e.jsx("td",{children:s.fallbackCount}),e.jsx("td",{children:s.unsupportedCount}),e.jsx("td",{children:s.warningCount}),e.jsx("td",{children:s.failureCount}),e.jsx("td",{children:W(s.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx(M,{text:s.tier==="mixed"?t("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:s.tier==="pro"?a.tierPro:s.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(t,s.tier)})})})]}),n&&s.commands.map(r=>e.jsxs("tr",{className:a.statsActionRow,children:[e.jsx("td",{children:e.jsx("span",{className:a.actionLabel,children:r.label})}),e.jsx("td",{children:r.totalCalls}),e.jsx("td",{children:r.successCount}),e.jsx("td",{children:r.fallbackCount}),e.jsx("td",{children:r.unsupportedCount}),e.jsx("td",{children:r.warningCount}),e.jsx("td",{children:r.failureCount}),e.jsx("td",{children:W(r.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx("span",{className:r.tier==="pro"?a.tierPro:a.tierBasic,children:R(t,r.tier)})})]},`${s.toolName}:${r.commandName}`))]},s.toolName)})})]})}),l.statistics&&e.jsxs("div",{className:a.summaryLine,children:[t("tools.summary.total","Total"),": ",l.statistics.totalCalls," ",t("tools.summary.calls","calls")," | ",t("tools.summary.sessions","Sessions"),": ",l.statistics.totalSessions]})]}),e.jsx(gt,{open:w!==null,ariaLabel:t("tools.detail.dialogLabel","Tool execution detail"),onClose:H,returnFocusTo:_.current,testId:"tools-history-detail-popup-layer",children:w&&e.jsx(Ie,{entry:w,onClose:H})}),e.jsx(_t,{open:m!==null,title:m==="history"?t("tools.clear.history.title","Clear history?"):t("tools.clear.statistics.title","Clear statistics?"),message:m==="history"?t("tools.clear.history.message","This permanently removes the current place tools history."):t("tools.clear.statistics.message","This permanently resets the current place tool statistics."),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:g,onCancel:()=>!g&&E(null),onConfirm:it})]})}export{ze as Component};
1
+ import{j as e,r as i,d as I,D as ht,u as at,X as mt,b as bt,k as xt}from"./index-B-46k2zD.js";import{P as ft}from"./PageHeader-C7zSPJ0K.js";import{T as M}from"./TooltipText-CKbtCUcM.js";import{C as _t}from"./ConfirmModal-EJt_S9vY.js";import{C as gt}from"./ContentScopedDialog-BcNAWEg1.js";import{C as jt,T as yt}from"./Tabs-CJSfllHd.js";import"./ConfirmModal.module-DJksQHBd.js";import"./PlaceSelectOptions-e39l4_SC.js";const Ct="_wrapper_1s3lp_2",kt="_table_1s3lp_7",Tt="_sortable_1s3lp_32",Nt="_sortArrow_1s3lp_41",St="_clickable_1s3lp_52",wt="_empty_1s3lp_57",A={wrapper:Ct,table:kt,sortable:Tt,sortArrow:Nt,clickable:St,empty:wt};function vt({columns:t,data:o,sortBy:c,sortDir:k="asc",onSort:b,onRowClick:l,rowKey:N,emptyMessage:S}){return e.jsx("div",{className:A.wrapper,children:e.jsxs("table",{className:A.table,children:[e.jsx("thead",{children:e.jsx("tr",{children:t.map(h=>e.jsxs("th",{style:h.width?{width:h.width}:void 0,className:h.sortable?A.sortable:void 0,onClick:h.sortable&&b?()=>b(h.key):void 0,children:[e.jsx("span",{children:h.label}),h.sortable&&c===h.key&&e.jsx("span",{className:A.sortArrow,children:k==="asc"?"▴":"▾"})]},h.key))})}),e.jsx("tbody",{children:o.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:A.empty,children:S||"No data"})}):o.map((h,w)=>{const C=N?N(h):String(w);return e.jsx("tr",{className:l?A.clickable:void 0,tabIndex:l?-1:void 0,onClick:l?_=>l(h,_.currentTarget):void 0,children:t.map(_=>e.jsx("td",{children:_.render?_.render(h):String(h[_.key]??"")},_.key))},C)})})]})})}function Mt(t){return{...t,sequenceNumber:typeof t.sequenceNumber=="number"?t.sequenceNumber:void 0,executionTimeMs:typeof t.executionTimeMs=="number"?t.executionTimeMs:void 0}}const Bt=50;function Pt(t){if(typeof t=="number")return{placeId:String(t)}}function Y(t,o){return typeof o!="number"?t:`${t}?placeId=${encodeURIComponent(String(o))}`}function Lt(t){const o=(t==null?void 0:t.placeId)??null,[c,k]=i.useState(null),[b,l]=i.useState(!0),[N,S]=i.useState([]),[h,w]=i.useState(0),[C,_]=i.useState(!1),[U,O]=i.useState(!0),[m,E]=i.useState(0),[g,F]=i.useState(""),B=i.useRef(null),T=i.useCallback(async()=>{l(!0);try{const j=Pt(o),u=j?await I.get("/api/dashboard/tool-stats",j):await I.get("/api/dashboard/tool-stats");k(u)}catch{}finally{l(!1)}},[o]),x=i.useCallback(async(j,u)=>{O(!0);try{const P={limit:String(Bt),offset:String(j)};u&&(P.tool=u),typeof o=="number"&&(P.placeId=String(o));const H=await I.get("/api/dashboard/history",P);S(H.entries.map(Mt)),w(H.total),_(H.hasMore)}catch{S([]),w(0),_(!1)}finally{O(!1)}},[o]),D=i.useCallback(()=>{T(),x(m,g)},[x,T,m,g]),V=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/history/clear",o)),x(m,g)},[x,m,g,o]),K=i.useCallback(async()=>{await I.post(Y("/api/dashboard/tools/statistics/clear",o)),T()},[T,o]);return i.useEffect(()=>{T()},[T]),i.useEffect(()=>{x(m,g)},[x,m,g]),i.useEffect(()=>{const j=new ht;B.current=j,j.connect();const u=j.on("command",()=>{T(),x(m,g)});return()=>{u(),j.disconnect(),B.current=null}},[x,T,m,g]),{statistics:c,statsLoading:b,history:N,historyTotal:h,historyHasMore:C,historyLoading:U,historyOffset:m,historyToolFilter:g,setHistoryOffset:E,setHistoryToolFilter:F,refresh:D,clearHistory:V,clearStatistics:K}}const Et="_page_1rtjt_2",Ht="_card_1rtjt_14",At="_cardToolbar_1rtjt_21",Rt="_sectionTitle_1rtjt_29",It="_dangerButton_1rtjt_36",Ot="_proBadge_1rtjt_55",Ft="_statusOk_1rtjt_70",Dt="_statusFallback_1rtjt_83",$t="_statusUnsupported_1rtjt_96",qt="_statusWarning_1rtjt_109",Wt="_statusError_1rtjt_122",Ut="_tierBasic_1rtjt_136",Vt="_tierPro_1rtjt_140",Kt="_tierMixed_1rtjt_145",Gt="_filterRow_1rtjt_156",zt="_filterLabel_1rtjt_163",Jt="_filterSelect_1rtjt_172",Qt="_detailsButton_1rtjt_187",Zt="_detailShell_1rtjt_210",Xt="_detailHeader_1rtjt_218",Yt="_detailHeading_1rtjt_229",te="_detailTitle_1rtjt_236",ee="_detailRecordName_1rtjt_243",se="_detailHeaderActions_1rtjt_252",ae="_detailCloseButton_1rtjt_259",oe="_detailBody_1rtjt_282",le="_detailSection_1rtjt_294",re="_detailList_1rtjt_313",ie="_detailItem_1rtjt_319",ne="_detailLabel_1rtjt_326",ce="_detailValue_1rtjt_331",de="_pre_1rtjt_337",ue="_pagination_1rtjt_355",pe="_pageInfo_1rtjt_363",he="_btn_1rtjt_369",me="_tierDistribution_1rtjt_397",be="_tierBarWrap_1rtjt_401",xe="_tierBarBasic_1rtjt_409",fe="_tierBarPro_1rtjt_414",_e="_tierLabels_1rtjt_419",ge="_statsTableWrap_1rtjt_428",je="_statsTable_1rtjt_428",ye="_sortableHeader_1rtjt_460",Ce="_sortArrow_1rtjt_465",ke="_statsToolRow_1rtjt_469",Te="_statsActionRow_1rtjt_477",Ne="_expandButton_1rtjt_481",Se="_expandIcon_1rtjt_493",we="_actionLabel_1rtjt_498",ve="_emptyStats_1rtjt_505",Me="_summaryLine_1rtjt_511",a={page:Et,card:Ht,cardToolbar:At,sectionTitle:Rt,dangerButton:It,proBadge:Ot,statusOk:Ft,statusFallback:Dt,statusUnsupported:$t,statusWarning:qt,statusError:Wt,tierBasic:Ut,tierPro:Vt,tierMixed:Kt,filterRow:Gt,filterLabel:zt,filterSelect:Jt,detailsButton:Qt,detailShell:Zt,detailHeader:Xt,detailHeading:Yt,detailTitle:te,detailRecordName:ee,detailHeaderActions:se,detailCloseButton:ae,detailBody:oe,detailSection:le,detailList:re,detailItem:ie,detailLabel:ne,detailValue:ce,pre:de,pagination:ue,pageInfo:pe,btn:he,tierDistribution:me,tierBarWrap:be,tierBarBasic:xe,tierBarPro:fe,tierLabels:_e,statsTableWrap:ge,statsTable:je,sortableHeader:ye,sortArrow:Ce,statsToolRow:ke,statsActionRow:Te,expandButton:Ne,expandIcon:Se,actionLabel:we,emptyStats:ve,summaryLine:Me},Be=new Set(["clientId","placeId","pinnedTarget","recentPriority","globalQueue"]);function tt(t){return typeof t=="string"&&t.length>0?t:void 0}function Pe(t){if(!Array.isArray(t))return;const o=t.filter(c=>typeof c=="string"&&c.length>0);return o.length>0?o:void 0}function Le(t){const o=t.result??{};return{requestedCommand:t.requestedCommand??tt(o.requestedCommand),executedCommand:t.executedCommand??tt(o.executedCommand),alternatives:t.alternatives??Pe(o.alternatives)}}function ot(t,o){switch(t.status){case"fallback":return{label:o("tools.badge.fallback","FALLBACK"),tooltip:o("tools.badge.fallback.tooltip","The requested Pro action succeeded via a Basic fallback."),className:a.statusFallback};case"unsupported":return{label:o("tools.badge.unsupported","UNSUPPORTED"),tooltip:o("tools.badge.unsupported.tooltip","The requested Pro action was blocked and no fallback ran."),className:a.statusUnsupported};case"warning":return{label:o("tools.badge.warn","WARN"),tooltip:o("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:o("tools.badge.err","FAILED"),tooltip:o("tools.badge.err.tooltip","The tool run failed."),className:a.statusError};default:return{label:o("tools.status.ok","OK"),tooltip:o("tools.status.ok.tooltip","The tool run completed successfully."),className:a.statusOk}}}function y(t,o){return e.jsxs("div",{className:a.detailItem,children:[e.jsx("span",{className:a.detailLabel,children:t}),e.jsx("span",{className:a.detailValue,children:o})]})}function Ee(t){if(!t||typeof t!="object")return;const o=t;if(typeof o.selectionMode=="string"&&Be.has(o.selectionMode))return o}function et(t){if(!(!t||typeof t!="object"||!("routing"in t)))return Ee(t.routing)}function He(t){return t.routing??et(t.result)??et(t.data)}function Ae(t,o){return t.requestedClientId?t.requestedClientId:t.requestedPlaceId!==void 0?t.requestedPlaceId:o("tools.history.routing.none","No Studio target named")}function Re(t){return t.actualPlaceName?`${t.actualPlaceName} · ${t.actualPlaceId??"-"}`:t.actualClientId??"-"}function Ie({entry:t,onClose:o}){const{t:c}=at(),k=ot(t,c),b=Le(t),l=He(t);return e.jsxs("div",{className:a.detailShell,children:[e.jsxs("header",{className:a.detailHeader,children:[e.jsxs("div",{className:a.detailHeading,children:[e.jsx("span",{className:a.detailTitle,children:c("tools.detail.title","Tool execution")}),e.jsx("span",{className:a.detailRecordName,children:t.command})]}),e.jsxs("div",{className:a.detailHeaderActions,children:[e.jsx(M,{text:k.tooltip,children:e.jsx("span",{className:k.className,children:k.label})}),e.jsx("button",{type:"button",className:a.detailCloseButton,onClick:o,"aria-label":c("common.close","Close"),children:e.jsx(mt,{size:18,"aria-hidden":"true"})})]})]}),e.jsxs("div",{className:a.detailBody,children:[e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:e.jsx(M,{text:c("tools.detail.params.tooltip","Input parameters passed to this tool run."),children:c("tools.detail.params","Parameters")})}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.parameters,null,2)})]}),t.result&&e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:e.jsx(M,{text:c("tools.detail.result.tooltip","Returned result payload for this tool run."),children:c("tools.detail.result","Result")})}),e.jsx("pre",{className:a.pre,children:JSON.stringify(t.result,null,2)})]}),l&&e.jsxs("section",{className:a.detailSection,children:[e.jsx("strong",{children:c("tools.history.routing","Routing")}),e.jsxs("div",{className:a.detailList,children:[y(c("tools.history.routing.mode","Mode"),l.selectionMode),y(c("tools.history.routing.requested","Requested"),Ae(l,c)),y(c("tools.history.routing.actual","Actual"),Re(l))]})]}),(t.status==="fallback"||t.status==="unsupported"||t.status==="warning"||t.status==="error")&&e.jsx("section",{className:a.detailSection,children:e.jsxs("div",{className:a.detailList,children:[t.status==="fallback"&&b.requestedCommand?y(c("tools.detail.requestedCommand","Requested Command"),b.requestedCommand):null,t.status==="fallback"&&b.executedCommand?y(c("tools.detail.executedCommand","Executed Command"),b.executedCommand):null,t.status==="fallback"&&b.alternatives?y(c("tools.detail.alternatives","Alternatives"),b.alternatives.join(", ")):null,t.status==="unsupported"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="unsupported"?y(c("tools.detail.noFallback","No Fallback"),c("tools.detail.noFallback.value","No fallback ran.")):null,t.status==="warning"&&t.warningMessage?y(c("tools.detail.warningMessage","Warning Message"),t.warningMessage):null,t.status==="error"&&t.errorMessage?y(c("tools.detail.errorMessage","Error Message"),t.errorMessage):null,t.status==="error"&&t.blockedMessage?y(c("tools.detail.blockedMessage","Blocked Reason"),t.blockedMessage):null,t.status==="error"&&t.fallbackCommand?y(c("tools.detail.executedCommand","Executed Command"),t.fallbackCommand):null]})})]})]})}const G=50;function Oe(t){const o=new Date(t);return`${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}:${String(o.getSeconds()).padStart(2,"0")}`}function W(t){return typeof t!="number"||!Number.isFinite(t)?"-":t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`}function R(t,o){return o==="pro"?t("tier.pro","Pro"):o==="mixed"?t("tier.mixed","Mixed"):t("tier.basic","Basic")}function lt(t,o){return o!==t&&o.startsWith(`${t}_`)?o.slice(t.length+1):""}function st(t,o){const c=lt(t,o);return c?`${t}.${c}`:t}function ze(){const{t}=at(),{trackEvent:o,trackPageView:c}=bt(),[k,b]=i.useState(null),l=Lt({placeId:k}),{show:N}=xt(),[S,h]=i.useState("history"),[w,C]=i.useState(null),_=i.useRef(null),[U,O]=i.useState(null),[m,E]=i.useState(null),[g,F]=i.useState(!1),[B,T]=i.useState("totalCalls"),[x,D]=i.useState("desc"),V=i.useCallback(s=>{T(n=>n===s?(D(r=>r==="asc"?"desc":"asc"),s):(D("desc"),s))},[]),K=i.useMemo(()=>{var n;const s=new Set;return Object.keys(((n=l.statistics)==null?void 0:n.tools)??{}).forEach(r=>s.add(r)),l.history.forEach(r=>{r.tool&&s.add(r.tool)}),l.historyToolFilter&&s.add(l.historyToolFilter),Array.from(s).sort()},[l.history,l.historyToolFilter,l.statistics]),j=i.useMemo(()=>{var s;return(s=l.statistics)!=null&&s.tools?Object.values(l.statistics.tools).map(n=>{var X;const r=Object.entries(n.commands??{}).map(([p,d])=>({toolName:n.tool,commandName:d.command??p,label:lt(n.tool,d.command??p)||(d.command??p),tier:d.tier,totalCalls:d.totalCalls,successCount:d.successCount,fallbackCount:d.fallbackCount,unsupportedCount:d.unsupportedCount,warningCount:d.warningCount??0,failureCount:d.failureCount,totalExecutionTimeMs:d.totalExecutionTimeMs,avgExecutionTimeMs:d.avgExecutionTimeMs})),f=r.reduce((p,d)=>p+d.totalCalls,0),v=r.reduce((p,d)=>p+d.successCount,0),$=r.reduce((p,d)=>p+d.fallbackCount,0),q=r.reduce((p,d)=>p+d.unsupportedCount,0),dt=r.reduce((p,d)=>p+d.warningCount,0),ut=r.reduce((p,d)=>p+d.failureCount,0),Z=r.reduce((p,d)=>p+d.totalExecutionTimeMs,0),pt=new Set(r.map(p=>p.tier)).size>1?"mixed":((X=r[0])==null?void 0:X.tier)??n.tier;return{toolName:n.tool,tier:pt,commands:r,totalCalls:f,successCount:v,fallbackCount:$,unsupportedCount:q,warningCount:dt,failureCount:ut,totalExecutionTimeMs:Z,avgExecutionTimeMs:f>0?Math.round(Z/f):0}}):[]},[l.statistics]),u=i.useCallback((s,n,r,f)=>e.jsx(M,{text:t(r,f),children:t(s,n)}),[t]),P=i.useCallback((s,n)=>{_.current=n,C(s)},[]),H=i.useCallback(()=>{C(null)},[]),z=i.useMemo(()=>[...j].sort((n,r)=>{const f=n[B],v=r[B];if(typeof f=="number"&&typeof v=="number")return x==="asc"?f-v:v-f;const $=String(f??""),q=String(v??"");return x==="asc"?$.localeCompare(q):q.localeCompare($)}),[j,B,x]),rt=i.useMemo(()=>[{key:"timestamp",label:u("tools.col.time","Time","tools.col.time.tooltip","When the tool run was recorded."),width:"80px",render:s=>Oe(s.timestamp)},{key:"toolName",label:u("tools.col.toolAction","Tool.Action","tools.col.toolAction.tooltip","Tool name and action that were executed."),render:s=>e.jsxs("span",{children:[st(s.tool,s.command),s.tier==="pro"&&e.jsx(M,{text:t("tools.badge.pro.tooltip","This entry used a Pro-only tool or action."),children:e.jsx("span",{className:a.proBadge,children:t("tools.badge.pro","PRO")})})]})},{key:"executionTimeMs",label:u("tools.col.duration","Duration","tools.col.duration.tooltip","How long the tool took to finish."),width:"80px",render:s=>W(s.executionTimeMs)},{key:"status",label:u("tools.col.status","Status","tools.col.status.tooltip","Outcome of the recorded tool run."),width:"120px",render:s=>{const n=ot(s,t);return e.jsx(M,{text:n.tooltip,children:e.jsx("span",{className:n.className,children:n.label})})}},{key:"tier",label:u("tools.col.tier","Tier","tools.col.tier.tooltip","License tier required for the tool or action."),width:"60px",render:s=>e.jsx("span",{className:s.tier==="pro"?a.tierPro:a.tierBasic,children:R(t,s.tier)})},{key:"details",label:t("tools.detail.open","Details"),width:"84px",render:s=>{const n=st(s.tool,s.command);return e.jsx("button",{type:"button",className:a.detailsButton,"aria-haspopup":"dialog","aria-label":t("tools.detail.openLabel","View details for {command}").replace("{command}",n),onClick:r=>{r.stopPropagation(),P(s,r.currentTarget)},children:t("tools.detail.open","Details")})}}],[P,t,u]),J=i.useMemo(()=>[{key:"toolName",label:u("tools.col.tool","Tool","tools.col.tool.tooltip","Consolidated tool name in the statistics table."),sortable:!0},{key:"totalCalls",label:u("tools.col.calls","Calls","tools.col.calls.tooltip","Total number of recorded calls for this tool."),sortable:!0,width:"70px"},{key:"successCount",label:u("tools.col.ok","OK","tools.col.ok.tooltip","Number of direct successful runs."),sortable:!0,width:"70px"},{key:"fallbackCount",label:u("tools.col.fallback","FALLBACK","tools.col.fallback.tooltip","Number of runs that succeeded through fallback execution."),sortable:!0,width:"110px"},{key:"unsupportedCount",label:u("tools.col.unsupported","UNSUPPORTED","tools.col.unsupported.tooltip","Number of blocked runs without fallback execution."),sortable:!0,width:"130px"},{key:"warningCount",label:u("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:u("tools.col.err","FAILED","tools.col.err.tooltip","Number of runs that failed."),sortable:!0,width:"70px"},{key:"avgExecutionTimeMs",label:u("tools.col.avgTime","Avg Time","tools.col.avgTime.tooltip","Average execution time across recorded calls."),sortable:!0,width:"90px",render:s=>W(s.avgExecutionTimeMs)},{key:"tier",label:u("tools.col.tier","Tier","tools.col.tierStats.tooltip","Basic, Pro, or Mixed summary for the tool statistics row."),sortable:!0,width:"70px",render:s=>e.jsx(M,{text:s.tier==="mixed"?t("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:s.tier==="pro"?a.tierPro:s.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(t,s.tier)})})}],[t,u]),L=i.useMemo(()=>{if(!l.statistics)return null;const s=l.statistics.tierSummary.basic.totalCalls,n=l.statistics.tierSummary.pro.totalCalls,r=s+n;if(r===0)return null;const f=Math.round(s/r*100),v=100-f;return{basic:s,pro:n,basicPct:f,proPct:v}},[l.statistics]),Q=i.useCallback(s=>{O(n=>n===s?null:s)},[]),it=i.useCallback(async()=>{if(m){F(!0);try{m==="history"?await l.clearHistory():await l.clearStatistics(),N(t("toast.clearSuccess","Cleared successfully"),"success"),E(null)}catch{N(t("toast.clearFailed","Failed to clear data"),"error")}finally{F(!1)}}},[m,N,t,l]),nt=i.useCallback(s=>{const n=s==="history"?"tools_history":"tools_statistics";o("dashboard_click_event",{click_target:s==="history"?"tools_tab_history":"tools_tab_statistics",page:"tools",tab:n}),c({page:"tools",tab:n}),C(null),h(s)},[o,c]),ct=["history","statistics"].map(s=>({key:s,label:t(`tools.tab.${s}`,s.charAt(0).toUpperCase()+s.slice(1))}));return e.jsxs("div",{className:a.page,children:[e.jsx(ft,{title:t("page.tools.title","Tools"),description:t("page.tools.description","Inspect tool history, outcomes, fallback details, and usage statistics."),helpTopicId:"tools"}),e.jsx(jt,{surface:"tools",selectable:!0,selectedPlaceId:k,onSelectedPlaceIdChange:s=>{C(null),b(s),l.setHistoryOffset(0)}}),e.jsx(yt,{items:ct,value:S,onChange:nt}),S==="history"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:t("tools.tab.history","History")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{o("dashboard_click_event",{click_target:"tools_clear_history",page:"tools",tab:"tools_history"}),E("history")},children:t("common.clear","Clear")})]}),e.jsx("div",{className:a.filterRow,children:e.jsxs("label",{className:a.filterLabel,children:[t("tools.filter.tool","Tool"),":",e.jsxs("select",{className:a.filterSelect,value:l.historyToolFilter,onChange:s=>{C(null),l.setHistoryToolFilter(s.target.value),l.setHistoryOffset(0)},children:[e.jsx("option",{value:"",children:t("tools.filter.all","All")}),K.map(s=>e.jsx("option",{value:s,children:s},s))]})]})}),e.jsx(vt,{columns:rt,data:l.history,rowKey:s=>s.id,onRowClick:(s,n)=>P(s,n),emptyMessage:t("tools.empty.history","No tool history entries for this place")}),e.jsxs("div",{className:a.pagination,children:[e.jsx("button",{className:a.btn,disabled:l.historyOffset===0,title:t("tools.page.prev.tooltip","Go to the previous page of tool history results."),onClick:()=>{C(null),l.setHistoryOffset(Math.max(0,l.historyOffset-G))},children:t("tools.page.prev","Prev")}),e.jsxs("span",{className:a.pageInfo,children:[l.historyOffset+1,"–",Math.min(l.historyOffset+G,l.historyTotal)," / ",l.historyTotal]}),e.jsx("button",{className:a.btn,disabled:!l.historyHasMore,title:t("tools.page.next.tooltip","Go to the next page of tool history results."),onClick:()=>{C(null),l.setHistoryOffset(l.historyOffset+G)},children:t("tools.page.next","Next")})]})]}),S==="statistics"&&e.jsxs("div",{className:a.card,children:[e.jsxs("div",{className:a.cardToolbar,children:[e.jsx("div",{className:a.sectionTitle,children:t("tools.tab.statistics","Statistics")}),e.jsx("button",{className:a.dangerButton,onClick:()=>{o("dashboard_click_event",{click_target:"tools_clear_statistics",page:"tools",tab:"tools_statistics"}),E("statistics")},children:t("common.clear","Clear")})]}),L&&e.jsxs("div",{className:a.tierDistribution,children:[e.jsxs("div",{className:a.tierBarWrap,children:[e.jsx("div",{className:a.tierBarBasic,style:{width:`${L.basicPct}%`}}),e.jsx("div",{className:a.tierBarPro,style:{width:`${L.proPct}%`}})]}),e.jsxs("div",{className:a.tierLabels,children:[e.jsxs("span",{children:[R(t,"basic")," ",L.basicPct,"% (",L.basic,")"]}),e.jsxs("span",{children:[R(t,"pro")," ",L.proPct,"% (",L.pro,")"]})]})]}),e.jsx("div",{className:a.statsTableWrap,children:e.jsxs("table",{className:a.statsTable,children:[e.jsx("thead",{children:e.jsx("tr",{children:J.map(s=>e.jsxs("th",{style:s.width?{width:s.width}:void 0,className:s.sortable?a.sortableHeader:void 0,onClick:s.sortable?()=>V(s.key):void 0,children:[e.jsx("span",{children:s.label}),s.sortable&&B===s.key&&e.jsx("span",{className:a.sortArrow,children:x==="asc"?"▴":"▾"})]},s.key))})}),e.jsx("tbody",{children:z.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:J.length,className:a.emptyStats,children:t("tools.empty.stats","No tool statistics for this place")})}):z.map(s=>{const n=U===s.toolName;return e.jsxs(i.Fragment,{children:[e.jsxs("tr",{className:a.statsToolRow,onClick:()=>Q(s.toolName),children:[e.jsx("td",{children:e.jsxs("button",{type:"button",className:a.expandButton,"aria-expanded":n,"aria-label":`${s.toolName} ${n?t("common.collapse","Collapse"):t("common.expand","Expand")}`,onClick:r=>{r.stopPropagation(),Q(s.toolName)},children:[e.jsx("span",{className:a.expandIcon,"aria-hidden":"true",children:n?"▾":"▸"}),e.jsx("span",{children:s.toolName})]})}),e.jsx("td",{children:s.totalCalls}),e.jsx("td",{children:s.successCount}),e.jsx("td",{children:s.fallbackCount}),e.jsx("td",{children:s.unsupportedCount}),e.jsx("td",{children:s.warningCount}),e.jsx("td",{children:s.failureCount}),e.jsx("td",{children:W(s.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx(M,{text:s.tier==="mixed"?t("tools.tier.mixed.tooltip","This tool includes both Basic and Pro actions."):"",children:e.jsx("span",{className:s.tier==="pro"?a.tierPro:s.tier==="mixed"?a.tierMixed:a.tierBasic,children:R(t,s.tier)})})})]}),n&&s.commands.map(r=>e.jsxs("tr",{className:a.statsActionRow,children:[e.jsx("td",{children:e.jsx("span",{className:a.actionLabel,children:r.label})}),e.jsx("td",{children:r.totalCalls}),e.jsx("td",{children:r.successCount}),e.jsx("td",{children:r.fallbackCount}),e.jsx("td",{children:r.unsupportedCount}),e.jsx("td",{children:r.warningCount}),e.jsx("td",{children:r.failureCount}),e.jsx("td",{children:W(r.avgExecutionTimeMs)}),e.jsx("td",{children:e.jsx("span",{className:r.tier==="pro"?a.tierPro:a.tierBasic,children:R(t,r.tier)})})]},`${s.toolName}:${r.commandName}`))]},s.toolName)})})]})}),l.statistics&&e.jsxs("div",{className:a.summaryLine,children:[t("tools.summary.total","Total"),": ",l.statistics.totalCalls," ",t("tools.summary.calls","calls")," | ",t("tools.summary.sessions","Sessions"),": ",l.statistics.totalSessions]})]}),e.jsx(gt,{open:w!==null,ariaLabel:t("tools.detail.dialogLabel","Tool execution detail"),onClose:H,returnFocusTo:_.current,testId:"tools-history-detail-popup-layer",children:w&&e.jsx(Ie,{entry:w,onClose:H})}),e.jsx(_t,{open:m!==null,title:m==="history"?t("tools.clear.history.title","Clear history?"):t("tools.clear.statistics.title","Clear statistics?"),message:m==="history"?t("tools.clear.history.message","This permanently removes the current place tools history."):t("tools.clear.statistics.message","This permanently resets the current place tool statistics."),cancelLabel:t("common.cancel","Cancel"),confirmLabel:t("common.clear","Clear"),loading:g,onCancel:()=>!g&&E(null),onConfirm:it})]})}export{ze as Component};
@@ -1 +1 @@
1
- import{j as i,i as r}from"./index-CJYQedSN.js";function p({text:o,children:t}){return i.jsx(r,{text:o,children:t})}export{p as T};
1
+ import{j as i,i as r}from"./index-B-46k2zD.js";function p({text:o,children:t}){return i.jsx(r,{text:o,children:t})}export{p as T};
@@ -1,4 +1,4 @@
1
- import{c as ke,m as W,h as Fe,r as g,u as k,j as t,b as E,R as ze,X as Ve,T as je,f as We,B as Ke}from"./index-CJYQedSN.js";import{I as R}from"./InfoLabel-CH5CpR7R.js";import{T as y}from"./TooltipText-DSn3s49K.js";import{C as Ye,P as Qe}from"./PageHeader-DfhSm4j-.js";import{D as le,c as ce,e as Je,g as Xe,h as Ze,i as ue,j as Ie,k as et,l as de,d as tt}from"./sample-requests-x7wuDmFr.js";import{C as it}from"./ContentScopedDialog-CO7HgbDh.js";import{A as pe}from"./AiPromptExamples-BLQgKnq1.js";import{B as st}from"./bot-BQBLv2uC.js";import{C as at,T as rt}from"./Tabs-D9FkOjPv.js";import"./copy-D8MSHyQE.js";import"./PlaceSelectOptions-CMtQalSy.js";/**
1
+ import{c as ke,m as W,h as Fe,r as g,u as k,j as t,b as E,R as ze,X as Ve,T as je,f as We,C as Ke}from"./index-B-46k2zD.js";import{I as R}from"./InfoLabel-xpwjU19F.js";import{T as y}from"./TooltipText-CKbtCUcM.js";import{C as Ye,P as Qe}from"./PageHeader-C7zSPJ0K.js";import{D as le,c as ce,e as Je,g as Xe,h as Ze,i as ue,j as Ie,k as et,l as de,d as tt}from"./sample-requests-Cb8_d2yO.js";import{C as it}from"./ContentScopedDialog-BcNAWEg1.js";import{A as pe}from"./AiPromptExamples-v7F0ZqtA.js";import{B as st}from"./bot-DBgSRd9L.js";import{C as at,T as rt}from"./Tabs-CJSfllHd.js";import"./copy-B53fec-q.js";import"./PlaceSelectOptions-e39l4_SC.js";/**
2
2
  * @license lucide-react v1.8.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ ._card_76vlh_2{position:relative;display:flex;flex-direction:column;gap:8px;padding:14px 16px;border:1px solid var(--border);border-radius:var(--radius);border-left-width:3px;background:var(--bg-card);scroll-margin-block:var(--space-page)}._card_76vlh_2:focus-visible{outline:2px solid var(--warning);outline-offset:2px}._cardUnread_76vlh_21{border-left-color:var(--accent)}._cardRead_76vlh_26{border-left-color:var(--text-muted)}._cardUnreadWarning_76vlh_31{border-width:1px;border-color:var(--warning-border);background:var(--warning-bg)}._topRow_76vlh_38{display:flex;align-items:center;gap:8px;flex-wrap:wrap}._categoryChip_76vlh_45{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;background:var(--accent-dim);color:var(--accent)}._versionChip_76vlh_58{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font-size:11px;font-weight:600;background:#7f8daa24;color:var(--text-secondary);font-family:var(--font-code)}._importantBadge_76vlh_70{display:inline-flex;align-items:center;padding:2px 8px;border:1px solid var(--warning-border);border-radius:var(--radius-sm);background:var(--warning-bg);color:var(--warning-text);font-size:11px;font-weight:800;letter-spacing:.04em}._date_76vlh_83{margin-left:auto;font-size:12px;color:var(--text-muted);white-space:nowrap}._title_76vlh_91{margin:0;font-size:var(--type-record-title-size);font-weight:700;color:var(--text-primary);line-height:var(--leading-title)}._body_76vlh_100{font-size:var(--type-body-size);color:var(--text-secondary);line-height:var(--leading-body);white-space:pre-wrap;word-break:break-word}._aiPrompt_76vlh_108{display:flex;flex-direction:column;gap:var(--space-related);padding:12px;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-secondary)}._aiPromptIntro_76vlh_118{display:flex;flex-direction:column;gap:3px;color:var(--text-primary);font-size:var(--type-body-size);line-height:var(--leading-body)}._aiPromptIntro_76vlh_118 span{color:var(--text-secondary)}._linkList_76vlh_131{display:flex;align-items:flex-start;flex-wrap:wrap;gap:8px}._link_76vlh_131{display:inline-flex;align-items:center;gap:4px;font-size:13px;color:var(--accent);text-decoration:none;font-weight:600}._link_76vlh_131:hover{text-decoration:underline}._internalLink_76vlh_153{min-height:44px;padding:0 14px;border:1px solid var(--border);border-radius:var(--radius-control);background:var(--bg-secondary);color:var(--text-primary);font-size:14px}._internalLink_76vlh_153:hover{border-color:var(--border-highlight);background:var(--accent-dim);text-decoration:none}._internalLink_76vlh_153:focus-visible{outline:none;box-shadow:var(--focus-ring)}._newBadge_76vlh_175{display:inline-flex;align-items:center;padding:1px 6px;border-radius:999px;font-size:10px;font-weight:800;letter-spacing:.06em;background:var(--error);color:#fff}._page_4653w_2{display:flex;flex-direction:column;gap:var(--space-page);max-width:720px}._section_4653w_10{display:flex;flex-direction:column;gap:var(--space-section)}._sectionTitle_4653w_16{display:flex;align-items:center;gap:var(--space-related);margin:0;font-size:var(--type-section-title-size);font-weight:600;color:var(--text-primary);text-transform:uppercase;letter-spacing:.06em}._unreadCount_4653w_28{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;font-size:11px;font-weight:700;background:var(--error);color:#fff}._empty_4653w_43{padding:32px 0;text-align:center;font-size:14px;color:var(--text-muted)}._divider_4653w_51{height:1px;background:var(--border);border:none;margin:0}
@@ -0,0 +1 @@
1
+ import{u as j,j as e,L as k,a1 as C,e as P,r as u,a2 as N}from"./index-B-46k2zD.js";import{P as I}from"./PageHeader-C7zSPJ0K.js";import{P as R}from"./PlaytestAiPromptExamples-DNcOx55_.js";import"./AiPromptExamples-v7F0ZqtA.js";import"./copy-B53fec-q.js";function f(s){return`announcement-${s}`}const b="_card_76vlh_2",L="_cardUnread_76vlh_21",A="_cardRead_76vlh_26",T="_cardUnreadWarning_76vlh_31",B="_topRow_76vlh_38",E="_categoryChip_76vlh_45",S="_versionChip_76vlh_58",U="_importantBadge_76vlh_70",$="_date_76vlh_83",W="_title_76vlh_91",M="_body_76vlh_100",z="_aiPrompt_76vlh_108",O="_aiPromptIntro_76vlh_118",V="_linkList_76vlh_131",Y="_link_76vlh_131",H="_internalLink_76vlh_153",q="_newBadge_76vlh_175",a={card:b,cardUnread:L,cardRead:A,cardUnreadWarning:T,topRow:B,categoryChip:E,versionChip:S,importantBadge:U,date:$,title:W,body:M,aiPrompt:z,aiPromptIntro:O,linkList:V,link:Y,internalLink:H,newBadge:q},D={release:"whatsNew.category.release",notice:"whatsNew.category.notice",deprecation:"whatsNew.category.deprecation",tip:"whatsNew.category.tip"};function v({announcement:s,isNew:d}){var w;const{locale:h,t:i}=j(),c=d?a.cardUnread:a.cardRead,o=s.severity==="warning",p=o&&d?a.cardUnreadWarning:"",x=s.title[h]??s.title.en,_=s.body[h]??s.body.en,m=s.links??(s.link?[s.link]:[]),l=f(s.id),g=t=>typeof t=="string"?t:t[h]??t.en;return e.jsxs("article",{id:l,tabIndex:-1,"aria-labelledby":`${l}-title`,className:`${a.card} ${c} ${p}`,children:[e.jsxs("div",{className:a.topRow,children:[e.jsx("span",{className:a.categoryChip,children:i(D[s.category])}),o&&e.jsx("span",{className:a.importantBadge,children:i("whatsNew.importantBadge","IMPORTANT")}),s.version&&e.jsx("span",{className:a.versionChip,children:s.version}),d&&e.jsx("span",{className:a.newBadge,children:i("whatsNew.newBadge","NEW")}),e.jsx("span",{className:a.date,children:s.date})]}),e.jsx("h3",{id:`${l}-title`,className:a.title,children:x}),e.jsx("p",{className:a.body,children:_}),((w=s.aiPrompt)==null?void 0:w.kind)==="playtest-values"&&e.jsxs("div",{className:a.aiPrompt,children:[e.jsxs("div",{className:a.aiPromptIntro,children:[e.jsx("strong",{children:i("playtest.emptyValues.aiTitle","Ask AI")}),e.jsx("span",{children:i("playtest.emptyValues.aiDescription","Copy a request and paste it into an AI chat connected to WEPPY.")})]}),e.jsx(R,{exampleIds:[s.aiPrompt.exampleId]})]}),m.length>0&&e.jsx("div",{className:a.linkList,children:m.map(t=>{const n=g(t.url),y=g(t.label);return n.startsWith("/")?e.jsx(k,{className:`${a.link} ${a.internalLink}`,to:n,children:y},n):e.jsxs("a",{className:a.link,href:n,target:"_blank",rel:"noopener noreferrer",children:["↗"," ",y]},n)})})]})}const G="_page_4653w_2",K="_section_4653w_10",F="_sectionTitle_4653w_16",J="_unreadCount_4653w_28",Q="_empty_4653w_43",X="_divider_4653w_51",r={page:G,section:K,sectionTitle:F,unreadCount:J,empty:Q,divider:X};function ne(){const{t:s}=j(),{readSet:d,markRead:h}=C(),{search:i}=P(),c=new URLSearchParams(i).get("announcement");u.useEffect(()=>{if(!c||!N.some(n=>n.id===c))return;const t=document.getElementById(f(c));t==null||t.scrollIntoView({block:"start"}),t==null||t.focus({preventScroll:!0})},[c]);const o=u.useMemo(()=>{const t=[];for(const n of N)d.has(n.id)||t.push(n.id);return t},[]),p=u.useRef(o);p.current=o,u.useEffect(()=>()=>{p.current.length>0&&h(p.current)},[]);const x=u.useMemo(()=>new Set(o),[o]),_=N.filter(t=>x.has(t.id)),m=N.filter(t=>!x.has(t.id)),l=_.length>0,g=m.length>0,w=e.jsx(I,{title:s("whatsNew.pageTitle","What's New"),description:s("whatsNew.pageSubtitle","Stay up to date with MCP changes"),helpTopicId:"whatsNew"});return N.length===0?e.jsxs("div",{className:r.page,children:[w,e.jsx("p",{className:r.empty,children:s("whatsNew.empty","No announcements yet")})]}):e.jsxs("div",{className:r.page,children:[w,l&&e.jsxs("section",{className:r.section,children:[e.jsxs("h2",{className:r.sectionTitle,children:[s("whatsNew.unreadSection","Unread"),e.jsx("span",{className:r.unreadCount,children:_.length})]}),_.map(t=>e.jsx(v,{announcement:t,isNew:!0},`unread-${t.id}`))]}),l&&g&&e.jsx("hr",{className:r.divider}),g&&e.jsxs("section",{className:r.section,children:[e.jsx("h2",{className:r.sectionTitle,children:s("whatsNew.allSection","All Announcements")}),m.map(t=>e.jsx(v,{announcement:t,isNew:!1},`all-${t.id}`))]})]})}export{ne as Component};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./index-CJYQedSN.js";/**
1
+ import{c as t}from"./index-B-46k2zD.js";/**
2
2
  * @license lucide-react v1.8.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-CJYQedSN.js";/**
1
+ import{c}from"./index-B-46k2zD.js";/**
2
2
  * @license lucide-react v1.8.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./index-CJYQedSN.js";/**
1
+ import{c}from"./index-B-46k2zD.js";/**
2
2
  * @license lucide-react v1.8.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.