limixbot 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActivityPanel-BJ-KjzZQ.js → ActivityPanel-SyXMCej4.js} +1 -1
- package/dist/assets/{App-B88ABHQh.js → App-X_zk2xl3.js} +9 -9
- package/dist/assets/{AppEventEditor-C1j7B-on.js → AppEventEditor-B-cNA9KG.js} +1 -1
- package/dist/assets/{BotSettingsDialog-CVVgZ_Nc.js → BotSettingsDialog-CmheslCU.js} +1 -1
- package/dist/assets/{BrowserPanel-DD7r9HOn.js → BrowserPanel-BHNWYfsE.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-D1rUYWVD.js → BrowserProfilesManager-TkQi-a3T.js} +1 -1
- package/dist/assets/{CloudAddDialog-CZhJqPdM.js → CloudAddDialog-CqMPQ-0_.js} +1 -1
- package/dist/assets/{ComputerFilesPane-B1y88sYp.js → ComputerFilesPane-C2_Khy6Z.js} +1 -1
- package/dist/assets/{ComputerPanel-DBvlrkN9.js → ComputerPanel-Zc6gSPqv.js} +2 -2
- package/dist/assets/{DataPanel-Bu3s4f1H.js → DataPanel-BQfys1jK.js} +1 -1
- package/dist/assets/{DesktopViewer-D_Tc0DtD.js → DesktopViewer-CmQvv2Qp.js} +1 -1
- package/dist/assets/{FilesView-DwGmVJUN.js → FilesView-DIvdjTfH.js} +1 -1
- package/dist/assets/{GrokMoveDialog-f1ta87oZ.js → GrokMoveDialog-ClB9Gmym.js} +1 -1
- package/dist/assets/{InspectorPanel-D0_Z99j4.js → InspectorPanel-D86H4VDB.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-CEwkgGoB.js → KeyboardShortcutsModal--OBnvszl.js} +1 -1
- package/dist/assets/{LiveDesktop-E6f1BBs1.js → LiveDesktop-qaS7h5XB.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-D6Eotsee.js → LocalVmWorkspace-B-P5zHz6.js} +1 -1
- package/dist/assets/{MacLocalControl-B3YOye-H.js → MacLocalControl-BYNcLKoB.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-BLGAemwy.js → MarkdownFilePreview-DlUycNRH.js} +1 -1
- package/dist/assets/{MenuMotion-vm5ldfak.js → MenuMotion-V6wxTHIu.js} +1 -1
- package/dist/assets/{NewBotDialog-B2X4qm4R.js → NewBotDialog-oiX-W3q2.js} +1 -1
- package/dist/assets/{PhoneAppDialog-hQoVtk6q.js → PhoneAppDialog-PE1xfgqx.js} +1 -1
- package/dist/assets/{PlacesRail-0dNv7oZB.js → PlacesRail-B9RHHjvB.js} +1 -1
- package/dist/assets/{PluginsPanel-DtdtIk9h.js → PluginsPanel-DObrpruo.js} +1 -1
- package/dist/assets/{ProIntroduction-B7TckG4N.js → ProIntroduction-CC1iFzJ8.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-DxXqwhrm.js → RemoteAgentSettingsPanel-BmTQFEnJ.js} +1 -1
- package/dist/assets/{RoomPanel-FwiCG8NY.js → RoomPanel-Dqe-JRuH.js} +1 -1
- package/dist/assets/{RoutinesPage-D7e6qR1n.js → RoutinesPage-DF0vugaB.js} +1 -1
- package/dist/assets/{SettingsModal-DBR7IGpo.js → SettingsModal--kx8POGb.js} +1 -1
- package/dist/assets/{ShareTeamDialog-TxtG8d2Y.js → ShareTeamDialog-CAAPet8R.js} +1 -1
- package/dist/assets/{SignedInSites-CVRfJGQY.js → SignedInSites-DMOzwYFf.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-NG1mKW-M.js → TeamLibraryPanel-D4zeyxsY.js} +1 -1
- package/dist/assets/{TeamMapPage-j9euCmPt.js → TeamMapPage-DG7S7JTR.js} +1 -1
- package/dist/assets/{TriggersPage-rajjjJ3z.js → TriggersPage--3O5UVSD.js} +1 -1
- package/dist/assets/{VisibilitySection-BVTc_bLr.js → VisibilitySection-DQw13aWS.js} +1 -1
- package/dist/assets/{WebhookTrigger-Bap1eB3c.js → WebhookTrigger-D9RAfcql.js} +1 -1
- package/dist/assets/{WorksOnGrid-BH9WTY-z.js → WorksOnGrid-CviOksXp.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-DCjLKsgc.js → abnfDiagram-YUKMZFIV-BLZgYnje.js} +1 -1
- package/dist/assets/{activity-BjR5nw9Z.js → activity-DCHcmn3c.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-DhdUk3XR.js → architectureDiagram-47P4ROYG-D0neESJD.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-CJN1G2VQ.js → blockDiagram-E7TT5TSB-CrnkLSzZ.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-BfkzahxK.js → c4Diagram-CRA5TL53-D0tNc6O-.js} +1 -1
- package/dist/assets/{calendar-days-DlTxBFXF.js → calendar-days-C5I0mEXB.js} +1 -1
- package/dist/assets/channel-uYq3EMr8.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-BwH3UOL3.js → chunk-2Q5K7J3B-DGtBJhY1.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-qo9dxZfl.js → chunk-5VM5RSS4-D5kTbdEy.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-B_b-TvDW.js → chunk-7TKQ45FW-DaN8eX-m.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-DTVjfWfo.js → chunk-AW2ZBBNX-DMhIBKZU.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3-6Ej1chkf.js → chunk-FVRAUYC3-Dos86Pqk.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-dGKAv3Ly.js → chunk-HTAEGDNF-CsLodVYj.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-Dl30Op6i.js → chunk-JWPE2WC7-6THZlDrB.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-C7I5DprK.js → chunk-KQW6MTUR-CoD74fHy.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-niGkH3Wm.js → chunk-XXDRQBXY-DMl-0hJf.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-DV3eJqTd.js → classDiagram-v2-K4WV4PDN-BscLWNpw.js} +1 -1
- package/dist/assets/{coins-DEObq6EM.js → coins-CZu-SgM9.js} +1 -1
- package/dist/assets/{core-CQuzVAof.js → core-BDlOAqLn.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-Dw675nir.js → cose-bilkent-JH36ORCC-BeKB4nW9.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-rM_Vx_Nc.js → cynefin-EF2NZ3EQ-D0aWGmzz.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-LQIlP8_F.js → cynefinDiagram-3GCD6N5R-4SW-h53B.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-DIGKS0Jz.js → dagre-W4DXFKR2-DNq2AGoj.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-DHcKf8Wa.js → diagram-2UJZ2QOL-lSLAkRD3.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-CaakNCyA.js → diagram-OVF4WLC6-BHf__HqF.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-BQTgTfVh.js → diagram-PFPMY2P6-B5YmPbc0.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-Dz4tiefj.js → diagram-UMYRVEAY-DdOUcYJA.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-4K0yWjUe.js → diagram-YEKJPTXX-r41O-hkk.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-rWWlZtci.js → diagram-ZIFT7M5P-DKV_3_Sr.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-QPG43w9u.js → ebnfDiagram-VR2GEFS7-CD4xgv0O.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-hRSqsqP_.js → elk-IJKZMXRS-D0Vwqj3g.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-V8e4toBc.js → erDiagram-O2IAPWRE-C388tpIL.js} +1 -1
- package/dist/assets/{file-up-DY1vL6py.js → file-up-DGhlT3MD.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-Cz7Ay48V.js → flowDiagram-OXPTDLAJ-B1p6s4tu.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-CI6nugxH.js → ganttDiagram-R7TSEDQI-BzJAoXbd.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-BjtDxt_s.js → gitGraphDiagram-XJZIOB7I-Bb3SHitI.js} +1 -1
- package/dist/assets/{import-name-DqzojGXy.js → import-name-B7AGian6.js} +1 -1
- package/dist/assets/{index-BfUxIMI-.js → index-C-EiNxm_.js} +1 -1
- package/dist/assets/{index-BjLGGSd_.js → index-CmUdQ2of.js} +1 -1
- package/dist/assets/{index-BiSZ69F2.js → index-DJPPxxyF.js} +2 -2
- package/dist/assets/{infoDiagram-5W2HQ5XZ-B7kSPI8x.js → infoDiagram-5W2HQ5XZ-DUF-NVrB.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-B80aI5uW.js → ishikawaDiagram-K3B6WC7H-CITswxnS.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-CjxmU5O_.js → journeyDiagram-COXZFDF6-C8xhr3tj.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-BIU0Q11m.js → kanban-definition-P3RFRI5V-C94FCxQq.js} +1 -1
- package/dist/assets/{mcp-servers-LGwHCvUp.js → mcp-servers-Cu4E6BBW.js} +1 -1
- package/dist/assets/{mermaid.core-C9748YDA.js → mermaid.core-5_WMXhyJ.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-C_QDmkR_.js → mindmap-definition-LZFPQGKD-Dgq8HUHz.js} +1 -1
- package/dist/assets/{minimize-DxmLA74X.js → minimize-C8Om8qhk.js} +1 -1
- package/dist/assets/{monitor-saVltJVe.js → monitor-DUEBF6Jm.js} +1 -1
- package/dist/assets/{new-bot-BdMgVWOM.js → new-bot-DKmgM4tN.js} +1 -1
- package/dist/assets/{org-library-DWY9-OyC.js → org-library-BqY2D4NK.js} +1 -1
- package/dist/assets/{package-format-CqLquC8E.js → package-format-BZOfdy7w.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-CWQyllhq.js → pegDiagram-BGZESJAR-DM0SAjez.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-BXx9zdy3.js → pieDiagram-CAPJLFHJ-okeIqCL5.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-CT3VU9ss.js → quadrantDiagram-GDMTTRAM-ihMGhHs3.js} +1 -1
- package/dist/assets/{rail-DDUwvn54.js → rail-JcqaOG9e.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-DsZVUfT9.js → railroadDiagram-SM67HX2B-CkWYP-ib.js} +1 -1
- package/dist/assets/{remote-desktop-panel-B-L_Sc4G.js → remote-desktop-panel-ij2w_JZy.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-DieBBfKD.js → requirementDiagram-X7JNWC4A-CSZ3nQJ1.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-D1n5IJ1M.js → sankeyDiagram-UM26HJRW-RL7DTxjH.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-Cn7_MLcn.js → sequenceDiagram-ZO4K6R2Y-C6MjuYtv.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BCwe4Nln.js → sizeCapture-INFHLROL-QtHNQM-7.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-Dpy7t5Eb.js → stateDiagram-v2-TBUQTH76-CwPZ7nQm.js} +1 -1
- package/dist/assets/{styles-Df9bbQa1.js → styles-Bj-lDRZL.js} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-CAY2xzWw.js → swimlanes-N4OXWK64-BfcwKeNi.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-D3m_eGXn.js +8 -0
- package/dist/assets/{team-share-B5XghBFg.js → team-share-BQnZfIPS.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-ClPw93T0.js → timeline-definition-YOQAKGHF-COZpJ85U.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-Bodg7BA2.js → usecaseDiagram-VIAY4XPW-B6vldE5m.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-jHU0_O9m.js → vennDiagram-BLWOH2XV-Cmgzf72_.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-Bqb5Ov5q.js → wardleyDiagram-YMQ3BMBF-XlosqW3x.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-cNVR4g0S.js → xychartDiagram-TAQBALBS-Byro5SJm.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/index.js +1 -1
- package/dist-server/package.json +1 -1
- package/dist-server/server/brand.js +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-BAivii3N.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-25FmnC_u.js +0 -8
package/dist/assets/{BrowserProfilesManager-D1rUYWVD.js → BrowserProfilesManager-TkQi-a3T.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t,r as y,j as s}from"./styles-
|
|
1
|
+
import{t,r as y,j as s}from"./styles-Bj-lDRZL.js";import{W as Z,u as _,bb as ee,D as R,G as se,T as te,n as B,A as z}from"./App-X_zk2xl3.js";import{r as ne,i as ie}from"./index-DJPPxxyF.js";import{S as q}from"./SignedInSites-DMOzwYFf.js";import{P as re}from"./PlacesRail-B9RHHjvB.js";function G(i){return i.map(({id:l,name:x,browser:c})=>({id:l,name:x,...c?{browser:c}:{}}))}function ae(i,l){return{browserProfiles:G(l),expectedBrowserProfiles:G(i)}}function oe(){return`profile-${Z().replaceAll("-","")}`}function J(i,l){const x=i.filter(g=>g.browserProfile===l&&g.busy);if(!x.length)return null;const c=x.map(g=>g.name).join(", ");return x.length===1?t("settings.profiles.busyOne",{names:c}):t("settings.profiles.busyMany",{names:c})}function le(i,l){return i&&l?{threadId:l}:{}}function ue(i,l){const x=new URLSearchParams(l).toString();return x?`${i}${i.includes("?")?"&":"?"}${x}`:i}function pe({bot:i,onProfileChanged:l,disabled:x=!1}){const{state:c,dispatch:g,flushBotPatches:W}=_(),r=c.config?.browserProfiles??[],v=c.config?.browserEngine?.myChrome===!0,b=c.config?.browserEngine?.myChromeOn,E=c.config?.browserEngine?.myChromeLendable===!0,w=c.bots??[],o=i?w.find(e=>e.id===i.id)??i:void 0,[O,L]=y.useState(null),[S,f]=y.useState(!1),[N,A]=y.useState(""),[h,j]=y.useState(null),[F,u]=y.useState(""),k=y.useId(),a=S||x||O!==!0;y.useEffect(()=>{let e=!0;return ne().then(n=>{e&&L(ie(n))}),()=>{e=!1}},[]);const T=async e=>{if(u(e instanceof Error?e.message:t("settings.profiles.saveError")),e instanceof z&&e.status===409)try{const n=await B("/api/config");g({type:"configStatus",config:n})}catch{u(t("settings.profiles.refreshError"))}e instanceof z&&(e.status===401||e.status===403)&&L(!1)},C=async e=>{try{const n=await B("/api/config",{method:"PATCH",body:JSON.stringify(ae(r,e))});return g({type:"configStatus",config:n}),!0}catch(n){return await T(n),!1}},K=async()=>{if(!(a||!N.trim()||r.length>=20)){f(!0),u("");try{await C([...r,{id:oe(),name:N.trim()}])&&A("")}finally{f(!1)}}},Q=async()=>{if(!(a||!h?.name.trim())){if(!r.some(e=>e.id===h.id)){u(t("settings.profiles.removed"));return}f(!0),u("");try{await C(r.map(e=>e.id===h.id?{...e,name:h.name.trim()}:e))&&j(null)}finally{f(!1)}}},V=async e=>{if(a)return;const n=J(w,e.id);if(n)return u(n);const p=w.filter(m=>m.browserProfile===e.id),$=p.length?` ${t("settings.profiles.deleteUsers",{names:p.map(m=>m.name).join(", ")})}`:"";if(window.confirm(t("settings.profiles.confirm",{name:e.name,bots:$}))){f(!0),u("");try{await C(r.filter(m=>m.id!==e.id))&&(h?.id===e.id&&j(null),o?.browserProfile===e.id&&l?.())}finally{f(!1)}}},X=async(e,n)=>{if(!(a||(e.browser??"")===n)){f(!0),u("");try{await C(r.map(p=>p.id===e.id?{...p,browser:n==="chrome"?"chrome":void 0}:p))}finally{f(!1)}}},Y=async e=>{if(!(a||!o||o.busy||e===(o.browserProfile??""))){f(!0),u("");try{await W(o.id);const n=await B(`/api/bots/${encodeURIComponent(o.id)}`,{method:"PATCH",body:JSON.stringify({browserProfile:e||null})});g({type:"botPatched",bot:n.bot}),l?.()}catch(n){await T(n)}finally{f(!1)}}};if(O===!1)return s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.profiles.ownerOnly")});const I="min-w-0 flex-1 rounded-md border border-hairline/40 bg-inset px-2.5 py-2 text-[13px] text-ink outline-none focus:border-accent disabled:opacity-50",P="shrink-0 rounded-md bg-control px-2.5 py-2 text-[12px] text-ink hover:bg-raised-hover disabled:opacity-50",d=o?.browserProfile??"",M=r.find(e=>e.id===d),U=e=>w.filter(n=>n.browserProfile===e).map(n=>n.name),D=e=>e?.browser==="chrome"&&(v||E),H=s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.profiles.myChromeHint")}),b&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.profiles.myChromeLent",{name:b.name,device:ee(b.device)})}),b?.online===!1&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.profiles.myChromeLentOffline",{name:b.name})})]});return s.jsxs("div",{className:"flex min-w-0 flex-col gap-3","aria-busy":S,children:[o&&s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsx("label",{htmlFor:`${k}-profile`,className:"text-[12px] font-medium text-ink",children:t("settings.profiles.browserSession")}),s.jsxs(R,{className:"w-full",id:`${k}-profile`,value:d,disabled:a||o.busy,onChange:e=>{Y(e.target.value)},children:[s.jsx("option",{value:"",children:t("settings.profiles.own")}),r.map(e=>s.jsx("option",{value:e.id,children:e.name},e.id)),s.jsx("option",{value:"guest",children:t("settings.profiles.temporary")}),d&&d!=="guest"&&!r.some(e=>e.id===d)?s.jsx("option",{value:d,disabled:!0,children:t("settings.profiles.removed")}):null]}),s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:o.busy?t("settings.profiles.stopToSwitch"):d==="guest"?t("settings.profiles.temporaryHint"):t("settings.profiles.sharedHint")}),D(M)?s.jsxs(s.Fragment,{children:[H,!v&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t("settings.profiles.myChromeShare")})]}):(d===""||M)&&s.jsx(q,{target:{bot:o.id},scope:le(c.config?.team,i?.threadId),sharedBy:d?U(d):[o.name],disabled:a},`${o.id}:${d}`)]}),s.jsxs("details",{open:!o,className:"min-w-0",children:[s.jsx("summary",{className:"cursor-pointer text-[12px] font-medium text-ink-secondary hover:text-ink",children:t("settings.profiles.manage")}),s.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[s.jsxs("form",{className:"flex flex-wrap gap-2",onSubmit:e=>{e.preventDefault(),K()},children:[s.jsx("label",{htmlFor:`${k}-new`,className:"sr-only",children:t("settings.profiles.newName")}),s.jsx("input",{id:`${k}-new`,value:N,onChange:e=>A(e.target.value),maxLength:40,required:!0,disabled:a||r.length>=20,placeholder:t("settings.profiles.newName"),className:I}),s.jsxs("button",{type:"submit",disabled:a||!N.trim()||r.length>=20,className:`${P} flex items-center gap-1`,children:[s.jsx(re,{size:13}),t("settings.profiles.create")]})]}),r.length>=20&&s.jsx("p",{className:"text-[11px] text-ink-secondary",children:t("settings.profiles.limit")}),!v&&r.length>0&&s.jsx("p",{className:"text-[11px] leading-relaxed text-ink-secondary",children:t(E?"settings.profiles.myChromeShare":"settings.profiles.myChromeUnavailable")}),!r.length&&s.jsx("p",{className:"text-[12px] text-ink-secondary",children:t("settings.profiles.sharedEmpty")}),s.jsx("div",{className:"divide-y divide-hairline/30",children:r.map(e=>{const n=U(e.id),p=J(w,e.id),$=D(e);return s.jsxs("div",{className:"flex flex-col gap-1 py-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx(se,{size:14,className:"shrink-0 text-ink-secondary"}),h?.id===e.id?s.jsxs("form",{className:"flex min-w-0 flex-1 flex-wrap gap-2",onSubmit:m=>{m.preventDefault(),Q()},children:[s.jsx("input",{autoFocus:!0,value:h.name,onChange:m=>j({id:e.id,name:m.target.value}),maxLength:40,required:!0,disabled:a,className:I,"aria-label":t("settings.profiles.nameAria")}),s.jsx("button",{type:"submit",disabled:a||!h.name.trim(),className:P,children:t("common.save")}),s.jsx("button",{type:"button",disabled:S,onClick:()=>j(null),className:P,children:t("common.cancel")})]}):s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",disabled:a,onClick:()=>{j({id:e.id,name:e.name}),u("")},className:"min-w-0 flex-1 truncate text-left text-[13px] font-medium text-ink hover:underline disabled:opacity-50",title:t("settings.profiles.rename"),children:e.name}),s.jsxs("button",{type:"button",onClick:()=>{V(e)},disabled:a||!!p,title:p??t("settings.profiles.deleteTitle"),"aria-label":`${t("common.delete")} ${e.name}`,className:"flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[12px] text-ink-secondary hover:bg-control hover:text-danger disabled:opacity-50",children:[s.jsx(te,{size:13}),t("common.delete")]})]})]}),s.jsx("p",{className:"break-words pl-6 text-[11px] text-ink-secondary",children:n.length?t("settings.profiles.usedBy",{names:n.join(", ")}):t("settings.profiles.notInUse")}),s.jsxs("div",{className:"flex min-w-0 flex-col gap-2 pl-6 pt-1",children:[s.jsxs("label",{className:"flex items-center gap-2 text-[12px] text-ink-secondary",children:[t("settings.profiles.browserLabel"),s.jsxs(R,{size:"sm",value:e.browser??"",disabled:a,onChange:m=>{X(e,m.target.value)},children:[s.jsx("option",{value:"",children:t("settings.profiles.builtIn")}),s.jsx("option",{value:"chrome",disabled:!v,children:t("settings.profiles.myChrome")})]})]}),$?H:s.jsx(q,{target:{profile:e.id},sharedBy:n,disabled:a})]})]},e.id)})})]})]}),F&&s.jsx("p",{role:"alert",className:"text-[12px] text-danger",children:F})]})}export{pe as B,le as b,ue as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,M as q,N as ve,O as M,t as n,Q as se,T as X,U as Y,V as He,W as pe,Y as Ce,u as Ee,Z as fe,$ as ze,a0 as Ae,a1 as Ue,a2 as qe,a3 as Me,a4 as Q,a as ue,a5 as $e,a6 as Ke,r as d,a7 as We,a8 as Ve,a9 as we,K as U,aa as Ge,X as Qe,ab as Xe,ac as Ye,ad as Je,ae as Ze,af as et,ag as Le,ah as tt}from"./styles-Df9bbQa1.js";import{L as nt,y as st,C as at,z as lt,F as ot,G as rt,S as dt,H as ct,I as it}from"./PlacesRail-0dNv7oZB.js";import{u as ut}from"./App-B88ABHQh.js";import"./monitor-saVltJVe.js";import"./index-BiSZ69F2.js";import"./MenuMotion-vm5ldfak.js";function pt({name:t,color:l,busy:o,interest:r,openFailed:s,onInterest:p,onOpen:f}){return e.jsxs("div",{"data-cloud-add":"has-cloud",className:q,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ve,{color:l,size:32}),e.jsx(M,{title:n("cloudBuy.one.title"),sub:n("cloudBuy.one.sub",{name:t})})]}),e.jsxs("div",{className:se,children:[r!=="sent"&&e.jsx("button",{type:"button",className:X,disabled:o,onClick:p,children:n("cloudBuy.one.email")}),e.jsx("button",{type:"button",className:Y,disabled:o,onClick:f,children:n("cloudBuy.setup.open",{name:t})})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[r==="sent"&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.one.thanks")}),r==="failed"&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.one.failed")}),s&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.openFailed",{name:t})})]})]})}function ie({kind:t,line:l,onRetry:o,onClose:r}){return e.jsxs("div",{"data-cloud-add":t,className:q,children:[e.jsx(M,{title:n("cloudAdd.title")}),l?e.jsx("p",{role:"alert",className:"text-[14px] leading-5 text-ink",children:l}):e.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] leading-[18px] text-ink-secondary",children:[e.jsx(nt,{size:14,className:"animate-spin motion-reduce:animate-none","aria-hidden":"true"}),n("cloudAdd.checking")]}),e.jsxs("div",{className:se,children:[e.jsx("button",{type:"button",className:X,onClick:r,children:n("cloudAdd.close")}),o&&e.jsx("button",{type:"button",className:Y,onClick:o,children:n("cloudAdd.tryAgain")})]})]})}function ft({plan:t,offer:l,browser:o,late:r,link:s,email:p,busy:f,copied:v,failed:N,onReopen:k,onCopy:T,onChangePlan:$}){const y=l?.plans.find(K=>K.tier===t)??null,E=y?He(y):pe(t),A=y?.trialDays===1?n("cloudBuy.pay.planTrial.one",{plan:E,due:Ce(0)}):y?.trialDays?n("cloudBuy.pay.planTrial.many",{plan:E,days:y.trialDays,due:Ce(0)}):y?n("cloudBuy.pay.planPaid",{plan:E,price:Ee(y.amount/100)}):E;return e.jsxs("div",{"data-cloud-add":r?"waiting-late":o==="signin"?"waiting-signin":"waiting",className:q,children:[e.jsx(M,{title:r?n("cloudBuy.pay.lateTitle"):n("cloudAdd.browserTitle"),sub:r?n("cloudBuy.pay.lateSub"):n(o==="signin"?"cloudBuy.pay.subSignIn":"cloudBuy.pay.sub")}),e.jsx(fe,{items:[{key:"signed-in",state:"done",title:n("cloudBuy.pay.signedIn"),detail:p},{key:"payment",state:"now",title:n("cloudBuy.pay.waiting"),detail:A},{key:"setup",state:"next",title:n("cloudBuy.pay.setup"),detail:n("cloudBuy.pay.setupHint")}]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",className:r?Y:X,disabled:f,onClick:k,children:[e.jsx(st,{size:14,"aria-hidden":"true"}),n("cloudAdd.reopenCheckout")]}),s&&e.jsxs("button",{type:"button",className:X,disabled:f,onClick:T,children:[e.jsx(at,{size:14,"aria-hidden":"true"}),n("cloudBuy.pay.copy")]}),e.jsx("button",{type:"button",className:`${ze} ms-1 px-1 py-1`,onClick:$,children:n("cloudAdd.changePlan")})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[v&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.pay.copied")}),N&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.pay.failed")})]})]})}const P=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudBuy.step.starting"],["checking","cloudHome.step.checking"]];function mt({tier:t,trial:l,credit:o},r){if(r)return n("cloudAdd.receivedTitle");const s=pe(t??l?.tier??void 0);return l?o?n("cloudBuy.setup.badgeCredit",{plan:s,credit:Ee(o.grantedUsd)}):n("cloudBuy.setup.badgeTrial",{plan:s}):n("cloudBuy.setup.badgePaid",{plan:s})}function xt({started:t,received:l,step:o,slow:r,ready:s,sleeps:p=!1,name:f,typed:v,color:N,counting:k,busy:T,openFailed:$,onName:y,onColor:E,onOpen:A,onNotNow:K}){const D=s?P.length:Math.max(0,P.findIndex(([c])=>c===o)),C=pe(t.tier??t.trial?.tier??void 0);return e.jsxs("div",{"data-cloud-add":s?"ready":l?"received":"starting","data-cloud-setup":s?"ready":o??"reserving",className:q,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ue,{children:mt(t,l)}),e.jsx(M,{title:s?n("cloudBuy.ready.title",{name:f}):n("cloudBuy.setup.title"),sub:s?n("cloudBuy.ready.sub"):l?n("cloudAccount.purchaseNoteNoDate"):n("cloudBuy.setup.sub")})]}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ae,{value:D/P.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:P.map(([c,w],j)=>({key:c,title:n(w,{name:f}),state:j<D?"done":j===D?"now":"next"}))}),r&&!s&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"cloud-add-name",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.name")}),e.jsx("input",{id:"cloud-add-name",value:v,maxLength:Me,placeholder:n("cloudSetup.myCloud"),autoComplete:"off",spellCheck:!1,onChange:c=>y(c.target.value),className:qe})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{id:"cloud-add-color",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.color")}),e.jsx("div",{role:"radiogroup","aria-labelledby":"cloud-add-color",className:"flex flex-wrap gap-2",children:Q.map(c=>e.jsx("button",{type:"button",role:"radio","aria-checked":c===N,"aria-label":n(Ke[c]),tabIndex:c===N?0:-1,"data-color":c,onClick:()=>E(c),onKeyDown:w=>{const j=Q.indexOf(c),W=w.key==="ArrowRight"||w.key==="ArrowDown"?1:w.key==="ArrowLeft"||w.key==="ArrowUp"?-1:0;if(!W)return;w.preventDefault();const J=Q[(j+W+Q.length)%Q.length];E(J),w.currentTarget.parentElement?.querySelector(`[data-color="${J}"]`)?.focus()},style:{background:$e(c)},className:ue("size-[26px] rounded-lg border-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",c===N?"border-ink shadow-[inset_0_0_0_2px_var(--color-app)]":"border-transparent")},c))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.preview")}),e.jsxs("span",{"data-cloud-preview":!0,className:"inline-flex max-w-full items-center gap-2 self-start rounded-[12px] border-[0.5px] border-ink/10 bg-menu py-1.5 pe-3 ps-1.5",children:[e.jsx(ve,{color:N}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium leading-4 text-ink",children:f}),e.jsx("span",{className:"block truncate text-[12px] text-ink-tertiary",children:n(p?"cloudBuy.setup.previewLineSleeps":"cloudBuy.setup.previewLine",{plan:C})})]})]})]})]})]}),s&&k===null&&e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:f})}),e.jsxs("div",{className:se,children:[k!==null&&e.jsx("span",{role:"status",className:"me-1 text-[13px] text-ink-secondary",children:n("cloudBuy.setup.openingIn",{seconds:k})}),k!==null&&e.jsx("button",{type:"button",className:X,onClick:K,children:n("notice.notNow")}),e.jsx("button",{type:"button",className:Y,disabled:!s||T,onClick:A,children:n("cloudBuy.setup.open",{name:f})})]}),$&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:f})})]})}function yt({team:t,step:l,slow:o}){const r=Math.max(0,P.findIndex(([p])=>p===l)),s=t??n("cloudBuy.team.unnamed");return e.jsxs("div",{"data-cloud-add":"team-starting","data-cloud-setup":l??"reserving",className:q,children:[e.jsx(M,{title:n("cloudBuy.team.setupTitle"),sub:n("cloudBuy.team.setupSub")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ae,{value:r/P.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:P.map(([p,f],v)=>({key:p,title:n(f,{name:s}),state:v<r?"done":v===r?"now":"next"}))}),o&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]})]})}function gt({name:t,busy:l,openFailed:o,onOpen:r}){return e.jsxs("div",{"data-cloud-add":"team-ready",className:q,children:[e.jsx(M,{title:n("cloudBuy.team.readyTitle"),sub:n("cloudBuy.team.readySub",{name:t})}),e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:t})}),e.jsx("div",{className:se,children:e.jsx("button",{type:"button","data-autofocus":!0,className:Y,disabled:l,onClick:r,children:n("cloudBuy.setup.open",{name:t})})}),o&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:t})})]})}function ht({view:t,ui:l,actions:o}){switch(t.kind){case"checking":return e.jsx(ie,{kind:"checking",line:null,onClose:o.close});case"unreachable":return e.jsx(ie,{kind:"unreachable",line:n("cloudAdd.unreachable"),onRetry:o.retry,onClose:o.close});case"error":return e.jsx(ie,{kind:`error-${t.reason}`,line:n(t.reason==="rate-limited"?"cloudAdd.rateLimited":"cloudAdd.failed"),onRetry:o.retry,onClose:o.close});case"offer":return e.jsx(ct,{offer:t.offer,current:l.current,now:l.now,busy:l.busy,signedOut:t.signedOut,notice:t.notice?n(t.notice==="code-expired"?"cloudAdd.codeExpired":t.notice==="signin-ended"?"cloudAdd.signInEnded":t.notice==="terms"?"cloudBuy.termsChanged":"cloudAdd.preparing"):null,onStart:o.start,onSignIn:o.signIn});case"sign-in":return e.jsx(dt,{phase:t.phase,email:l.email,code:l.code,profileEmail:l.profileEmail,busy:l.busy,now:l.now,onBack:o.back,onEmail:o.email,onSend:o.sendCode,onChangeEmail:o.changeEmail,onCode:o.code,onResend:o.resend,onBrowser:o.browser});case"signing-in":return e.jsx(rt,{code:t.code,checkout:t.checkout,busy:l.busy,trial:l.offerShown?!!Le(l.offerShown,l.chosen).trialDays:!1,onReopen:o.reopenBrowser,onCancel:o.cancelSignIn});case"waiting":return e.jsx(ft,{plan:t.plan,offer:l.offerShown,browser:t.browser,late:t.late,link:t.link,email:t.email,busy:l.busy,copied:l.copied,failed:l.payFailed,onReopen:o.reopenCheckout,onCopy:o.copyLink,onChangePlan:o.changePlan});case"starting":case"ready":return e.jsx(xt,{started:t,received:t.kind==="starting"&&t.received,step:t.kind==="starting"?t.step:null,slow:t.kind==="starting"&&t.slow,ready:t.kind==="ready",sleeps:et(t,l.offerShown),name:l.look.name,typed:l.look.typed,color:l.look.color,counting:l.counting,busy:l.busy,openFailed:l.openFailed,onName:o.name,onColor:o.color,onOpen:o.openCloud,onNotNow:o.notNow});case"has-cloud":return e.jsx(pt,{name:l.look.name,color:l.look.color,busy:l.busy,interest:l.interest,openFailed:l.openFailed,onInterest:o.interest,onOpen:o.openCloud});case"team-starting":return e.jsx(yt,{team:t.team,step:t.step,slow:t.slow});case"team-ready":return e.jsx(gt,{name:t.team.name,busy:l.busy,openFailed:l.openFailed,onOpen:()=>o.openTeam(t.team.id)});case"settings":return null}}const bt={offer:"max-w-[920px]",starting:"max-w-[720px]",ready:"max-w-[720px]"},kt=new Set(["sign-in","signing-in","waiting","starting","team-starting"]);function Be({kind:t,staging:l,onClose:o,children:r}){return e.jsx("div",{className:"ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4 sm:p-6",onMouseDown:s=>s.target===s.currentTarget&&!kt.has(t)&&o(),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cloud-add-title","data-cloud-add-dialog":!0,tabIndex:-1,className:ue(Ze,"group/sheet animate-pop-in relative max-h-full w-full overflow-y-auto overscroll-contain outline-none",bt[t]??"max-w-[540px]"),children:[e.jsx("button",{type:"button",onClick:o,"aria-label":n("cloudAdd.close"),className:ue(Ye,Xe,"absolute end-4 top-4 z-10"),children:e.jsx(Qe,{size:16})}),l&&e.jsx(Je,{className:"absolute end-14 top-[22px] z-10 group-has-[[data-night-card]]/sheet:bg-app"}),r]})})}const jt=["offer","checking","unreachable","waiting","sign-in","signing-in"],St="button:not([disabled]):not([tabindex='-1']), input:not([disabled]):not([tabindex='-1']), [href], [tabindex='0']",Nt=t=>t.status==="connected"&&t.entitlement?.plan==="free"&&!t.purchase&&!t.machine,Ct=t=>t?.status==="connected"&&t.entitlement?.plan==="pro"&&t.entitlement.status==="active"?t.entitlement.tier??"pro":null;function Tt({now:t=Date.now}){const{state:l,dispatch:o}=ut(),r=l.cloudAdd,s=window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[p,f]=d.useState(null),[v,N]=d.useState(void 0),[k,T]=d.useState(null),[$,y]=d.useState(null),[E,A]=d.useState(!1),[K,D]=d.useState(!1),[C,c]=d.useState(!1),[w,j]=d.useState(!1),[W,J]=d.useState(0),[Z,me]=d.useState([]),[h,g]=d.useState(null),[I,O]=d.useState({email:"",code:""}),[B,ee]=d.useState(null),[F,H]=d.useState(null),[z,S]=d.useState(null),[,Te]=d.useState(0),[xe,ae]=d.useState(!1),[Ie,le]=d.useState(!1),[Oe,Fe]=d.useState(!1),L=!!(r&&s),oe=l.config?.profile?.email?.trim()||null,re=ot();d.useEffect(()=>{if(!L||!s)return;let a=!0,i=!1;const b=s.onState(m=>{i=!0,a&&f(m)});return s.state().then(m=>{a&&!i&&f(m)}).catch(()=>{}),()=>{a=!1,b()}},[L,s]);const x=L?We(p,v,{now:t(),error:$,choosing:K,conflict:E,signIn:h,arrived:xe,terms:Ie}):null,ye=L&&x&&jt.includes(x.kind)&&p?`${p.status}:${JSON.stringify(p.offer??null)}:${W}`:null;d.useEffect(()=>{if(!ye||!s?.offer)return;let a=!0;return s.offer().then(i=>{a&&N(i)},()=>{a&&N(null)}),()=>{a=!1}},[ye,s]);const de=n("cloudSetup.myCloud"),V={typed:B?.typed??de,color:B?.color??we,name:Ve(B?.typed??de,de)},_=()=>{h&&s?.signInCancel?.().catch(()=>{}),o({type:"closeCloudAdd"}),y(null),A(!1),D(!1),j(!1),me([]),T(null),g(null),O({email:"",code:""}),ee(null),H(null),S(null),ae(!1),le(!1)};d.useEffect(()=>{if(!L)return;const a=document.activeElement,i=a&&a!==document.body&&typeof a.focus=="function"?a:null;r?.signIn&&(g({step:"email",intent:!1,problem:null}),O({email:oe??"",code:""}));const b=m=>{if(m.key==="Escape"){m.preventDefault(),_();return}if(m.key!=="Tab")return;const R=[...document.querySelector("[data-cloud-add-dialog]")?.querySelectorAll(St)??[]];if(!R.length)return;m.preventDefault();const Ne=R.indexOf(document.activeElement);R[Ne===-1?0:(Ne+(m.shiftKey?-1:1)+R.length)%R.length].focus()};return window.addEventListener("keydown",b,!0),(document.querySelector("#cloud-add-title")??document.querySelector("[data-cloud-add-dialog]"))?.focus(),()=>{window.removeEventListener("keydown",b,!0),i?.isConnected&&i.focus()}},[L]),d.useEffect(()=>{if(!(!L||!s?.sheet||re))return s.sheet(!0).catch(()=>{}),()=>{s.sheet?.(!1).catch(()=>{})}},[L,s,re]);const u=x?.kind??null,te=x?.kind==="sign-in"?`sign-in-${x.phase.step}`:u;d.useEffect(()=>{!te||te==="checking"||te==="settings"||document.activeElement?.closest?.("[data-cloud-add-dialog]")||(document.querySelector("[data-cloud-add-dialog] [data-autofocus]")??document.querySelector("#cloud-add-title"))?.focus()},[te]),d.useEffect(()=>{(u==="waiting"||u==="starting"||u==="ready")&&!xe&&ae(!0),(u==="ready"||u==="team-ready")&&s?.readySeen?.().catch(()=>{})},[u]),d.useEffect(()=>{if(!u||!r)return;if(u==="settings"){_(),o({type:"toggleAppSettings",open:!0,section:"cloudAccount"});return}if(u==="checking")return;const a=Z.length===0;a&&U("cloud_dialog_shown",{source:r.source,view:u}),["starting","ready"].includes(u)&&!Z.includes(u)&&U("cloud_dialog_view",{view:u}),(a||!Z.includes(u))&&me([...Z,u])},[u]),d.useEffect(()=>{if(!u||!["starting","ready","has-cloud"].includes(u)||B||!s?.look)return;let a=!0;return s.look().then(i=>{a&&ee({typed:i.name,color:Ge(i.color)??we,dirty:u!=="has-cloud"})},()=>{}),()=>{a=!1}},[u]),d.useEffect(()=>{if(!B?.dirty||!s?.setLook)return;const a=setTimeout(()=>{s.setLook?.(V.name,B.color).catch(()=>{})},400);return()=>clearTimeout(a)},[B?.typed,B?.color]),d.useEffect(()=>{u!=="ready"||F!==null||H(!re&&typeof document.hasFocus=="function"&&document.hasFocus()?3:"off")},[u]);const ge=h?.step==="code"?h.resendAt:0;d.useEffect(()=>{if(!ge||ge<=t())return;const a=setTimeout(()=>Te(t()),1e3);return()=>clearTimeout(a)}),d.useEffect(()=>{if(z!=="copied")return;const a=setTimeout(()=>S(null),2500);return()=>clearTimeout(a)},[z]);const ne=a=>{C||(c(!0),j(!1),a().catch(()=>y("failed")).finally(()=>c(!1)))},he=()=>{C||!s||(c(!0),j(!1),H("done"),(async()=>{B?.dirty&&s.setLook&&await s.setLook(V.name,B.color).catch(()=>{}),await s.connectHome()})().then(()=>_(),()=>j(!0)).finally(()=>c(!1)))},_e=a=>{C||!s?.openTeam||(c(!0),j(!1),s.openTeam(a).then(()=>_(),()=>j(!0)).finally(()=>c(!1)))};d.useEffect(()=>{if(typeof F!="number")return;const a=setTimeout(()=>{F>1?H(F-1):he()},1e3);return()=>clearTimeout(a)},[F]);const be=typeof F=="number";if(d.useEffect(()=>{if(!be)return;const a=()=>H("off");return window.addEventListener("blur",a),()=>window.removeEventListener("blur",a)},[be]),!L||!x||!r||!s||x.kind==="settings")return null;if(x.kind==="has-cloud"&&p?.status==="connected"&&p.clouds&&window.ogb?.cloudAdd&&(p.addCloud?.canAdd!==!1||p.adding&&!p.adding.done))return e.jsx(Be,{kind:Oe?"offer":"has-cloud",staging:p.staging===!0,onClose:_,children:e.jsx(lt,{onClose:_,onFirstCloud:()=>{},onWide:Fe,source:r.source})});const G=v??null,ke=()=>x.kind==="waiting"&&!k?x.plan:G?Le(G,k).tier:null,ce=async a=>{if(!a||!s.checkout){y("failed");return}const i=!!G?.plans.find(R=>R.tier===a)?.trialDays,b=await s.checkout(a,r.source),m=b.outcome;f(b.state),m==="opened"||m==="signing-in"?(D(!1),y(null),A(!1),S(null),le(!1),U("cloud_checkout_opened",{plan:a,trial:i,source:r.source})):m==="rate-limited"?y("rate-limited"):m==="failed"?y("failed"):A(!0)},je=a=>{g({step:"email",intent:a,problem:null}),O({email:I.email||oe||"",code:""})},Se=()=>{if(C||!s.signInStart||!h||h.step==="done")return;const a=h;c(!0),s.signInStart(I.email).then(i=>{i.outcome==="sent"?(g({step:"code",intent:a.intent,email:i.email,resendAt:i.resendAt,problem:null,triesLeft:null,...i.signupOpen===!1?{signupOpen:!1}:{}}),O({email:i.email,code:""}),U("cloud_signin",{step:"code_sent",source:r.source})):g({...a,problem:i.outcome})},()=>g({...a,problem:"failed"})).finally(()=>c(!1))},De=a=>{if(!s.signInVerify||h?.step!=="code")return;const i=h,b=i.intent?ke():null;c(!0),(async()=>{try{const m=await s.signInVerify(a);if(m.outcome!=="signed-in"){O({email:I.email,code:""}),g({...i,problem:m.outcome,triesLeft:m.outcome==="wrong-code"?m.triesLeft:null});return}f(m.state),ae(!0),U("cloud_signin",{step:"signed_in",source:r.source}),b&&Nt(m.state)&&(tt(G,m.state.offer,b)?(g({step:"done",intent:!0}),await ce(b)):(le(!0),T(b))),g(null),O({email:I.email,code:""})}catch{g({...i,problem:"failed",triesLeft:null})}finally{c(!1)}})()},Re={start:a=>{if(T(a),A(!1),x.kind==="offer"&&x.signedOut&&s.signInStart){je(!0);return}ne(()=>ce(a))},signIn:()=>je(!1),back:()=>{g(null),s.signInCancel?.().catch(()=>{})},email:a=>O({email:a,code:I.code}),sendCode:Se,changeEmail:()=>{h&&(g({step:"email",intent:h.intent,problem:null}),s.signInCancel?.().catch(()=>{}))},code:a=>{const i=it(a);O({email:I.email,code:i}),i.length===8&&!C&&De(i)},resend:Se,browser:()=>ne(async()=>{const a=h?.intent?ke():null;g(null),await s.signInCancel?.().catch(()=>{}),U("cloud_signin",{step:"browser",source:r.source}),a?await ce(a):f(await s.begin())}),reopenBrowser:()=>ne(async()=>f(await s.reopen())),cancelSignIn:()=>ne(async()=>f(await s.cancel())),reopenCheckout:()=>{if(x.kind!=="waiting"||C)return;c(!0),S(null),(s.reopenCheckout?s.reopenCheckout(x.plan,r.source):s.checkout(x.plan,r.source)).then(i=>{f(i.state),i.outcome!=="opened"&&S("pay-failed")},()=>S("pay-failed")).finally(()=>c(!1))},copyLink:()=>{s.copyCheckoutLink?.().then(a=>S(a?"copied":"pay-failed"),()=>S("pay-failed"))},changePlan:()=>{T(x.kind==="waiting"?x.plan:k),D(!0),S(null)},retry:()=>{y(null),A(!1),N(void 0),J(W+1)},name:a=>ee({typed:a,color:V.color,dirty:!0}),color:a=>ee({typed:V.typed,color:a,dirty:!0}),openCloud:he,openTeam:_e,notNow:()=>H("off"),interest:()=>{C||!s.interest||(c(!0),s.interest().then(()=>S("interest-sent"),()=>S("interest-failed")).finally(()=>c(!1)))},close:_},Pe={chosen:k,current:Ct(p),offerShown:G,now:t(),busy:C,openFailed:w,email:I.email,code:I.code,profileEmail:oe,look:V,counting:typeof F=="number"?F:null,copied:z==="copied",payFailed:z==="pay-failed",interest:z==="interest-sent"?"sent":z==="interest-failed"?"failed":null};return e.jsx(Be,{kind:x.kind,staging:p?.staging===!0,onClose:_,children:e.jsx(ht,{view:x,ui:Pe,actions:Re})})}export{Tt as CloudAddDialog,ht as CloudAddPanel,Be as CloudAddSheet};
|
|
1
|
+
import{j as e,M as q,N as ve,O as M,t as n,Q as se,T as X,U as Y,V as He,W as pe,Y as Ce,u as Ee,Z as fe,$ as ze,a0 as Ae,a1 as Ue,a2 as qe,a3 as Me,a4 as Q,a as ue,a5 as $e,a6 as Ke,r as d,a7 as We,a8 as Ve,a9 as we,K as U,aa as Ge,X as Qe,ab as Xe,ac as Ye,ad as Je,ae as Ze,af as et,ag as Le,ah as tt}from"./styles-Bj-lDRZL.js";import{L as nt,y as st,C as at,z as lt,F as ot,G as rt,S as dt,H as ct,I as it}from"./PlacesRail-B9RHHjvB.js";import{u as ut}from"./App-X_zk2xl3.js";import"./monitor-DUEBF6Jm.js";import"./index-DJPPxxyF.js";import"./MenuMotion-V6wxTHIu.js";function pt({name:t,color:l,busy:o,interest:r,openFailed:s,onInterest:p,onOpen:f}){return e.jsxs("div",{"data-cloud-add":"has-cloud",className:q,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(ve,{color:l,size:32}),e.jsx(M,{title:n("cloudBuy.one.title"),sub:n("cloudBuy.one.sub",{name:t})})]}),e.jsxs("div",{className:se,children:[r!=="sent"&&e.jsx("button",{type:"button",className:X,disabled:o,onClick:p,children:n("cloudBuy.one.email")}),e.jsx("button",{type:"button",className:Y,disabled:o,onClick:f,children:n("cloudBuy.setup.open",{name:t})})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[r==="sent"&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.one.thanks")}),r==="failed"&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.one.failed")}),s&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.openFailed",{name:t})})]})]})}function ie({kind:t,line:l,onRetry:o,onClose:r}){return e.jsxs("div",{"data-cloud-add":t,className:q,children:[e.jsx(M,{title:n("cloudAdd.title")}),l?e.jsx("p",{role:"alert",className:"text-[14px] leading-5 text-ink",children:l}):e.jsxs("p",{role:"status",className:"flex items-center gap-2 text-[13px] leading-[18px] text-ink-secondary",children:[e.jsx(nt,{size:14,className:"animate-spin motion-reduce:animate-none","aria-hidden":"true"}),n("cloudAdd.checking")]}),e.jsxs("div",{className:se,children:[e.jsx("button",{type:"button",className:X,onClick:r,children:n("cloudAdd.close")}),o&&e.jsx("button",{type:"button",className:Y,onClick:o,children:n("cloudAdd.tryAgain")})]})]})}function ft({plan:t,offer:l,browser:o,late:r,link:s,email:p,busy:f,copied:v,failed:N,onReopen:k,onCopy:T,onChangePlan:$}){const y=l?.plans.find(K=>K.tier===t)??null,E=y?He(y):pe(t),A=y?.trialDays===1?n("cloudBuy.pay.planTrial.one",{plan:E,due:Ce(0)}):y?.trialDays?n("cloudBuy.pay.planTrial.many",{plan:E,days:y.trialDays,due:Ce(0)}):y?n("cloudBuy.pay.planPaid",{plan:E,price:Ee(y.amount/100)}):E;return e.jsxs("div",{"data-cloud-add":r?"waiting-late":o==="signin"?"waiting-signin":"waiting",className:q,children:[e.jsx(M,{title:r?n("cloudBuy.pay.lateTitle"):n("cloudAdd.browserTitle"),sub:r?n("cloudBuy.pay.lateSub"):n(o==="signin"?"cloudBuy.pay.subSignIn":"cloudBuy.pay.sub")}),e.jsx(fe,{items:[{key:"signed-in",state:"done",title:n("cloudBuy.pay.signedIn"),detail:p},{key:"payment",state:"now",title:n("cloudBuy.pay.waiting"),detail:A},{key:"setup",state:"next",title:n("cloudBuy.pay.setup"),detail:n("cloudBuy.pay.setupHint")}]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("button",{type:"button",className:r?Y:X,disabled:f,onClick:k,children:[e.jsx(st,{size:14,"aria-hidden":"true"}),n("cloudAdd.reopenCheckout")]}),s&&e.jsxs("button",{type:"button",className:X,disabled:f,onClick:T,children:[e.jsx(at,{size:14,"aria-hidden":"true"}),n("cloudBuy.pay.copy")]}),e.jsx("button",{type:"button",className:`${ze} ms-1 px-1 py-1`,onClick:$,children:n("cloudAdd.changePlan")})]}),e.jsxs("div",{"aria-live":"polite",className:"text-[13px] leading-[18px] empty:-mt-5",children:[v&&e.jsx("p",{className:"text-ink-secondary",children:n("cloudBuy.pay.copied")}),N&&e.jsx("p",{role:"alert",className:"text-danger",children:n("cloudBuy.pay.failed")})]})]})}const P=[["reserving","cloudHome.step.reserving"],["storage","cloudHome.step.storage"],["starting","cloudBuy.step.starting"],["checking","cloudHome.step.checking"]];function mt({tier:t,trial:l,credit:o},r){if(r)return n("cloudAdd.receivedTitle");const s=pe(t??l?.tier??void 0);return l?o?n("cloudBuy.setup.badgeCredit",{plan:s,credit:Ee(o.grantedUsd)}):n("cloudBuy.setup.badgeTrial",{plan:s}):n("cloudBuy.setup.badgePaid",{plan:s})}function xt({started:t,received:l,step:o,slow:r,ready:s,sleeps:p=!1,name:f,typed:v,color:N,counting:k,busy:T,openFailed:$,onName:y,onColor:E,onOpen:A,onNotNow:K}){const D=s?P.length:Math.max(0,P.findIndex(([c])=>c===o)),C=pe(t.tier??t.trial?.tier??void 0);return e.jsxs("div",{"data-cloud-add":s?"ready":l?"received":"starting","data-cloud-setup":s?"ready":o??"reserving",className:q,children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ue,{children:mt(t,l)}),e.jsx(M,{title:s?n("cloudBuy.ready.title",{name:f}):n("cloudBuy.setup.title"),sub:s?n("cloudBuy.ready.sub"):l?n("cloudAccount.purchaseNoteNoDate"):n("cloudBuy.setup.sub")})]}),e.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ae,{value:D/P.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:P.map(([c,w],j)=>({key:c,title:n(w,{name:f}),state:j<D?"done":j===D?"now":"next"}))}),r&&!s&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("label",{htmlFor:"cloud-add-name",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.name")}),e.jsx("input",{id:"cloud-add-name",value:v,maxLength:Me,placeholder:n("cloudSetup.myCloud"),autoComplete:"off",spellCheck:!1,onChange:c=>y(c.target.value),className:qe})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{id:"cloud-add-color",className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.color")}),e.jsx("div",{role:"radiogroup","aria-labelledby":"cloud-add-color",className:"flex flex-wrap gap-2",children:Q.map(c=>e.jsx("button",{type:"button",role:"radio","aria-checked":c===N,"aria-label":n(Ke[c]),tabIndex:c===N?0:-1,"data-color":c,onClick:()=>E(c),onKeyDown:w=>{const j=Q.indexOf(c),W=w.key==="ArrowRight"||w.key==="ArrowDown"?1:w.key==="ArrowLeft"||w.key==="ArrowUp"?-1:0;if(!W)return;w.preventDefault();const J=Q[(j+W+Q.length)%Q.length];E(J),w.currentTarget.parentElement?.querySelector(`[data-color="${J}"]`)?.focus()},style:{background:$e(c)},className:ue("size-[26px] rounded-lg border-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",c===N?"border-ink shadow-[inset_0_0_0_2px_var(--color-app)]":"border-transparent")},c))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx("span",{className:"text-[13px] leading-[18px] text-ink-secondary",children:n("cloudBuy.setup.preview")}),e.jsxs("span",{"data-cloud-preview":!0,className:"inline-flex max-w-full items-center gap-2 self-start rounded-[12px] border-[0.5px] border-ink/10 bg-menu py-1.5 pe-3 ps-1.5",children:[e.jsx(ve,{color:N}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate text-[13px] font-medium leading-4 text-ink",children:f}),e.jsx("span",{className:"block truncate text-[12px] text-ink-tertiary",children:n(p?"cloudBuy.setup.previewLineSleeps":"cloudBuy.setup.previewLine",{plan:C})})]})]})]})]})]}),s&&k===null&&e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:f})}),e.jsxs("div",{className:se,children:[k!==null&&e.jsx("span",{role:"status",className:"me-1 text-[13px] text-ink-secondary",children:n("cloudBuy.setup.openingIn",{seconds:k})}),k!==null&&e.jsx("button",{type:"button",className:X,onClick:K,children:n("notice.notNow")}),e.jsx("button",{type:"button",className:Y,disabled:!s||T,onClick:A,children:n("cloudBuy.setup.open",{name:f})})]}),$&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:f})})]})}function yt({team:t,step:l,slow:o}){const r=Math.max(0,P.findIndex(([p])=>p===l)),s=t??n("cloudBuy.team.unnamed");return e.jsxs("div",{"data-cloud-add":"team-starting","data-cloud-setup":l??"reserving",className:q,children:[e.jsx(M,{title:n("cloudBuy.team.setupTitle"),sub:n("cloudBuy.team.setupSub")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(Ae,{value:r/P.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:P.map(([p,f],v)=>({key:p,title:n(f,{name:s}),state:v<r?"done":v===r?"now":"next"}))}),o&&e.jsx("p",{role:"status",className:"px-3 text-[13px] leading-[18px] text-ink-secondary",children:n("cloudHome.slow")})]})]})}function gt({name:t,busy:l,openFailed:o,onOpen:r}){return e.jsxs("div",{"data-cloud-add":"team-ready",className:q,children:[e.jsx(M,{title:n("cloudBuy.team.readyTitle"),sub:n("cloudBuy.team.readySub",{name:t})}),e.jsx("p",{className:"text-[13px] leading-[18px] text-ink-tertiary",children:n("cloudBuy.ready.hint",{name:t})}),e.jsx("div",{className:se,children:e.jsx("button",{type:"button","data-autofocus":!0,className:Y,disabled:l,onClick:r,children:n("cloudBuy.setup.open",{name:t})})}),o&&e.jsx("p",{role:"alert",className:"-mt-2 text-end text-[13px] leading-[18px] text-danger",children:n("cloudBuy.openFailed",{name:t})})]})}function ht({view:t,ui:l,actions:o}){switch(t.kind){case"checking":return e.jsx(ie,{kind:"checking",line:null,onClose:o.close});case"unreachable":return e.jsx(ie,{kind:"unreachable",line:n("cloudAdd.unreachable"),onRetry:o.retry,onClose:o.close});case"error":return e.jsx(ie,{kind:`error-${t.reason}`,line:n(t.reason==="rate-limited"?"cloudAdd.rateLimited":"cloudAdd.failed"),onRetry:o.retry,onClose:o.close});case"offer":return e.jsx(ct,{offer:t.offer,current:l.current,now:l.now,busy:l.busy,signedOut:t.signedOut,notice:t.notice?n(t.notice==="code-expired"?"cloudAdd.codeExpired":t.notice==="signin-ended"?"cloudAdd.signInEnded":t.notice==="terms"?"cloudBuy.termsChanged":"cloudAdd.preparing"):null,onStart:o.start,onSignIn:o.signIn});case"sign-in":return e.jsx(dt,{phase:t.phase,email:l.email,code:l.code,profileEmail:l.profileEmail,busy:l.busy,now:l.now,onBack:o.back,onEmail:o.email,onSend:o.sendCode,onChangeEmail:o.changeEmail,onCode:o.code,onResend:o.resend,onBrowser:o.browser});case"signing-in":return e.jsx(rt,{code:t.code,checkout:t.checkout,busy:l.busy,trial:l.offerShown?!!Le(l.offerShown,l.chosen).trialDays:!1,onReopen:o.reopenBrowser,onCancel:o.cancelSignIn});case"waiting":return e.jsx(ft,{plan:t.plan,offer:l.offerShown,browser:t.browser,late:t.late,link:t.link,email:t.email,busy:l.busy,copied:l.copied,failed:l.payFailed,onReopen:o.reopenCheckout,onCopy:o.copyLink,onChangePlan:o.changePlan});case"starting":case"ready":return e.jsx(xt,{started:t,received:t.kind==="starting"&&t.received,step:t.kind==="starting"?t.step:null,slow:t.kind==="starting"&&t.slow,ready:t.kind==="ready",sleeps:et(t,l.offerShown),name:l.look.name,typed:l.look.typed,color:l.look.color,counting:l.counting,busy:l.busy,openFailed:l.openFailed,onName:o.name,onColor:o.color,onOpen:o.openCloud,onNotNow:o.notNow});case"has-cloud":return e.jsx(pt,{name:l.look.name,color:l.look.color,busy:l.busy,interest:l.interest,openFailed:l.openFailed,onInterest:o.interest,onOpen:o.openCloud});case"team-starting":return e.jsx(yt,{team:t.team,step:t.step,slow:t.slow});case"team-ready":return e.jsx(gt,{name:t.team.name,busy:l.busy,openFailed:l.openFailed,onOpen:()=>o.openTeam(t.team.id)});case"settings":return null}}const bt={offer:"max-w-[920px]",starting:"max-w-[720px]",ready:"max-w-[720px]"},kt=new Set(["sign-in","signing-in","waiting","starting","team-starting"]);function Be({kind:t,staging:l,onClose:o,children:r}){return e.jsx("div",{className:"ui-scrim fixed inset-0 z-[60] flex items-center justify-center p-4 sm:p-6",onMouseDown:s=>s.target===s.currentTarget&&!kt.has(t)&&o(),children:e.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"cloud-add-title","data-cloud-add-dialog":!0,tabIndex:-1,className:ue(Ze,"group/sheet animate-pop-in relative max-h-full w-full overflow-y-auto overscroll-contain outline-none",bt[t]??"max-w-[540px]"),children:[e.jsx("button",{type:"button",onClick:o,"aria-label":n("cloudAdd.close"),className:ue(Ye,Xe,"absolute end-4 top-4 z-10"),children:e.jsx(Qe,{size:16})}),l&&e.jsx(Je,{className:"absolute end-14 top-[22px] z-10 group-has-[[data-night-card]]/sheet:bg-app"}),r]})})}const jt=["offer","checking","unreachable","waiting","sign-in","signing-in"],St="button:not([disabled]):not([tabindex='-1']), input:not([disabled]):not([tabindex='-1']), [href], [tabindex='0']",Nt=t=>t.status==="connected"&&t.entitlement?.plan==="free"&&!t.purchase&&!t.machine,Ct=t=>t?.status==="connected"&&t.entitlement?.plan==="pro"&&t.entitlement.status==="active"?t.entitlement.tier??"pro":null;function Tt({now:t=Date.now}){const{state:l,dispatch:o}=ut(),r=l.cloudAdd,s=window.ogb?.remoteClient?.active?void 0:window.ogb?.cloudAccount,[p,f]=d.useState(null),[v,N]=d.useState(void 0),[k,T]=d.useState(null),[$,y]=d.useState(null),[E,A]=d.useState(!1),[K,D]=d.useState(!1),[C,c]=d.useState(!1),[w,j]=d.useState(!1),[W,J]=d.useState(0),[Z,me]=d.useState([]),[h,g]=d.useState(null),[I,O]=d.useState({email:"",code:""}),[B,ee]=d.useState(null),[F,H]=d.useState(null),[z,S]=d.useState(null),[,Te]=d.useState(0),[xe,ae]=d.useState(!1),[Ie,le]=d.useState(!1),[Oe,Fe]=d.useState(!1),L=!!(r&&s),oe=l.config?.profile?.email?.trim()||null,re=ot();d.useEffect(()=>{if(!L||!s)return;let a=!0,i=!1;const b=s.onState(m=>{i=!0,a&&f(m)});return s.state().then(m=>{a&&!i&&f(m)}).catch(()=>{}),()=>{a=!1,b()}},[L,s]);const x=L?We(p,v,{now:t(),error:$,choosing:K,conflict:E,signIn:h,arrived:xe,terms:Ie}):null,ye=L&&x&&jt.includes(x.kind)&&p?`${p.status}:${JSON.stringify(p.offer??null)}:${W}`:null;d.useEffect(()=>{if(!ye||!s?.offer)return;let a=!0;return s.offer().then(i=>{a&&N(i)},()=>{a&&N(null)}),()=>{a=!1}},[ye,s]);const de=n("cloudSetup.myCloud"),V={typed:B?.typed??de,color:B?.color??we,name:Ve(B?.typed??de,de)},_=()=>{h&&s?.signInCancel?.().catch(()=>{}),o({type:"closeCloudAdd"}),y(null),A(!1),D(!1),j(!1),me([]),T(null),g(null),O({email:"",code:""}),ee(null),H(null),S(null),ae(!1),le(!1)};d.useEffect(()=>{if(!L)return;const a=document.activeElement,i=a&&a!==document.body&&typeof a.focus=="function"?a:null;r?.signIn&&(g({step:"email",intent:!1,problem:null}),O({email:oe??"",code:""}));const b=m=>{if(m.key==="Escape"){m.preventDefault(),_();return}if(m.key!=="Tab")return;const R=[...document.querySelector("[data-cloud-add-dialog]")?.querySelectorAll(St)??[]];if(!R.length)return;m.preventDefault();const Ne=R.indexOf(document.activeElement);R[Ne===-1?0:(Ne+(m.shiftKey?-1:1)+R.length)%R.length].focus()};return window.addEventListener("keydown",b,!0),(document.querySelector("#cloud-add-title")??document.querySelector("[data-cloud-add-dialog]"))?.focus(),()=>{window.removeEventListener("keydown",b,!0),i?.isConnected&&i.focus()}},[L]),d.useEffect(()=>{if(!(!L||!s?.sheet||re))return s.sheet(!0).catch(()=>{}),()=>{s.sheet?.(!1).catch(()=>{})}},[L,s,re]);const u=x?.kind??null,te=x?.kind==="sign-in"?`sign-in-${x.phase.step}`:u;d.useEffect(()=>{!te||te==="checking"||te==="settings"||document.activeElement?.closest?.("[data-cloud-add-dialog]")||(document.querySelector("[data-cloud-add-dialog] [data-autofocus]")??document.querySelector("#cloud-add-title"))?.focus()},[te]),d.useEffect(()=>{(u==="waiting"||u==="starting"||u==="ready")&&!xe&&ae(!0),(u==="ready"||u==="team-ready")&&s?.readySeen?.().catch(()=>{})},[u]),d.useEffect(()=>{if(!u||!r)return;if(u==="settings"){_(),o({type:"toggleAppSettings",open:!0,section:"cloudAccount"});return}if(u==="checking")return;const a=Z.length===0;a&&U("cloud_dialog_shown",{source:r.source,view:u}),["starting","ready"].includes(u)&&!Z.includes(u)&&U("cloud_dialog_view",{view:u}),(a||!Z.includes(u))&&me([...Z,u])},[u]),d.useEffect(()=>{if(!u||!["starting","ready","has-cloud"].includes(u)||B||!s?.look)return;let a=!0;return s.look().then(i=>{a&&ee({typed:i.name,color:Ge(i.color)??we,dirty:u!=="has-cloud"})},()=>{}),()=>{a=!1}},[u]),d.useEffect(()=>{if(!B?.dirty||!s?.setLook)return;const a=setTimeout(()=>{s.setLook?.(V.name,B.color).catch(()=>{})},400);return()=>clearTimeout(a)},[B?.typed,B?.color]),d.useEffect(()=>{u!=="ready"||F!==null||H(!re&&typeof document.hasFocus=="function"&&document.hasFocus()?3:"off")},[u]);const ge=h?.step==="code"?h.resendAt:0;d.useEffect(()=>{if(!ge||ge<=t())return;const a=setTimeout(()=>Te(t()),1e3);return()=>clearTimeout(a)}),d.useEffect(()=>{if(z!=="copied")return;const a=setTimeout(()=>S(null),2500);return()=>clearTimeout(a)},[z]);const ne=a=>{C||(c(!0),j(!1),a().catch(()=>y("failed")).finally(()=>c(!1)))},he=()=>{C||!s||(c(!0),j(!1),H("done"),(async()=>{B?.dirty&&s.setLook&&await s.setLook(V.name,B.color).catch(()=>{}),await s.connectHome()})().then(()=>_(),()=>j(!0)).finally(()=>c(!1)))},_e=a=>{C||!s?.openTeam||(c(!0),j(!1),s.openTeam(a).then(()=>_(),()=>j(!0)).finally(()=>c(!1)))};d.useEffect(()=>{if(typeof F!="number")return;const a=setTimeout(()=>{F>1?H(F-1):he()},1e3);return()=>clearTimeout(a)},[F]);const be=typeof F=="number";if(d.useEffect(()=>{if(!be)return;const a=()=>H("off");return window.addEventListener("blur",a),()=>window.removeEventListener("blur",a)},[be]),!L||!x||!r||!s||x.kind==="settings")return null;if(x.kind==="has-cloud"&&p?.status==="connected"&&p.clouds&&window.ogb?.cloudAdd&&(p.addCloud?.canAdd!==!1||p.adding&&!p.adding.done))return e.jsx(Be,{kind:Oe?"offer":"has-cloud",staging:p.staging===!0,onClose:_,children:e.jsx(lt,{onClose:_,onFirstCloud:()=>{},onWide:Fe,source:r.source})});const G=v??null,ke=()=>x.kind==="waiting"&&!k?x.plan:G?Le(G,k).tier:null,ce=async a=>{if(!a||!s.checkout){y("failed");return}const i=!!G?.plans.find(R=>R.tier===a)?.trialDays,b=await s.checkout(a,r.source),m=b.outcome;f(b.state),m==="opened"||m==="signing-in"?(D(!1),y(null),A(!1),S(null),le(!1),U("cloud_checkout_opened",{plan:a,trial:i,source:r.source})):m==="rate-limited"?y("rate-limited"):m==="failed"?y("failed"):A(!0)},je=a=>{g({step:"email",intent:a,problem:null}),O({email:I.email||oe||"",code:""})},Se=()=>{if(C||!s.signInStart||!h||h.step==="done")return;const a=h;c(!0),s.signInStart(I.email).then(i=>{i.outcome==="sent"?(g({step:"code",intent:a.intent,email:i.email,resendAt:i.resendAt,problem:null,triesLeft:null,...i.signupOpen===!1?{signupOpen:!1}:{}}),O({email:i.email,code:""}),U("cloud_signin",{step:"code_sent",source:r.source})):g({...a,problem:i.outcome})},()=>g({...a,problem:"failed"})).finally(()=>c(!1))},De=a=>{if(!s.signInVerify||h?.step!=="code")return;const i=h,b=i.intent?ke():null;c(!0),(async()=>{try{const m=await s.signInVerify(a);if(m.outcome!=="signed-in"){O({email:I.email,code:""}),g({...i,problem:m.outcome,triesLeft:m.outcome==="wrong-code"?m.triesLeft:null});return}f(m.state),ae(!0),U("cloud_signin",{step:"signed_in",source:r.source}),b&&Nt(m.state)&&(tt(G,m.state.offer,b)?(g({step:"done",intent:!0}),await ce(b)):(le(!0),T(b))),g(null),O({email:I.email,code:""})}catch{g({...i,problem:"failed",triesLeft:null})}finally{c(!1)}})()},Re={start:a=>{if(T(a),A(!1),x.kind==="offer"&&x.signedOut&&s.signInStart){je(!0);return}ne(()=>ce(a))},signIn:()=>je(!1),back:()=>{g(null),s.signInCancel?.().catch(()=>{})},email:a=>O({email:a,code:I.code}),sendCode:Se,changeEmail:()=>{h&&(g({step:"email",intent:h.intent,problem:null}),s.signInCancel?.().catch(()=>{}))},code:a=>{const i=it(a);O({email:I.email,code:i}),i.length===8&&!C&&De(i)},resend:Se,browser:()=>ne(async()=>{const a=h?.intent?ke():null;g(null),await s.signInCancel?.().catch(()=>{}),U("cloud_signin",{step:"browser",source:r.source}),a?await ce(a):f(await s.begin())}),reopenBrowser:()=>ne(async()=>f(await s.reopen())),cancelSignIn:()=>ne(async()=>f(await s.cancel())),reopenCheckout:()=>{if(x.kind!=="waiting"||C)return;c(!0),S(null),(s.reopenCheckout?s.reopenCheckout(x.plan,r.source):s.checkout(x.plan,r.source)).then(i=>{f(i.state),i.outcome!=="opened"&&S("pay-failed")},()=>S("pay-failed")).finally(()=>c(!1))},copyLink:()=>{s.copyCheckoutLink?.().then(a=>S(a?"copied":"pay-failed"),()=>S("pay-failed"))},changePlan:()=>{T(x.kind==="waiting"?x.plan:k),D(!0),S(null)},retry:()=>{y(null),A(!1),N(void 0),J(W+1)},name:a=>ee({typed:a,color:V.color,dirty:!0}),color:a=>ee({typed:V.typed,color:a,dirty:!0}),openCloud:he,openTeam:_e,notNow:()=>H("off"),interest:()=>{C||!s.interest||(c(!0),s.interest().then(()=>S("interest-sent"),()=>S("interest-failed")).finally(()=>c(!1)))},close:_},Pe={chosen:k,current:Ct(p),offerShown:G,now:t(),busy:C,openFailed:w,email:I.email,code:I.code,profileEmail:oe,look:V,counting:typeof F=="number"?F:null,copied:z==="copied",payFailed:z==="pay-failed",interest:z==="interest-sent"?"sent":z==="interest-failed"?"failed":null};return e.jsx(Be,{kind:x.kind,staging:p?.staging===!0,onClose:_,children:e.jsx(ht,{view:x,ui:Pe,actions:Re})})}export{Tt as CloudAddDialog,ht as CloudAddPanel,Be as CloudAddSheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,t as a,a as N,r as R}from"./styles-
|
|
1
|
+
import{j as e,t as a,a as N,r as R}from"./styles-Bj-lDRZL.js";import{a5 as F,a6 as S,x as L,S as z,a7 as y,a8 as b,a9 as A,aa as M,ab as w,ac as k,ad as P,ae as E,af as $,u as I,w as B,F as O,ag as v,ah as T,ai as D,aj as C,ak as H,al as W,am as X}from"./App-X_zk2xl3.js";import{a as _,R as q}from"./RoutinesPage-DF0vugaB.js";import{L as G,P as J,d as K}from"./PlacesRail-B9RHHjvB.js";import{C as Q}from"./MenuMotion-V6wxTHIu.js";function U({routines:t,runs:r,bots:p,pausedBots:c,loading:o,error:d,onOpen:l,onLogs:n,onToggle:x}){const u=[...t].sort((s,i)=>Number(i.enabled)-Number(s.enabled)||(s.nextRunAt??1/0)-(i.nextRunAt??1/0)||s.name.localeCompare(i.name));return e.jsxs("div",{className:"space-y-3","aria-label":a("routines.list"),children:[d&&e.jsx("div",{role:"alert",className:"rounded-lg bg-danger/10 p-3 text-[12px] text-danger",children:a("routines.loadError")}),o&&e.jsxs("p",{role:"status",className:"flex items-center gap-2 p-3 text-[12px] text-ink-secondary",children:[e.jsx(G,{size:14,className:"animate-spin"}),a("routines.loading")]}),!o&&!d&&u.length===0&&e.jsxs("div",{className:"rounded-xl border border-dashed border-hairline/50 p-5 text-center text-[13px] text-ink-secondary",children:[e.jsx(_,{size:20,className:"mx-auto mb-2 opacity-60"}),a("routines.empty")]}),u.map(s=>{const i=F(s.id,r),m=i&&(i.attention?"attention":i.error?"error":i.output?"output":null),h=p?.find(g=>g.id===s.botId),f=x!==void 0&&!S(s);return e.jsxs("article",{className:"rounded-xl border border-hairline/40 bg-card p-3.5","aria-label":s.name,children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>l(s),className:"min-w-0 flex-1 text-left hover:text-accent",children:[e.jsx("span",{className:"block truncate text-[13px] font-semibold text-ink",children:s.name}),e.jsxs("span",{className:"mt-1 block text-[12px] leading-relaxed text-ink-secondary",children:[h&&`${h.name} · `,L(s.schedule)]})]}),f?e.jsx(z,{checked:s.enabled,"aria-label":a("routines.toggle",{name:s.name}),onClick:()=>x(s)}):e.jsx("span",{className:N("shrink-0 rounded-full bg-inset px-2 py-0.5 text-[10px]",s.enabled&&s.nextRunAt!=null?"text-accent":"text-ink-secondary"),children:y(s)})]}),(f||b(s)!==y(s))&&e.jsx("div",{className:"mt-2 text-[12px] text-ink-secondary",children:b(s)}),e.jsxs("div",{className:"mt-1 flex items-start justify-between gap-2",children:[e.jsx("div",{className:"min-w-0 text-[12px]",children:i?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:M(i),children:a("routines.latestRun",{status:A(i)})}),e.jsx("span",{className:"block text-[11px] text-ink-secondary",children:w(i.finishedAt??i.startedAt??i.scheduledFor)})]}):e.jsx("span",{className:"text-ink-secondary",children:a("routines.neverRun")})}),e.jsxs("button",{type:"button",onClick:()=>n(s),"aria-label":a("routines.logsFor",{name:s.name}),className:"flex shrink-0 items-center gap-1 rounded-md px-2 py-1 text-[11px] text-ink-secondary hover:bg-raised hover:text-ink",children:[e.jsx(k,{size:12}),a("routines.logs")]})]}),i&&m&&e.jsx("p",{className:N("mt-2 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed",i.error?"text-danger":"text-ink-secondary"),children:P(i,m)}),!!s.failureStreak&&e.jsx("p",{className:"mt-2 text-[12px] text-danger",children:a("routines.failureStreak",{count:s.failureStreak})}),s.weekRuns&&e.jsx("p",{className:"mt-2 text-[12px] text-ink-secondary",children:a(s.weekRuns.total===1?"routines.weekRunsOne":"routines.weekRuns",s.weekRuns)}),s.warning&&e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-warning",children:s.warning}),s.enabled&&c?.includes(s.botId)&&e.jsxs("p",{className:"mt-2 text-[12px] leading-relaxed text-warning","data-routine-bot-paused":"",children:[a("routines.botPaused")," ",e.jsx("button",{type:"button",className:"cursor-pointer text-accent hover:underline",onClick:()=>E("paused"),children:a("routines.botPausedSwap")})]}),s.heldFor&&e.jsx("p",{className:"mt-2 text-[12px] leading-relaxed text-ink-secondary",children:$(s)}),!!s.skippedRuns&&e.jsxs("p",{className:"mt-2 text-[12px] text-ink-secondary",children:[a("routines.skippedRuns",{count:s.skippedRuns}),s.lastSkippedAt!=null&&e.jsxs(e.Fragment,{children:[" · ",a("routines.lastSkipped",{date:w(s.lastSkippedAt)})]})]})]},s.id)})]})}function le({bot:t,routines:r,runs:p,defaultRunOn:c}){const{state:o,dispatch:d}=I(),[l,n]=R.useState(null);return e.jsxs("div",{className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"rounded-xl bg-card p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{size:16,className:"text-accent"}),e.jsx("h2",{className:"min-w-0 flex-1 text-[15px] font-medium text-ink",children:a("computer.tab.routines")}),e.jsx("span",{className:"text-[12px] text-ink-secondary",children:r.length})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>n("new"),className:"flex flex-1 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 py-2 text-[12px] font-medium text-white hover:brightness-110",children:[e.jsx(J,{size:14}),a("computer.routines.create")]}),e.jsxs("button",{type:"button",onClick:()=>d({type:"showRoutines",section:"logs",botId:t.id}),className:"flex items-center gap-1.5 rounded-lg bg-control px-3 py-2 text-[12px] text-ink hover:bg-raised-hover",children:[e.jsx(k,{size:13}),a("routines.logs")]})]})]}),e.jsx(U,{routines:r,runs:p,pausedBots:o.config?.pausedBots,loading:o.routinesLoadState==="loading"&&r.length===0,error:o.routinesLoadState==="error",onOpen:n,onLogs:x=>d({type:"showRoutines",section:"logs",botId:t.id,routineId:x.id}),onToggle:x=>d({type:"updateRoutine",routineId:x.id,patch:{enabled:!x.enabled}})}),e.jsxs("button",{type:"button",onClick:()=>d({type:"showRoutines",section:"schedule",view:"list",botId:t.id}),className:"self-start text-[12px] text-accent hover:underline",children:[a("computer.routines.openTitle")," ",e.jsx(Q,{size:14,"aria-hidden":"true",className:"inline align-[-2px] rtl:-scale-x-100"})]}),l&&e.jsx(q,{routine:l==="new"?void 0:l,bots:[t],lockedBotId:t.id,defaultRunOn:c,onClose:()=>n(null)},t.id)]})}const V=20;function Y(t,r=V){const p=new Set,c=[],o=C(t);for(let d=o.length-1;d>=0&&c.length<r;d-=1){const l=o[d].digest?.files;if(l){for(const n of l.deleted)p.add(n);for(const n of[...l.added,...l.changed])if(!p.has(n)&&(p.add(n),c.push(n),c.length>=r))break}}return c}function Z(t){const r=new Map,p=t.tasks?.find(n=>n.threadId===t.threadId),c=p?.cwd===void 0?t.cwd:p.cwd,o=c&&(/^[a-z]:[\\/]/i.test(c)||c.startsWith("\\\\")),d=n=>o?n.replace(/\\/g,"/"):n,l=typeof c=="string"?`${d(c).replace(/\/+$/,"")}/`:void 0;for(const n of[...C(t)].reverse()){if(n.role!=="bot"||n.kind!=="text")continue;const x=H(n.attachments),u=[...x.files,...W(n.text??"",[...x.images,...x.files.map(s=>s.path)])];for(const s of u){const i=s.private?s.path:X(s.path),m={file:s,message:{threadId:t.threadId,messageId:n.id}},h=d(i),f=l&&(o?h.slice(0,l.length).toLowerCase()===l.toLowerCase():h.startsWith(l)),g=[i,...f?[h.slice(l.length)]:[]];i.startsWith("./")&&g.push(i.replace(/^(\.\/)+/,""));for(const j of g)r.has(j)||r.set(j,m)}}return r}function ee(t){const r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return r<0?{name:t,folder:""}:{name:t.slice(r+1),folder:t.slice(0,r)}}function re({bot:t}){const{dispatch:r}=I(),{capabilities:p}=K(),c=p.host.homeDir,d=t.tasks?.find(u=>u.threadId===t.threadId)?.cwd,l=d===void 0?t.cwd:d,n=Y(t),x=R.useMemo(()=>Z(t),[t.messages,t.activeLeafId,t.threadId,t.tasks,t.cwd]);return e.jsxs("div",{className:"flex-1 overflow-y-auto px-5 pb-5","data-testid":"computer-files",children:[e.jsxs("div",{className:"mt-2 rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:a("computer.files.folder")}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx(O,{size:15,className:"shrink-0 text-ink-secondary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[12px] text-ink",title:l??void 0,children:l?v(l,c):l===null?a("computer.files.homeFolder"):a("computer.files.privateFolder",{name:t.name})}),e.jsx("button",{type:"button",onClick:()=>{r({type:"toggleComputer",open:!1}),T(r,"access",{page:"folder"})},className:"shrink-0 rounded-lg bg-control px-2.5 py-1 text-[12px] text-ink hover:bg-raised-hover",children:a(d===void 0?"computer.files.changeFolder":"computer.files.changeDefaultFolder")})]}),d!==void 0&&e.jsx("p",{className:"mt-2 text-[12px] leading-5 text-ink-secondary",children:a("computer.files.pinnedFolderHint")})]}),e.jsxs("div",{className:"mt-3 rounded-xl bg-card p-4",children:[e.jsx("div",{className:"text-[13px] font-medium text-ink",children:a("computer.files.recent")}),n.length===0?e.jsx("p",{className:"mt-2 text-[12px] leading-5 text-ink-secondary",children:a("computer.files.empty",{name:t.name})}):e.jsx("ul",{className:"mt-2 flex flex-col gap-1",children:n.map(u=>{const{name:s,folder:i}=ee(u),m=x.get(u);return e.jsxs("li",{className:"min-w-0 rounded-lg py-1",title:u,children:[m?e.jsx(D,{file:{...m.file,name:s},message:m.message,linked:m.file.linked,className:"w-full max-w-none"},`${m.message.threadId}:${m.message.messageId}:${m.file.path}`):e.jsxs("div",{className:"flex min-w-0 items-center gap-2 px-2.5 py-2",title:a("computer.files.notSharedHint"),children:[e.jsx(k,{size:14,className:"shrink-0 text-ink-secondary","aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[13px] text-ink",children:s}),e.jsx("span",{className:"shrink-0 text-[11px] text-ink-tertiary",children:a("computer.files.notShared")})]}),i&&e.jsx("div",{className:"mt-1 truncate px-2.5 text-[11px] text-ink-tertiary",children:v(i,c)})]},u)})})]})]})}export{re as C,le as R,U as a,Y as r,Z as s};
|