limixbot 0.2.11 → 0.2.13
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-DGFY9WG0.js → ActivityPanel-Crvi6UFN.js} +1 -1
- package/dist/assets/{App-DToXVaV2.js → App-DBQxC6tF.js} +9 -9
- package/dist/assets/{AppEventEditor-B1BhBpPN.js → AppEventEditor-BKkrL3lm.js} +1 -1
- package/dist/assets/{BotSettingsDialog-Di0mWCIw.js → BotSettingsDialog-BVTAiGvS.js} +1 -1
- package/dist/assets/{BrowserPanel-BdM7bp0Z.js → BrowserPanel-CXiPysF8.js} +1 -1
- package/dist/assets/{BrowserProfilesManager-C-R1apBf.js → BrowserProfilesManager-B5ZQeFJ9.js} +1 -1
- package/dist/assets/{CloudAddDialog-VPm_nDm1.js → CloudAddDialog-CjSOW3Ui.js} +1 -1
- package/dist/assets/{ComputerFilesPane-DdeiWUnd.js → ComputerFilesPane-VwEQWopG.js} +1 -1
- package/dist/assets/{ComputerPanel-R_m1XX7x.js → ComputerPanel-C4y6Mvwd.js} +2 -2
- package/dist/assets/{DataPanel-CvcP8VUG.js → DataPanel-CeaLVEeb.js} +1 -1
- package/dist/assets/{DesktopViewer-Bgk3I55B.js → DesktopViewer-CfxFVwdn.js} +1 -1
- package/dist/assets/{FilesView-CbJtl_B6.js → FilesView-B9X_qlkn.js} +1 -1
- package/dist/assets/{GrokMoveDialog-D4Ey0NPX.js → GrokMoveDialog-CuC9v4Fd.js} +1 -1
- package/dist/assets/{InspectorPanel-CCp8ivaJ.js → InspectorPanel-B6ZAVTyD.js} +1 -1
- package/dist/assets/{KeyboardShortcutsModal-PdTGANti.js → KeyboardShortcutsModal-DkoOxF2t.js} +1 -1
- package/dist/assets/{LiveDesktop-Db-Mmed5.js → LiveDesktop-BsPQ6sGB.js} +1 -1
- package/dist/assets/{LocalVmWorkspace-TDvs66q1.js → LocalVmWorkspace-U6rVY7_g.js} +1 -1
- package/dist/assets/{MacLocalControl-C9WNKBOQ.js → MacLocalControl-CC-lKazM.js} +1 -1
- package/dist/assets/{MarkdownFilePreview-TpLES41m.js → MarkdownFilePreview-D0maDIQ1.js} +1 -1
- package/dist/assets/{MenuMotion-DlcPi29I.js → MenuMotion-CLF0GByT.js} +1 -1
- package/dist/assets/{NewBotDialog-RR1Mpu6A.js → NewBotDialog-D9e-ED-j.js} +1 -1
- package/dist/assets/{PhoneAppDialog-BgCzfoTA.js → PhoneAppDialog-CTPZwJnL.js} +1 -1
- package/dist/assets/{PlacesRail-BuGh6RP-.js → PlacesRail-D510vk5R.js} +1 -1
- package/dist/assets/{PluginsPanel-9xs64wF-.js → PluginsPanel-BC0YDZ8h.js} +1 -1
- package/dist/assets/{ProIntroduction-D2VFoI2P.js → ProIntroduction-BIiaveWm.js} +1 -1
- package/dist/assets/{RemoteAgentSettingsPanel-CTXHKn9W.js → RemoteAgentSettingsPanel-OVWheJHu.js} +1 -1
- package/dist/assets/{RoomPanel-DWMLsyy8.js → RoomPanel-mDRTZ2vs.js} +1 -1
- package/dist/assets/{RoutinesPage-DMzWcWIs.js → RoutinesPage-9VDuovqw.js} +1 -1
- package/dist/assets/{SettingsModal-Bg7GHnyA.js → SettingsModal-BHJvNrwz.js} +1 -1
- package/dist/assets/{ShareTeamDialog-CdwYfI5e.js → ShareTeamDialog-C4go2USY.js} +1 -1
- package/dist/assets/{SignedInSites-DuMfQBj_.js → SignedInSites-Cm_X_p_X.js} +1 -1
- package/dist/assets/{TeamLibraryPanel-CoGfO0Gu.js → TeamLibraryPanel-B-R6YFK-.js} +1 -1
- package/dist/assets/{TeamMapPage-CDAuLL_z.js → TeamMapPage-CkYOrZ7X.js} +1 -1
- package/dist/assets/{TriggersPage-BWYj3Pmd.js → TriggersPage-_qYPJ97Z.js} +1 -1
- package/dist/assets/{VisibilitySection-CVG-Q5ZJ.js → VisibilitySection-CpwyInUL.js} +1 -1
- package/dist/assets/{WebhookTrigger-CmHpvYnK.js → WebhookTrigger-CfspvK5m.js} +1 -1
- package/dist/assets/{WorksOnGrid-f6ao1NKp.js → WorksOnGrid-BtfeNPO2.js} +1 -1
- package/dist/assets/{abnfDiagram-YUKMZFIV-Yl8cX4uT.js → abnfDiagram-YUKMZFIV-qTIn3JJ1.js} +1 -1
- package/dist/assets/{activity-BkaEPnrL.js → activity-CEhxqMcq.js} +1 -1
- package/dist/assets/{architectureDiagram-47P4ROYG-DcAjaSwl.js → architectureDiagram-47P4ROYG-BQls0L4i.js} +1 -1
- package/dist/assets/{blockDiagram-E7TT5TSB-D4GJkvO7.js → blockDiagram-E7TT5TSB-DMD6noIL.js} +1 -1
- package/dist/assets/{c4Diagram-CRA5TL53-COp8Arrz.js → c4Diagram-CRA5TL53-CIp2zuwT.js} +1 -1
- package/dist/assets/{calendar-days-WHyMFrxx.js → calendar-days-Di_J-dvc.js} +1 -1
- package/dist/assets/channel-DRGNbeY-.js +1 -0
- package/dist/assets/{chunk-2Q5K7J3B-DL8jLa6h.js → chunk-2Q5K7J3B-BBkqbpZ4.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-CSCWg3L9.js → chunk-5VM5RSS4-JdwNE0CO.js} +1 -1
- package/dist/assets/{chunk-7TKQ45FW-Bsxo8S0u.js → chunk-7TKQ45FW-D_Zh7_1M.js} +1 -1
- package/dist/assets/{chunk-AW2ZBBNX-DJ8cpd8z.js → chunk-AW2ZBBNX-BvSbOQeA.js} +1 -1
- package/dist/assets/{chunk-FVRAUYC3--tXiaXyH.js → chunk-FVRAUYC3-CXYsdaIb.js} +2 -2
- package/dist/assets/{chunk-HTAEGDNF-DMajpLo2.js → chunk-HTAEGDNF-CO93FKYG.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-B-IMdEtd.js → chunk-JWPE2WC7-Ko0D98Sv.js} +1 -1
- package/dist/assets/{chunk-KQW6MTUR-Bf62pjwo.js → chunk-KQW6MTUR-DBGMbUnJ.js} +1 -1
- package/dist/assets/{chunk-XXDRQBXY-DraRivnf.js → chunk-XXDRQBXY-PVMPph1f.js} +1 -1
- package/dist/assets/{classDiagram-v2-K4WV4PDN-7auUwgy0.js → classDiagram-v2-K4WV4PDN-Z-SRrzrQ.js} +1 -1
- package/dist/assets/{coins-DTDgWOsz.js → coins-QIRjm19F.js} +1 -1
- package/dist/assets/{core-mTeZUwt8.js → core-Cb-3LQeb.js} +1 -1
- package/dist/assets/{cose-bilkent-JH36ORCC-tRMEfI42.js → cose-bilkent-JH36ORCC-DcOhjasx.js} +1 -1
- package/dist/assets/{cynefin-EF2NZ3EQ-eSq0vgY_.js → cynefin-EF2NZ3EQ-D9Pv76Si.js} +1 -1
- package/dist/assets/{cynefinDiagram-3GCD6N5R-C9VCE7pj.js → cynefinDiagram-3GCD6N5R-1Nlm6fT4.js} +1 -1
- package/dist/assets/{dagre-W4DXFKR2-BNfBWy10.js → dagre-W4DXFKR2-CW-TdWBz.js} +1 -1
- package/dist/assets/{diagram-2UJZ2QOL-CKHbVIoS.js → diagram-2UJZ2QOL-DJYwBSWN.js} +1 -1
- package/dist/assets/{diagram-OVF4WLC6-BqtE_8V0.js → diagram-OVF4WLC6-ZajDgMU2.js} +1 -1
- package/dist/assets/{diagram-PFPMY2P6-DavkIJ9f.js → diagram-PFPMY2P6-D03UoQDq.js} +1 -1
- package/dist/assets/{diagram-UMYRVEAY-CfIVUSFu.js → diagram-UMYRVEAY-B9gI6La0.js} +1 -1
- package/dist/assets/{diagram-YEKJPTXX-ChAEERCf.js → diagram-YEKJPTXX-Dxzg_fDQ.js} +1 -1
- package/dist/assets/{diagram-ZIFT7M5P-C2a4um4F.js → diagram-ZIFT7M5P-Cv6eTFZE.js} +1 -1
- package/dist/assets/{ebnfDiagram-VR2GEFS7-B9-p-eJk.js → ebnfDiagram-VR2GEFS7-BCUklW6x.js} +1 -1
- package/dist/assets/{elk-IJKZMXRS-BP2YfISU.js → elk-IJKZMXRS-VcZs96wT.js} +1 -1
- package/dist/assets/{erDiagram-O2IAPWRE-ouqRz2lG.js → erDiagram-O2IAPWRE-CJ61fO-Z.js} +1 -1
- package/dist/assets/{file-up-B3qv0JW8.js → file-up-BObBqrEg.js} +1 -1
- package/dist/assets/{flowDiagram-OXPTDLAJ-FkJl8ORu.js → flowDiagram-OXPTDLAJ-CQMoLXxB.js} +1 -1
- package/dist/assets/{ganttDiagram-R7TSEDQI-Bxl5dqy0.js → ganttDiagram-R7TSEDQI-ev5i74AH.js} +1 -1
- package/dist/assets/{gitGraphDiagram-XJZIOB7I-CDp_K_81.js → gitGraphDiagram-XJZIOB7I-B8MGdCiz.js} +1 -1
- package/dist/assets/{import-name-Bs1m8Og-.js → import-name-6aD0J6QH.js} +1 -1
- package/dist/assets/{index-Cw8JuHFb.js → index-CRF26t5P.js} +1 -1
- package/dist/assets/{index-Cpmj1m_f.js → index-DgGTgaCO.js} +2 -2
- package/dist/assets/{index-Dz0LVY7-.js → index-Dpov1WyC.js} +1 -1
- package/dist/assets/{infoDiagram-5W2HQ5XZ-Bl5KtFKM.js → infoDiagram-5W2HQ5XZ-CoqaIohe.js} +1 -1
- package/dist/assets/{ishikawaDiagram-K3B6WC7H-DS9Ua7Oz.js → ishikawaDiagram-K3B6WC7H-BMzA3Pkb.js} +1 -1
- package/dist/assets/{journeyDiagram-COXZFDF6-Bk0db4xo.js → journeyDiagram-COXZFDF6-DLNIN037.js} +1 -1
- package/dist/assets/{kanban-definition-P3RFRI5V-OMdPbZg6.js → kanban-definition-P3RFRI5V-savLUzO8.js} +1 -1
- package/dist/assets/{mcp-servers-CFz7D6CS.js → mcp-servers-D2hHUxUp.js} +1 -1
- package/dist/assets/{mermaid.core-DDfOqk65.js → mermaid.core-1h5EGl1v.js} +4 -4
- package/dist/assets/{mindmap-definition-LZFPQGKD-DZWTgX60.js → mindmap-definition-LZFPQGKD-hMbAYcVv.js} +1 -1
- package/dist/assets/{minimize-BGJr9i4X.js → minimize-63hYzV5y.js} +1 -1
- package/dist/assets/{monitor-DOJm1Kz5.js → monitor-DOeLdhQc.js} +1 -1
- package/dist/assets/{new-bot-CSzhi2cd.js → new-bot-DkcWCdL_.js} +1 -1
- package/dist/assets/{org-library-uUDo6Jt1.js → org-library-C-rnQ1YG.js} +1 -1
- package/dist/assets/{package-format-CDS8vgZO.js → package-format-CMpBgycc.js} +1 -1
- package/dist/assets/{pegDiagram-BGZESJAR-BLa51iQk.js → pegDiagram-BGZESJAR-BIY55aib.js} +1 -1
- package/dist/assets/{pieDiagram-CAPJLFHJ-DZ9lT6YP.js → pieDiagram-CAPJLFHJ-DR8o8piD.js} +1 -1
- package/dist/assets/{quadrantDiagram-GDMTTRAM-DPvkU-WF.js → quadrantDiagram-GDMTTRAM-Dqb1703W.js} +1 -1
- package/dist/assets/{rail-DUauxI9u.js → rail-Ok1gt1lN.js} +1 -1
- package/dist/assets/{railroadDiagram-SM67HX2B-B5tz4-6y.js → railroadDiagram-SM67HX2B-ZWJ9xWQY.js} +1 -1
- package/dist/assets/{remote-desktop-panel-BlyMOzuP.js → remote-desktop-panel-ganxVzJo.js} +1 -1
- package/dist/assets/{requirementDiagram-X7JNWC4A-Cwx0ISbR.js → requirementDiagram-X7JNWC4A-Cjv_VLZj.js} +1 -1
- package/dist/assets/{sankeyDiagram-UM26HJRW-Cx12aSPG.js → sankeyDiagram-UM26HJRW-ChHoiXzB.js} +1 -1
- package/dist/assets/{sequenceDiagram-ZO4K6R2Y-DcV1QedB.js → sequenceDiagram-ZO4K6R2Y-B67gwOH0.js} +1 -1
- package/dist/assets/{sizeCapture-INFHLROL-BROnPBIO.js → sizeCapture-INFHLROL-DOr4ZALb.js} +1 -1
- package/dist/assets/{stateDiagram-v2-TBUQTH76-8oI_fQuf.js → stateDiagram-v2-TBUQTH76-DnoBtm-E.js} +1 -1
- package/dist/assets/{styles-B9Nw0uqu.js → styles-BcVNrxGE.js} +1 -1
- package/dist/assets/{swimlanes-N4OXWK64-eu_XqqPw.js → swimlanes-N4OXWK64-2TFXb7MH.js} +1 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-C_836Lnu.js +8 -0
- package/dist/assets/{team-share-CCRm9o2r.js → team-share-C9qIusMs.js} +1 -1
- package/dist/assets/{timeline-definition-YOQAKGHF-C6kOwwW9.js → timeline-definition-YOQAKGHF-4zjxAMyG.js} +1 -1
- package/dist/assets/{usecaseDiagram-VIAY4XPW-B_znjYaV.js → usecaseDiagram-VIAY4XPW-CCfZ1eoO.js} +1 -1
- package/dist/assets/{vennDiagram-BLWOH2XV-BSKbHvwy.js → vennDiagram-BLWOH2XV-h7rTFRTN.js} +1 -1
- package/dist/assets/{wardleyDiagram-YMQ3BMBF-YoDrToQs.js → wardleyDiagram-YMQ3BMBF-CXwA22zv.js} +1 -1
- package/dist/assets/{xychartDiagram-TAQBALBS-DVyv8Qod.js → xychartDiagram-TAQBALBS-d4qol5BJ.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/rail.html +4 -4
- package/dist-server/package.json +1 -1
- package/package.json +1 -1
- package/dist/assets/channel-CcBYtz0S.js +0 -1
- package/dist/assets/swimlanesDiagram-K3J5GTZL-CVl0fy_Y.js +0 -8
package/dist/assets/{BrowserProfilesManager-C-R1apBf.js → BrowserProfilesManager-B5ZQeFJ9.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-BcVNrxGE.js";import{W as Z,u as _,b8 as ee,D as R,G as se,T as te,n as B,A as z}from"./App-DBQxC6tF.js";import{r as ne,i as ie}from"./index-DgGTgaCO.js";import{S as q}from"./SignedInSites-Cm_X_p_X.js";import{P as re}from"./PlacesRail-D510vk5R.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,E as q,F as ve,H as M,t as n,G as se,Q,J as X,K as Pe,M as pe,N as Ce,O as Ee,T as fe,U as ze,V as Ae,W as Ue,Y as qe,Z as Me,$ as J,a as ue,a0 as $e,a1 as Ke,r as c,a2 as We,a3 as Ve,a4 as we,D as U,a5 as Ge,X as Je,a6 as Qe,a7 as Xe,a8 as Ye,a9 as Ze,aa as et,ab as Le,ac as tt}from"./styles-B9Nw0uqu.js";import{L as nt,y as st,C as at,z as lt,F as ot,G as rt,S as ct,H as dt,I as it}from"./PlacesRail-BuGh6RP-.js";import{u as ut}from"./App-DToXVaV2.js";import"./monitor-DOJm1Kz5.js";import"./index-Cpmj1m_f.js";import"./MenuMotion-DlcPi29I.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:Q,disabled:o,onClick:p,children:n("cloudBuy.one.email")}),e.jsx("button",{type:"button",className:X,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:Q,onClick:r,children:n("cloudAdd.close")}),o&&e.jsx("button",{type:"button",className:X,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?Pe(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?X:Q,disabled:f,onClick:k,children:[e.jsx(st,{size:14,"aria-hidden":"true"}),n("cloudAdd.reopenCheckout")]}),s&&e.jsxs("button",{type:"button",className:Q,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 H=[["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?H.length:Math.max(0,H.findIndex(([d])=>d===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/H.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:H.map(([d,w],j)=>({key:d,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:d=>y(d.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:J.map(d=>e.jsx("button",{type:"button",role:"radio","aria-checked":d===N,"aria-label":n(Ke[d]),tabIndex:d===N?0:-1,"data-color":d,onClick:()=>E(d),onKeyDown:w=>{const j=J.indexOf(d),W=w.key==="ArrowRight"||w.key==="ArrowDown"?1:w.key==="ArrowLeft"||w.key==="ArrowUp"?-1:0;if(!W)return;w.preventDefault();const Y=J[(j+W+J.length)%J.length];E(Y),w.currentTarget.parentElement?.querySelector(`[data-color="${Y}"]`)?.focus()},style:{background:$e(d)},className:ue("size-[26px] rounded-lg border-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",d===N?"border-ink shadow-[inset_0_0_0_2px_var(--color-app)]":"border-transparent")},d))})]}),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:Q,onClick:K,children:n("notice.notNow")}),e.jsx("button",{type:"button",className:X,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,H.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/H.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:H.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:X,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(dt,{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(ct,{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(Xe,Qe,"absolute end-4 top-4 z-10"),children:e.jsx(Je,{size:16})}),l&&e.jsx(Ye,{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]=c.useState(null),[v,N]=c.useState(void 0),[k,T]=c.useState(null),[$,y]=c.useState(null),[E,A]=c.useState(!1),[K,D]=c.useState(!1),[C,d]=c.useState(!1),[w,j]=c.useState(!1),[W,Y]=c.useState(0),[Z,me]=c.useState([]),[h,g]=c.useState(null),[I,O]=c.useState({email:"",code:""}),[B,ee]=c.useState(null),[F,P]=c.useState(null),[z,S]=c.useState(null),[,Te]=c.useState(0),[xe,ae]=c.useState(!1),[Ie,le]=c.useState(!1),[Oe,Fe]=c.useState(!1),L=!!(r&&s),oe=l.config?.profile?.email?.trim()||null,re=ot();c.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;c.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 ce=n("cloudSetup.myCloud"),V={typed:B?.typed??ce,color:B?.color??we,name:Ve(B?.typed??ce,ce)},_=()=>{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),P(null),S(null),ae(!1),le(!1)};c.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]),c.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;c.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]),c.useEffect(()=>{(u==="waiting"||u==="starting"||u==="ready")&&!xe&&ae(!0),(u==="ready"||u==="team-ready")&&s?.readySeen?.().catch(()=>{})},[u]),c.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]),c.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]),c.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]),c.useEffect(()=>{u!=="ready"||F!==null||P(!re&&typeof document.hasFocus=="function"&&document.hasFocus()?3:"off")},[u]);const ge=h?.step==="code"?h.resendAt:0;c.useEffect(()=>{if(!ge||ge<=t())return;const a=setTimeout(()=>Te(t()),1e3);return()=>clearTimeout(a)}),c.useEffect(()=>{if(z!=="copied")return;const a=setTimeout(()=>S(null),2500);return()=>clearTimeout(a)},[z]);const ne=a=>{C||(d(!0),j(!1),a().catch(()=>y("failed")).finally(()=>d(!1)))},he=()=>{C||!s||(d(!0),j(!1),P("done"),(async()=>{B?.dirty&&s.setLook&&await s.setLook(V.name,B.color).catch(()=>{}),await s.connectHome()})().then(()=>_(),()=>j(!0)).finally(()=>d(!1)))},_e=a=>{C||!s?.openTeam||(d(!0),j(!1),s.openTeam(a).then(()=>_(),()=>j(!0)).finally(()=>d(!1)))};c.useEffect(()=>{if(typeof F!="number")return;const a=setTimeout(()=>{F>1?P(F-1):he()},1e3);return()=>clearTimeout(a)},[F]);const be=typeof F=="number";if(c.useEffect(()=>{if(!be)return;const a=()=>P("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,de=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;d(!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(()=>d(!1))},De=a=>{if(!s.signInVerify||h?.step!=="code")return;const i=h,b=i.intent?ke():null;d(!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 de(b)):(le(!0),T(b))),g(null),O({email:I.email,code:""})}catch{g({...i,problem:"failed",triesLeft:null})}finally{d(!1)}})()},Re={start:a=>{if(T(a),A(!1),x.kind==="offer"&&x.signedOut&&s.signInStart){je(!0);return}ne(()=>de(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 de(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;d(!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(()=>d(!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),Y(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:()=>P("off"),interest:()=>{C||!s.interest||(d(!0),s.interest().then(()=>S("interest-sent"),()=>S("interest-failed")).finally(()=>d(!1)))},close:_},He={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:He,actions:Re})})}export{Tt as CloudAddDialog,ht as CloudAddPanel,Be as CloudAddSheet};
|
|
1
|
+
import{j as e,E as q,F as ve,H as M,t as n,G as se,Q,J as X,K as Pe,M as pe,N as Ce,O as Ee,T as fe,U as ze,V as Ae,W as Ue,Y as qe,Z as Me,$ as J,a as ue,a0 as $e,a1 as Ke,r as c,a2 as We,a3 as Ve,a4 as we,D as U,a5 as Ge,X as Je,a6 as Qe,a7 as Xe,a8 as Ye,a9 as Ze,aa as et,ab as Le,ac as tt}from"./styles-BcVNrxGE.js";import{L as nt,y as st,C as at,z as lt,F as ot,G as rt,S as ct,H as dt,I as it}from"./PlacesRail-D510vk5R.js";import{u as ut}from"./App-DBQxC6tF.js";import"./monitor-DOeLdhQc.js";import"./index-DgGTgaCO.js";import"./MenuMotion-CLF0GByT.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:Q,disabled:o,onClick:p,children:n("cloudBuy.one.email")}),e.jsx("button",{type:"button",className:X,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:Q,onClick:r,children:n("cloudAdd.close")}),o&&e.jsx("button",{type:"button",className:X,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?Pe(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?X:Q,disabled:f,onClick:k,children:[e.jsx(st,{size:14,"aria-hidden":"true"}),n("cloudAdd.reopenCheckout")]}),s&&e.jsxs("button",{type:"button",className:Q,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 H=[["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?H.length:Math.max(0,H.findIndex(([d])=>d===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/H.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:H.map(([d,w],j)=>({key:d,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:d=>y(d.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:J.map(d=>e.jsx("button",{type:"button",role:"radio","aria-checked":d===N,"aria-label":n(Ke[d]),tabIndex:d===N?0:-1,"data-color":d,onClick:()=>E(d),onKeyDown:w=>{const j=J.indexOf(d),W=w.key==="ArrowRight"||w.key==="ArrowDown"?1:w.key==="ArrowLeft"||w.key==="ArrowUp"?-1:0;if(!W)return;w.preventDefault();const Y=J[(j+W+J.length)%J.length];E(Y),w.currentTarget.parentElement?.querySelector(`[data-color="${Y}"]`)?.focus()},style:{background:$e(d)},className:ue("size-[26px] rounded-lg border-2 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",d===N?"border-ink shadow-[inset_0_0_0_2px_var(--color-app)]":"border-transparent")},d))})]}),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:Q,onClick:K,children:n("notice.notNow")}),e.jsx("button",{type:"button",className:X,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,H.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/H.length,label:n("cloudBuy.setup.progress")}),e.jsx(fe,{label:n("cloudBuy.setup.progress"),items:H.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:X,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(dt,{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(ct,{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(Xe,Qe,"absolute end-4 top-4 z-10"),children:e.jsx(Je,{size:16})}),l&&e.jsx(Ye,{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]=c.useState(null),[v,N]=c.useState(void 0),[k,T]=c.useState(null),[$,y]=c.useState(null),[E,A]=c.useState(!1),[K,D]=c.useState(!1),[C,d]=c.useState(!1),[w,j]=c.useState(!1),[W,Y]=c.useState(0),[Z,me]=c.useState([]),[h,g]=c.useState(null),[I,O]=c.useState({email:"",code:""}),[B,ee]=c.useState(null),[F,P]=c.useState(null),[z,S]=c.useState(null),[,Te]=c.useState(0),[xe,ae]=c.useState(!1),[Ie,le]=c.useState(!1),[Oe,Fe]=c.useState(!1),L=!!(r&&s),oe=l.config?.profile?.email?.trim()||null,re=ot();c.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;c.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 ce=n("cloudSetup.myCloud"),V={typed:B?.typed??ce,color:B?.color??we,name:Ve(B?.typed??ce,ce)},_=()=>{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),P(null),S(null),ae(!1),le(!1)};c.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]),c.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;c.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]),c.useEffect(()=>{(u==="waiting"||u==="starting"||u==="ready")&&!xe&&ae(!0),(u==="ready"||u==="team-ready")&&s?.readySeen?.().catch(()=>{})},[u]),c.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]),c.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]),c.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]),c.useEffect(()=>{u!=="ready"||F!==null||P(!re&&typeof document.hasFocus=="function"&&document.hasFocus()?3:"off")},[u]);const ge=h?.step==="code"?h.resendAt:0;c.useEffect(()=>{if(!ge||ge<=t())return;const a=setTimeout(()=>Te(t()),1e3);return()=>clearTimeout(a)}),c.useEffect(()=>{if(z!=="copied")return;const a=setTimeout(()=>S(null),2500);return()=>clearTimeout(a)},[z]);const ne=a=>{C||(d(!0),j(!1),a().catch(()=>y("failed")).finally(()=>d(!1)))},he=()=>{C||!s||(d(!0),j(!1),P("done"),(async()=>{B?.dirty&&s.setLook&&await s.setLook(V.name,B.color).catch(()=>{}),await s.connectHome()})().then(()=>_(),()=>j(!0)).finally(()=>d(!1)))},_e=a=>{C||!s?.openTeam||(d(!0),j(!1),s.openTeam(a).then(()=>_(),()=>j(!0)).finally(()=>d(!1)))};c.useEffect(()=>{if(typeof F!="number")return;const a=setTimeout(()=>{F>1?P(F-1):he()},1e3);return()=>clearTimeout(a)},[F]);const be=typeof F=="number";if(c.useEffect(()=>{if(!be)return;const a=()=>P("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,de=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;d(!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(()=>d(!1))},De=a=>{if(!s.signInVerify||h?.step!=="code")return;const i=h,b=i.intent?ke():null;d(!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 de(b)):(le(!0),T(b))),g(null),O({email:I.email,code:""})}catch{g({...i,problem:"failed",triesLeft:null})}finally{d(!1)}})()},Re={start:a=>{if(T(a),A(!1),x.kind==="offer"&&x.signedOut&&s.signInStart){je(!0);return}ne(()=>de(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 de(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;d(!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(()=>d(!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),Y(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:()=>P("off"),interest:()=>{C||!s.interest||(d(!0),s.interest().then(()=>S("interest-sent"),()=>S("interest-failed")).finally(()=>d(!1)))},close:_},He={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:He,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-BcVNrxGE.js";import{a2 as F,a3 as S,x as L,S as z,a4 as y,a5 as b,a6 as A,a7 as M,a8 as w,a9 as k,aa as P,ab as E,ac as $,u as I,w as B,F as O,ad as v,ae as T,af as D,ag as C,ah as H,ai as W,aj as X}from"./App-DBQxC6tF.js";import{a as _,R as q}from"./RoutinesPage-9VDuovqw.js";import{L as G,P as J,d as K}from"./PlacesRail-D510vk5R.js";import{C as Q}from"./MenuMotion-CLF0GByT.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};
|