@hanzo/app 0.3.94 → 0.3.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/Account.d.ts +9 -3
  2. package/dist/Account.js +142 -141
  3. package/dist/App.js +71 -37
  4. package/dist/Bar.js +1 -1
  5. package/dist/Betas.d.ts +1 -1
  6. package/dist/Betas.js +16 -22
  7. package/dist/Board.js +114 -48
  8. package/dist/CalScheduler.d.ts +1 -0
  9. package/dist/CalScheduler.js +223 -57
  10. package/dist/Chat.js +432 -153
  11. package/dist/Contacts.js +35 -31
  12. package/dist/ContextMenu.js +126 -42
  13. package/dist/Directory.js +1 -1
  14. package/dist/Drawer.js +1 -1
  15. package/dist/Drive.js +351 -119
  16. package/dist/Gate.js +156 -13
  17. package/dist/Home.js +31 -53
  18. package/dist/Inbox.js +29 -15
  19. package/dist/InlineRename.d.ts +6 -0
  20. package/dist/InlineRename.js +41 -0
  21. package/dist/Learning.js +132 -13
  22. package/dist/Market.js +13 -9
  23. package/dist/Meet.d.ts +5 -0
  24. package/dist/Meet.js +75 -51
  25. package/dist/MoreMenu.d.ts +19 -0
  26. package/dist/MoreMenu.js +33 -0
  27. package/dist/NeedMoreUsage.js +2 -2
  28. package/dist/OrgSwitcher.js +6 -2
  29. package/dist/PreferencesDialog.js +5 -2
  30. package/dist/Rail.d.ts +73 -7
  31. package/dist/Rail.js +372 -111
  32. package/dist/Recents.js +77 -24
  33. package/dist/RightPane.js +2 -2
  34. package/dist/Search.d.ts +13 -1
  35. package/dist/Search.js +366 -50
  36. package/dist/Setup.js +34 -5
  37. package/dist/Shared.js +12 -12
  38. package/dist/Shell.d.ts +10 -0
  39. package/dist/Shell.js +258 -158
  40. package/dist/Sidebar.d.ts +14 -3
  41. package/dist/Sidebar.js +411 -129
  42. package/dist/SkipLink.d.ts +8 -0
  43. package/dist/SkipLink.js +11 -0
  44. package/dist/Start.js +51 -52
  45. package/dist/Terminals.js +159 -11
  46. package/dist/ToBottom.js +1 -1
  47. package/dist/Upgrade.d.ts +8 -3
  48. package/dist/Upgrade.js +194 -103
  49. package/dist/Usage.d.ts +1 -1
  50. package/dist/Usage.js +186 -82
  51. package/dist/WalletPill.js +8 -2
  52. package/dist/Work.js +162 -53
  53. package/dist/archive.d.ts +8 -0
  54. package/dist/archive.js +16 -0
  55. package/dist/bots/Bots.js +16 -1
  56. package/dist/bots/ComputerDialog.js +53 -26
  57. package/dist/bots/ConnectorsDialog.js +34 -15
  58. package/dist/bots/Make.js +5 -1
  59. package/dist/bots/Panel.js +37 -31
  60. package/dist/bots/Roster.d.ts +4 -1
  61. package/dist/bots/Roster.js +71 -25
  62. package/dist/bots/Thread.js +54 -27
  63. package/dist/bots/face.js +9 -3
  64. package/dist/bots/grid.d.ts +36 -0
  65. package/dist/bots/grid.js +91 -0
  66. package/dist/bots/ink.d.ts +1 -1
  67. package/dist/bots/ink.js +1 -1
  68. package/dist/bots/kit.d.ts +9 -4
  69. package/dist/bots/kit.js +3 -2
  70. package/dist/chord.d.ts +13 -0
  71. package/dist/chord.js +30 -1
  72. package/dist/crew.js +47 -4
  73. package/dist/ground.d.ts +2 -2
  74. package/dist/ground.js +3 -3
  75. package/dist/help.d.ts +7 -3
  76. package/dist/help.js +19 -14
  77. package/dist/keys.d.ts +28 -0
  78. package/dist/keys.js +58 -0
  79. package/dist/lib/arrival.d.ts +5 -0
  80. package/dist/lib/arrival.js +10 -0
  81. package/dist/lib/betas.d.ts +2 -0
  82. package/dist/lib/betas.js +10 -0
  83. package/dist/lib/branch.d.ts +11 -0
  84. package/dist/lib/branch.js +11 -0
  85. package/dist/lib/chatPreferences.d.ts +1 -1
  86. package/dist/lib/chatPreferences.js +1 -1
  87. package/dist/lib/dev-mode.d.ts +18 -0
  88. package/dist/lib/dev-mode.js +102 -0
  89. package/dist/lib/durable.d.ts +1 -1
  90. package/dist/lib/durable.js +1 -1
  91. package/dist/lib/info-hint.d.ts +7 -0
  92. package/dist/lib/info-hint.js +8 -0
  93. package/dist/lib/model-picker.d.ts +2 -0
  94. package/dist/lib/model-picker.js +12 -0
  95. package/dist/lib/owners.d.ts +5 -0
  96. package/dist/lib/owners.js +15 -0
  97. package/dist/lib/pay.d.ts +2 -0
  98. package/dist/lib/pay.js +4 -0
  99. package/dist/lib/todo.d.ts +7 -1
  100. package/dist/lib/todo.js +41 -29
  101. package/dist/look.js +39 -8
  102. package/dist/rail-open.d.ts +9 -0
  103. package/dist/rail-open.js +34 -0
  104. package/dist/renaming.d.ts +10 -0
  105. package/dist/renaming.js +25 -0
  106. package/dist/seek.d.ts +6 -1
  107. package/dist/seek.js +13 -0
  108. package/dist/thread.d.ts +2 -1
  109. package/dist/thread.js +85 -44
  110. package/package.json +11 -11
package/dist/Account.d.ts CHANGED
@@ -9,7 +9,7 @@ export interface Org {
9
9
  personal: boolean;
10
10
  role: string;
11
11
  }
12
- /** The first letters of a name, at most two: Antje Worring → AW. */
12
+ /** The first letters of a name, at most two: Antje Worring -> AW. */
13
13
  export declare const initials: (name: string) => string;
14
14
  /** The plan from a tier answer: its display name (`Unlimited`), else by its family (`Max 20x`); '' with no plan. */
15
15
  export declare const planOf: (tier: Tier | null) => string;
@@ -26,10 +26,10 @@ export declare function Face({ host, size }: {
26
26
  export declare const upgrade: (family: string | null | undefined) => string;
27
27
  export declare function Account({ host, narrow, above, onOrg, defaultAccountOpen, }: {
28
28
  host: Who;
29
- /** The rail's: the face alone, the menu opening beside it. */
29
+ /** The rail's folded mode: the face alone, the hover card opening beside it. */
30
30
  narrow?: boolean;
31
31
  /**
32
- * The menu opens above the face, not beside it: the foot of a phone's menu
32
+ * The card opens above the face, not beside it: the foot of a phone's menu
33
33
  * (Drawer.tsx). That copy leaves ⌘/ to the rail's own, so one press opens one dialog.
34
34
  */
35
35
  above?: boolean;
@@ -37,6 +37,12 @@ export declare function Account({ host, narrow, above, onOrg, defaultAccountOpen
37
37
  onOrg: (org: string) => void;
38
38
  defaultAccountOpen?: boolean;
39
39
  }): import("react").JSX.Element;
40
+ /** The app's keys (help.ts `KEYS`), categorized with crisp `--border-strong` keycaps for this platform. */
41
+ export declare function Shortcuts({ open, onOpenChange, apple }: {
42
+ open: boolean;
43
+ onOpenChange: (open: boolean) => void;
44
+ apple: boolean;
45
+ }): import("react").JSX.Element;
40
46
  /**
41
47
  * What became of an organization this tab created: nothing to say once the token
42
48
  * carries it (the app is already in it), and a plain line while it does not.
package/dist/Account.js CHANGED
@@ -1,45 +1,20 @@
1
1
  'use client';
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- // The account row and the menu it opens: the one account menu. The app's rail
4
- // draws it for Chat, Dev and Studio (Rail.tsx) and the shell's sidebar for every
5
- // other app (Shell.tsx).
6
- //
7
- // Top to bottom: who, with their plan, a row whose › opens the account itself;
8
- // then Upgrade plan, Personalization, Profile and Settings (⌘, / Ctrl+,); Beta,
9
- // the person's place on the beta waitlist (the site's /beta/status); then
10
- // Help ›, the site's own pages and the keyboard shortcuts (⌘/ / Ctrl+/ from
11
- // anywhere); and Log out. Every row opens a real destination: Settings'
12
- // pages through `showSettings` (open.ts), which the app answers with the
13
- // site's Settings at /settings (App.tsx) and the shell with its own pane; the plans on the
14
- // pay site (`leave`); the site's pages through `site()`, so hanzo.team names
15
- // hanzo.ai (help.ts).
16
- //
17
- // THE ACCOUNT'S › LEADS WITH THE PLAN: @hanzo/build's `Meter`, the plan by its
18
- // family (`Max` with `20x` beside it) and, on a plan, its windows as shares; the
19
- // free allowance left today on Free; the balance only for an account with no
20
- // plan, whose meter it is. Then every organization the token names — the
21
- // personal one first, with its plan — switched with `onOrg`; Create
22
- // organization, Organization settings, and Hanzo Team (opened in the same
23
- // organization for a team, offered as "Create a team" for a personal one); and
24
- // All organizations for a SuperAdmin, which opens the chooser (Gate.tsx).
25
- //
26
- // Its words go through `t`; names, plans, addresses and keys are drawn as they
27
- // are, a key isolated left to right so its `+` and `,` keep their places in a
28
- // right-to-left menu, which opens toward the content from the rail's side.
29
- //
30
- // IAM is the source of every fact here: names and roles from the token's `orgs`
31
- // claim, display names and which org is personal from `GET /v1/iam/organizations`,
32
- // the plan from billing and the limits. An organization is created by the same
33
- // `POST /v1/account/orgs` the no-organization gate uses (Gate.tsx); the next load
34
- // mints a token that carries it.
3
+ // Unified profile trigger & HoverCard for the signed-in shell:
4
+ // - Hovering shows membership tier, live usage/credit stats, Developer mode toggle,
5
+ // workspace switcher, Upgrade CTA, and quick actions.
6
+ // - Clicking the profile button itself remembers the current route and opens
7
+ // `/settings/account` in 1 click.
8
+ // - A subtle `⋯` menu inside the hover card exposes multi-account switching,
9
+ // language selection, keyboard shortcuts, and organization creation.
35
10
  import { phrase, locales } from '@hanzo/i18n';
36
11
  import { useI18n } from '@hanzo/i18n/react';
37
12
  import { useEffect, useMemo, useRef, useState } from 'react';
38
13
  import { SizableText, XStack, YStack } from '@hanzo/gui';
39
- import { ArrowUpRight, Activity, BookOpen, Building2, Check, ChevronsUpDown, CircleHelp, CircleUserRound, Download, FileText, FlaskConical, Info, Keyboard, Languages, LifeBuoy, LogOut, MessagesSquare, Palette, Plus, ScrollText, Settings, ShieldCheck, Sparkles, UserPlus, Users, X, } from 'lucide-react';
14
+ import { ArrowUpRight, Activity, BookOpen, Building2, Check, ChevronDown, ChevronRight, CircleHelp, CircleUserRound, Download, FileText, FlaskConical, Info, Keyboard, Languages, LifeBuoy, LogOut, MessagesSquare, MoreHorizontal, Palette, Plus, ScrollText, Settings, ShieldCheck, Sparkles, UserPlus, Users, X, } from 'lucide-react';
40
15
  import { label, Meter, said as spoken, useStanding } from '@hanzo/build';
41
16
  import { useOrganizations } from '@hanzo/iam/react';
42
- import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, Kbd, } from '@hanzo/ui';
17
+ import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, Kbd, Switch, Text, } from '@hanzo/ui';
43
18
  import { label as accountLabel, useAccounts } from './lib/accounts.js';
44
19
  import { api } from './lib/api.js';
45
20
  import { createOrg, say } from './lib/org.js';
@@ -48,15 +23,20 @@ import { onServed } from './lib/served.js';
48
23
  import { subscribeTokens, totalRecordedTokens } from './lib/tokens.js';
49
24
  import { choose, org as current, orgs, renew, reopen, scope, superAdmin } from './lib/session.js';
50
25
  import { ENTRY, settings } from './lib/host.js';
26
+ import { rememberSettingsReturn, useDevMode } from './lib/dev-mode.js';
27
+ import { InfoHint } from './lib/info-hint.js';
51
28
  import { leave } from './dev.js';
52
- import { payUrl } from './lib/pay.js';
53
- import { asked, KEYS, legal, out, pages } from './help.js';
29
+ import { KEYS, legal, out, pages } from './help.js';
54
30
  import { showSettings } from './open.js';
55
31
  import { MARK } from './ground.js';
56
32
  import { site, where } from './where.js';
57
33
  import { BAD } from './lib/mix.js';
58
34
  /** An organization this tab created, until the token carries it. */
59
35
  const MADE = 'hanzo:org:made';
36
+ const INK = 'var(--foreground)';
37
+ const SOFT = 'var(--text-secondary, var(--muted-foreground))';
38
+ const STRONG = 'var(--border-strong)';
39
+ const FOCUS_RING = { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' };
60
40
  /** Each Help page's icon, by its key in help.ts. */
61
41
  const ICONS = {
62
42
  help: _jsx(CircleHelp, { size: 16, "aria-hidden": true }),
@@ -70,9 +50,9 @@ const ICONS = {
70
50
  };
71
51
  /** IAM's roles as a person reads them, through `t`. */
72
52
  const ROLES = { owner: phrase('Owner'), admin: phrase('Admin'), member: phrase('Member') };
73
- /** A role as a person reads it: `owner` → Owner; one IAM names that these do not, capitalised as it comes. */
53
+ /** A role as a person reads it: `owner` -> Owner; one IAM names that these do not, capitalised as it comes. */
74
54
  const said = (role, t) => ROLES[role] ? t(ROLES[role]) : role ? role.charAt(0).toUpperCase() + role.slice(1) : '';
75
- /** The first letters of a name, at most two: Antje Worring → AW. */
55
+ /** The first letters of a name, at most two: Antje Worring -> AW. */
76
56
  export const initials = (name) => name
77
57
  .split(/[\s@._-]+/)
78
58
  .filter(Boolean)
@@ -85,7 +65,7 @@ export const planOf = (tier) => (tier ? spoken(label(tier.plan, tier.tier?.name,
85
65
  * The token's organizations with IAM's rows beside them: display name, and which
86
66
  * one is the person's own. The personal organization leads, then the token's order.
87
67
  */
88
- function useOrgs(current) {
68
+ function useOrgs(currentOrg) {
89
69
  const { roles } = useOrganizations();
90
70
  const names = orgs();
91
71
  const [rows, setRows] = useState([]);
@@ -102,21 +82,21 @@ function useOrgs(current) {
102
82
  })
103
83
  .catch(() => { });
104
84
  return () => stop.abort();
105
- }, [key, current]);
85
+ }, [key, currentOrg]);
106
86
  const drawn = names.map((name) => {
107
87
  const row = rows.find((r) => r?.name === name);
108
88
  return { name, display: row?.displayName || name, personal: Boolean(row?.isPersonal), role: roles?.[name] ?? '' };
109
89
  });
110
90
  return [...drawn.filter((o) => o.personal), ...drawn.filter((o) => !o.personal)];
111
91
  }
112
- /** The plan of an organization other than the current one: billing, asked in its name. */
113
- function usePlan(org, enabled) {
92
+ /** The plan of an organization: billing, asked in its name. */
93
+ function usePlan(orgName, enabled) {
114
94
  const [plan, setPlan] = useState('');
115
95
  useEffect(() => {
116
- if (!enabled || !org)
96
+ if (!enabled || !orgName)
117
97
  return;
118
98
  const stop = new AbortController();
119
- fetch(`${api()}/v1/billing/tier`, { headers: { ...scope(), 'X-Org-Id': org }, signal: stop.signal })
99
+ fetch(`${api()}/v1/billing/tier`, { headers: { ...scope(), 'X-Org-Id': orgName }, signal: stop.signal })
120
100
  .then((r) => (r.ok ? r.json() : null))
121
101
  .then((t) => {
122
102
  if (!stop.signal.aborted)
@@ -124,7 +104,7 @@ function usePlan(org, enabled) {
124
104
  })
125
105
  .catch(() => { });
126
106
  return () => stop.abort();
127
- }, [org, enabled]);
107
+ }, [orgName, enabled]);
128
108
  return plan;
129
109
  }
130
110
  /** The person's picture, or their initials. */
@@ -135,14 +115,14 @@ export function Face({ host, size = 28 }) {
135
115
  useEffect(() => {
136
116
  setFailed(false);
137
117
  }, [cleanSrc]);
138
- return (_jsx(XStack, { width: size, height: size, rounded: 9999, items: "center", justify: "center", bg: "$raised", overflow: "hidden", shrink: 0, borderWidth: 1, borderColor: "$borderColor", children: cleanSrc && !failed ? (_jsx("img", { src: cleanSrc, alt: "", width: size, height: size, onError: () => setFailed(true) })) : (_jsx(SizableText, { fontSize: Math.max(10, Math.round(size * 0.39)), lineHeight: size, fontWeight: "600", color: "$ink", children: initials(p?.name || p?.email || '') })) }));
118
+ return (_jsx(XStack, { width: size, height: size, rounded: 9999, items: "center", justify: "center", bg: "$raised", overflow: "hidden", shrink: 0, borderWidth: 1, borderColor: STRONG, children: cleanSrc && !failed ? (_jsx("img", { src: cleanSrc, alt: "", width: size, height: size, onError: () => setFailed(true) })) : (_jsx(SizableText, { size: size >= 30 ? '$2' : '$1', fontWeight: "600", color: "$ink", children: initials(p?.name || p?.email || '') })) }));
139
119
  }
140
120
  /** A row's face: its icon in a 20px well, its words, and what trails them. */
141
121
  function Line({ icon, children, sub, trail }) {
142
122
  return (_jsxs(_Fragment, { children: [icon !== undefined ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: icon })) : null, _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: children }), sub ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: sub })) : null] }), trail] }));
143
123
  }
144
124
  /** An organization's mark in the list: its initials on a rounded square. */
145
- const Mark = ({ org }) => (_jsx(XStack, { width: 18, height: 18, rounded: "$2", items: "center", justify: "center", bg: "$raised", shrink: 0, children: org.personal ? (_jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", children: initials(org.display).charAt(0) })) : (_jsx(Building2, { size: 12, "aria-hidden": true })) }));
125
+ const Mark = ({ org }) => (_jsx(XStack, { width: 18, height: 18, rounded: "$2", items: "center", justify: "center", bg: "$raised", borderWidth: 1, borderColor: "$edge", shrink: 0, children: org.personal ? (_jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", children: initials(org.display).charAt(0) })) : (_jsx(Building2, { size: 12, color: INK, "aria-hidden": true })) }));
146
126
  /**
147
127
  * The plans row, named by the plan the organization is on: Enterprise and
148
128
  * Agency are plans a person stays on, so the row names theirs; every other
@@ -154,49 +134,49 @@ const mac = () => typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(nav
154
134
  export function Account({ host, narrow = false, above = false, onOrg, defaultAccountOpen = false, }) {
155
135
  const { t, dir, locale, setLocale } = useI18n();
156
136
  const rtl = dir === 'rtl';
157
- const [open, setOpen] = useState(false);
137
+ const [devMode, setDevMode] = useDevMode();
138
+ const [hoverOpen, setHoverOpen] = useState(false);
139
+ const [menuOpen, setMenuOpen] = useState(false);
140
+ const [workspacesOpen, setWorkspacesOpen] = useState(false);
158
141
  const [account, setAccount] = useState(defaultAccountOpen ?? false);
159
- const [orgs, setOrgs] = useState(false);
142
+ const [orgsOpen, setOrgsOpen] = useState(false);
160
143
  const [lang, setLang] = useState(false);
161
144
  const [langQuery, setLangQuery] = useState('');
162
145
  const [help, setHelp] = useState(false);
163
146
  const [creating, setCreating] = useState(false);
164
147
  const [keys, setKeys] = useState(false);
165
148
  const row = useRef(null);
166
- const current = host.org;
167
- // Every other account signed in on this browser, one press away, a new one
168
- // (lib/accounts: the sign-in with login_hint, and with prompt=login) and a way
169
- // out of this one alone.
149
+ const currentOrg = host.org;
170
150
  const signedIn = useAccounts();
171
151
  const others = signedIn.accounts.filter((a) => a.sub !== signedIn.current?.sub);
172
152
  const several = signedIn.accounts.length > 1;
173
- const all = useOrgs(current);
174
- const here = all.find((o) => o.name === current) ?? null;
153
+ const all = useOrgs(currentOrg);
154
+ const here = all.find((o) => o.name === currentOrg) ?? null;
175
155
  const personal = all.find((o) => o.personal) ?? null;
176
156
  const target = useMemo(() => ({ api: host.api, token: host.token, org: host.org }), [host.api, host.token, host.org]);
177
- const read = useStanding(target, open);
178
- const currentTierPlan = usePlan(current, Boolean(host.person));
157
+ const read = useStanding(target, Boolean(host.person));
158
+ const currentTierPlan = usePlan(currentOrg, Boolean(host.person));
179
159
  const [tokenTick, setTokenTick] = useState(0);
180
160
  useEffect(() => {
181
161
  const offServed = onServed(() => {
182
162
  setTokenTick((n) => n + 1);
183
- if (open)
163
+ if (hoverOpen || menuOpen)
184
164
  read.reload();
185
165
  });
186
166
  const offTokens = subscribeTokens(() => {
187
167
  setTokenTick((n) => n + 1);
188
- if (open)
168
+ if (hoverOpen || menuOpen)
189
169
  read.reload();
190
170
  });
191
171
  return () => {
192
172
  offServed();
193
173
  offTokens();
194
174
  };
195
- }, [open, read]);
175
+ }, [hoverOpen, menuOpen, read]);
196
176
  useEffect(() => {
197
- if (account && open)
177
+ if (hoverOpen || (account && menuOpen))
198
178
  read.reload();
199
- }, [account, open, read]);
179
+ }, [hoverOpen, account, menuOpen, read]);
200
180
  useEffect(() => {
201
181
  if (typeof window === 'undefined')
202
182
  return;
@@ -236,40 +216,31 @@ export function Account({ host, narrow = false, above = false, onOrg, defaultAcc
236
216
  },
237
217
  };
238
218
  }, [read, tokenTick]);
239
- const other = usePlan(personal && personal.name !== current ? personal.name : null, open);
240
- // THE TWO ACCOUNTS, apart: the organization's plan (hanzo · Enterprise) and the
241
- // person's own (Personal · Pro, or none and the way to one). A business plan is
242
- // the organization's; a personal plan is held beside it, never instead of it.
243
- const team = here && !here.personal ? here : (all.find((o) => !o.personal) ?? null);
244
- const teamOther = usePlan(team && team.name !== current ? team.name : null, open);
219
+ const other = usePlan(personal && personal.name !== currentOrg ? personal.name : null, hoverOpen || menuOpen);
245
220
  const plan = spoken(read.value?.label ?? null) || currentTierPlan;
246
- const planFor = (o) => (o.name === current ? plan : o.personal ? other : '');
221
+ const planFor = (o) => (o.name === currentOrg ? plan : o.personal ? other : '');
247
222
  const who = host.person?.name || host.person?.email || '';
248
- const teamPlan = team ? (team.name === current ? plan : teamOther) : '';
249
- const ownPlan = personal ? (personal.name === current ? plan : other) : '';
250
223
  const isFree = !plan || plan.toLowerCase() === 'free';
251
- const planName = plan || (isFree ? t('Free') : '');
252
- // Where the reader works, and on what: "hanzo - Enterprise", "Personal - Pro", "Personal - Free".
253
- const working = [here ? (here.personal ? t('Personal') : here.display) : current, planName].filter(Boolean).join(' - ');
254
- // A personal plan is bought for the personal organization, beside any business one.
255
- // The plans row's name (a phrase of `upgrade`'s).
224
+ const planName = plan || t('Free');
225
+ const working = [here ? (here.personal ? t('Personal') : here.display) : currentOrg, planName].filter(Boolean).join(' - ');
256
226
  const plans = upgrade(read.value?.label?.name);
257
- const getPro = () => (personal ? window.location.assign(payUrl('/cart', { org: personal.name, returnUrl: window.location.href })) : window.location.assign(payUrl('/cart', { returnUrl: window.location.href })));
258
227
  const apple = mac();
259
- useEffect(() => {
260
- if (above)
228
+ const goSettings = (section) => {
229
+ setHoverOpen(false);
230
+ setMenuOpen(false);
231
+ rememberSettingsReturn();
232
+ showSettings(section);
233
+ };
234
+ const triggerUpgrade = () => {
235
+ setHoverOpen(false);
236
+ setMenuOpen(false);
237
+ if (read.value?.label?.name === 'Enterprise' || read.value?.label?.name === 'Agency') {
238
+ rememberSettingsReturn();
239
+ showSettings('billing');
261
240
  return;
262
- const press = (e) => {
263
- if (!asked(e))
264
- return;
265
- e.preventDefault();
266
- setOpen(false);
267
- setKeys(true);
268
- };
269
- window.addEventListener('keydown', press);
270
- return () => window.removeEventListener('keydown', press);
271
- }, [above]);
272
- // Focus goes back to the row only when nothing the menu opened (a dialog) took it.
241
+ }
242
+ leave('here');
243
+ };
273
244
  const back = (e) => {
274
245
  e.preventDefault();
275
246
  requestAnimationFrame(() => {
@@ -280,57 +251,91 @@ export function Account({ host, narrow = false, above = false, onOrg, defaultAcc
280
251
  };
281
252
  if (!host.person)
282
253
  return null;
283
- return (_jsxs(_Fragment, { children: [_jsxs(DropdownMenu, { open: open, onOpenChange: (next) => {
284
- setOpen(next);
285
- if (next)
254
+ const tierPill = (_jsx(XStack, { "data-slot": "me-tier-pill", px: "$2", py: 2, rounded: "$10", items: "center", justify: "center", shrink: 0, borderWidth: 1, bg: isFree ? '$panel' : '$raised', borderColor: isFree ? '$edge' : STRONG, children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "600", color: isFree ? '$aside' : '$ink', numberOfLines: 1, children: planName }) }));
255
+ return (_jsxs(_Fragment, { children: [_jsxs(HoverCard, { open: hoverOpen, onOpenChange: (next) => {
256
+ if (!next && menuOpen)
286
257
  return;
287
- setAccount(false);
288
- setOrgs(false);
289
- setLang(false);
290
- setHelp(false);
291
- },
292
- // Toward the content from the rail, and aligned as the row's own edge is: mirrored right to left.
293
- placement: narrow && !above ? (rtl ? 'left-end' : 'right-end') : above !== rtl ? 'top-end' : 'top-start',
294
- // Clear of the rail's mark (or the row) it opens from, and flush with its foot.
295
- offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { ref: (el) => {
258
+ setHoverOpen(next);
259
+ if (!next)
260
+ setWorkspacesOpen(false);
261
+ }, openDelay: 120, closeDelay: 180, children: [_jsx(HoverCardTrigger, { asChild: true, children: _jsxs(XStack, { ref: (el) => {
296
262
  row.current = el instanceof HTMLElement ? el : null;
297
- }, render: "button", "data-slot": "me", "aria-label": t('Account: {name}', { name: [who, current].filter(Boolean).join(' · ') }), width: narrow ? (above ? 44 : MARK) : '100%', height: narrow ? (above ? 44 : MARK) : undefined, minH: narrow ? (above ? 44 : MARK) : 48,
298
- // A thumb's 44 on a touch screen.
299
- $touchable: narrow ? { width: 44, height: 44, minH: 44 } : undefined, px: narrow ? 0 : '$2', gap: "$2.5", rounded: narrow ? 12 : '$5', borderWidth: narrow && above ? 1 : 0, borderColor: narrow && above ? 'var(--border-strong)' : undefined, bg: narrow && above ? 'var(--pane-fill)' : narrow && open ? '$edge' : 'transparent', items: "center", justify: narrow ? 'center' : 'flex-start', hoverStyle: { bg: narrow && open ? '$edge' : '$hover' }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, cursor: "pointer", children: [_jsx(Face, { host: host, size: narrow ? (above ? 32 : 26) : 32 }), narrow ? null : (_jsxs(_Fragment, { children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$3", fontWeight: "600", color: "$ink", numberOfLines: 1, text: "start", children: who }), working ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, text: "start", children: working })) : null] }), isFree ? (_jsx(Button, { size: "xs", variant: "outline", "data-slot": "me-upgrade", px: "$2", py: "$0.5", rounded: "$3", onPress: (e) => {
300
- e?.stopPropagation?.();
301
- getPro();
302
- }, cursor: "pointer", children: t('Upgrade plan') })) : null, _jsx(ChevronsUpDown, { size: 14, "aria-hidden": true, opacity: 0.6 })] }))] }) }), _jsxs(DropdownMenuContent, { minW: 260, maxW: "calc(100vw - 16px)", "aria-labelledby": undefined, "aria-label": t('Account'), onCloseAutoFocus: back, children: [_jsxs(DropdownMenuSub, { open: account, onOpenChange: setAccount, children: [_jsxs(DropdownMenuSubTrigger, { minH: 48, gap: "$2.5", "data-slot": "me-account", children: [_jsx(Face, { host: host, size: 28 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: who }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: host.person.email || working })] })] }), account ? (_jsxs(DropdownMenuSubContent, { minW: 240, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: [_jsx(YStack, { cursor: "pointer", rounded: "$3", hoverStyle: { bg: '$hover' }, onPress: () => {
303
- setOpen(false);
304
- showSettings('usage');
305
- }, children: _jsx(Meter, { read: liveRead, onPlans: () => leave('here'), onBilling: () => (setOpen(false), showSettings('billing')) }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => showSettings('account'), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), children: t('Profile') }) }), _jsx(DropdownMenuItem, { onSelect: () => showSettings('general'), children: _jsx(Line, { icon: _jsx(Palette, { size: 16, "aria-hidden": true }), children: t('Personalization') }) }), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+, Meta+,", onSelect: () => showSettings('general'), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘,' : 'Ctrl+,' }) }), children: t('Settings') }) }), _jsx(DropdownMenuItem, { onSelect: () => window.location.assign(site('/beta')), children: _jsx(Line, { icon: _jsx(FlaskConical, { size: 16, "aria-hidden": true }), children: t('Beta') }) })] })) : null] }), others.map((a) => {
306
- const { title, line } = accountLabel(a);
307
- return (_jsx(DropdownMenuItem, { "data-slot": "me-switch", onSelect: () => void signedIn.switchTo(a), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), sub: line || undefined, children: title }) }, a.sub));
308
- }), _jsx(DropdownMenuItem, { "data-slot": "me-add", onSelect: () => void signedIn.add(), children: _jsx(Line, { icon: _jsx(UserPlus, { size: 16, "aria-hidden": true }), children: t('Add account') }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: orgs, onOpenChange: setOrgs, children: [_jsx(DropdownMenuSubTrigger, { "data-slot": "me-orgs", children: _jsx(Line, { icon: _jsx(Mark, { org: here ?? all[0] }), trail: _jsx(Check, { size: 16, "aria-label": t('Current') }), children: t('{org} · {plan}', { org: (here ? (here.personal ? t('Personal') : here.display) : current), plan: planName || t('No plan') }) }) }), orgs ? (_jsxs(DropdownMenuSubContent, { minW: 260, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: [_jsx(DropdownMenuLabel, { children: t('Organizations') }), all.map((o) => (_jsx(DropdownMenuItem, { onSelect: () => o.name !== current && onOrg(o.name), children: _jsx(Line, { icon: _jsx(Mark, { org: o }), sub: [o.personal ? t('Personal') : said(o.role, t), planFor(o) || (isFree && o.personal ? t('Free') : '')].filter(Boolean).join(' - '), trail: o.name === current ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: o.display }) }, o.name))), _jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Plus, { size: 16, "aria-hidden": true }), children: t('Create organization') }) }), _jsx(DropdownMenuItem, { onSelect: () => out(site(settings('organization'))), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), children: t('Organization settings') }) }), where().team ? null : here && !here.personal ? (_jsx(DropdownMenuItem, { onSelect: () => out(`${ENTRY}&org=${encodeURIComponent(here.name)}`), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), trail: _jsx(ArrowUpRight, { size: 14, "aria-hidden": true, opacity: 0.6 }), children: t('Open in Hanzo Team') }) })) : (_jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), children: t('Create a team') }) })), superAdmin() ? (_jsx(DropdownMenuItem, { onSelect: choose, children: _jsx(Line, { icon: _jsx(Building2, { size: 16, "aria-hidden": true }), children: t('All organizations') }) })) : null] })) : null] }), _jsx(DropdownMenuItem, { onSelect: () => showSettings('usage'), children: _jsx(Line, { icon: _jsx(Activity, { size: 16, "aria-hidden": true }), children: t('Usage') }) }), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+, Meta+,", onSelect: () => showSettings('account'), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘,' : 'Ctrl+,' }) }), children: t('Settings') }) }), _jsx(DropdownMenuItem, { onSelect: () => leave('here'), children: _jsx(Line, { icon: _jsx(Sparkles, { size: 16, "aria-hidden": true }), children: t(plans) }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: lang, onOpenChange: (next) => {
309
- setLang(next);
310
- if (!next)
311
- setLangQuery('');
312
- }, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(Languages, { size: 16, "aria-hidden": true }), children: t('Language') }) }), lang ? (_jsxs(DropdownMenuSubContent, { minW: 220, maxW: 260, pointerEvents: "auto", children: [_jsx(XStack, { px: "$2", pt: "$1.5", pb: "$1", children: _jsx(SizableText, { render: _jsx("input", { type: "search", value: langQuery, onChange: (e) => setLangQuery(e.target.value), onKeyDown: (e) => e.stopPropagation(), placeholder: t('Search language...'), "aria-label": t('Search language') }), width: "100%", height: 30, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", bg: "$background", color: "$ink", size: "$2" }) }), _jsx(YStack, { maxH: 260, overflowY: "auto", children: locales
313
- .filter((l) => !l.review || l.code === locale)
314
- .filter((l) => {
315
- const q = langQuery.trim().toLowerCase();
316
- if (!q)
317
- return true;
318
- return (l.name.toLowerCase().includes(q) ||
319
- l.englishName.toLowerCase().includes(q) ||
320
- l.code.toLowerCase().includes(q));
321
- })
322
- .map((l) => (_jsx(DropdownMenuItem, { onSelect: () => void setLocale(l.code), children: _jsx(Line, { trail: l.code === locale ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: l.englishName !== l.name ? `${l.name} (${l.englishName})` : l.name }) }, l.code))) })] })) : null] }), _jsxs(DropdownMenuSub, { open: help, onOpenChange: setHelp, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(LifeBuoy, { size: 16, "aria-hidden": true }), children: t('Help') }) }), help ? (_jsxs(DropdownMenuSubContent, { minW: 240, maxW: "calc(100vw - 16px)", pointerEvents: "auto", children: [pages().map((p) => (_jsx(DropdownMenuItem, { onSelect: () => out(p.href), children: _jsx(Line, { icon: ICONS[p.key], trail: p.key === 'help' ? _jsx(ArrowUpRight, { size: 14, "aria-hidden": true, opacity: 0.6 }) : null, children: t(p.label) }) }, p.key))), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+/ Meta+/", onSelect: () => setKeys(true), children: _jsx(Line, { icon: _jsx(Keyboard, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘/' : 'Ctrl+/' }) }), children: t('Keyboard shortcuts') }) }), _jsx(DropdownMenuSeparator, {}), legal().map((p) => (_jsx(DropdownMenuItem, { onSelect: () => out(p.href), children: _jsx(Line, { icon: ICONS[p.key], children: t(p.label) }) }, p.key)))] })) : null] }), several && signedIn.current ? (_jsx(DropdownMenuItem, { "data-slot": "me-leave", onSelect: () => void signedIn.leave(signedIn.current), children: _jsx(Line, { icon: _jsx(LogOut, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }), children: t('Sign out {name}', { name: accountLabel(signedIn.current).title }) }) })) : null, host.signOut ? (_jsx(DropdownMenuItem, { onSelect: () => host.signOut?.(), children: _jsx(Line, { icon: _jsx(LogOut, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }), children: several ? t('Sign out of all accounts') : t('Log out') }) })) : null] })] }), _jsx(Create, { open: creating, onOpenChange: setCreating }), _jsx(Shortcuts, { open: keys, onOpenChange: setKeys, apple: apple })] }));
263
+ }, render: _jsx("button", { type: "button" }), "data-slot": "me", "aria-label": t('Account: {name}', { name: [who, currentOrg].filter(Boolean).join(' · ') }), width: narrow ? (above ? 44 : MARK) : '100%', height: narrow ? (above ? 44 : MARK) : undefined, minH: narrow ? (above ? 44 : MARK) : 42, $touchable: narrow ? { width: 44, height: 44, minH: 44 } : { minH: 44 }, px: narrow ? 0 : '$2', py: narrow ? 0 : '$1', gap: "$2", rounded: narrow ? 12 : '$3', borderWidth: narrow && above ? 1 : 0, borderColor: narrow && above ? STRONG : undefined, bg: narrow && above ? '$panel' : narrow && hoverOpen ? '$hover' : 'transparent', items: "center", justify: narrow ? 'center' : 'flex-start', hoverStyle: { bg: '$hover' }, pressStyle: { bg: '$raised' }, focusVisibleStyle: FOCUS_RING, cursor: "pointer", onClick: () => goSettings('account'), children: [_jsx(Face, { host: host, size: narrow ? (above ? 32 : 26) : 28 }), narrow ? null : (_jsxs(_Fragment, { children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, text: "start", children: who }) }), tierPill] }))] }) }), _jsx(HoverCardContent, { "data-slot": "me-hover-card", side: narrow && !above ? (rtl ? 'left' : 'right') : 'top', align: narrow && !above ? 'end' : 'start', sideOffset: 8, bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, rounded: "$5", p: "$4", width: 284, maxW: "calc(100vw - 24px)", z: "var(--z-popover)", boxShadow: "var(--shadow-floating)", children: _jsxs(YStack, { gap: "$3", width: "100%", children: [_jsxs(XStack, { items: "flex-start", justify: "space-between", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2.5", flex: 1, minW: 0, children: [_jsx(Face, { host: host, size: 34 }), _jsxs(YStack, { flex: 1, minW: 0, gap: 2, children: [_jsxs(XStack, { items: "center", gap: "$1.5", minW: 0, children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: who }), tierPill] }), host.person.email ? (_jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$aside", numberOfLines: 1, children: host.person.email })) : null] })] }), _jsxs(DropdownMenu, { open: menuOpen, onOpenChange: (next) => {
264
+ setMenuOpen(next);
265
+ if (next)
266
+ return;
267
+ setAccount(false);
268
+ setOrgsOpen(false);
269
+ setLang(false);
270
+ setHelp(false);
271
+ }, placement: rtl ? 'bottom-start' : 'bottom-end', offset: 6, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-more", "aria-label": t('More account options'), width: 28, height: 28, "$max-sm": { width: 44, height: 44 }, rounded: "$2", items: "center", justify: "center", cursor: "pointer", borderWidth: 1, borderColor: menuOpen ? STRONG : 'transparent', bg: menuOpen ? '$hover' : 'transparent', hoverStyle: { bg: '$hover', borderColor: STRONG }, focusVisibleStyle: FOCUS_RING, children: _jsx(MoreHorizontal, { size: 15, color: SOFT, "aria-hidden": true }) }) }), _jsxs(DropdownMenuContent, { minW: 250, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, "aria-labelledby": undefined, "aria-label": t('Account'), onCloseAutoFocus: back, children: [_jsxs(DropdownMenuSub, { open: account, onOpenChange: setAccount, children: [_jsxs(DropdownMenuSubTrigger, { minH: 44, gap: "$2.5", "data-slot": "me-account", children: [_jsx(Face, { host: host, size: 26 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: who }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: host.person.email || working })] })] }), account ? (_jsxs(DropdownMenuSubContent, { minW: 230, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, pointerEvents: "auto", children: [_jsx(DropdownMenuItem, { onSelect: () => goSettings('account'), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), children: t('Profile') }) }), _jsx(DropdownMenuItem, { onSelect: () => goSettings('personalization'), children: _jsx(Line, { icon: _jsx(Palette, { size: 16, "aria-hidden": true }), children: t('Personalization') }) }), _jsx(DropdownMenuItem, { onSelect: () => goSettings('account'), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), children: t('Settings') }) }), _jsx(DropdownMenuItem, { onSelect: () => window.location.assign(site('/beta')), children: _jsx(Line, { icon: _jsx(FlaskConical, { size: 16, "aria-hidden": true }), children: t('Beta') }) })] })) : null] }), others.map((a) => {
272
+ const { title, line } = accountLabel(a);
273
+ return (_jsx(DropdownMenuItem, { "data-slot": "me-switch", onSelect: () => void signedIn.switchTo(a), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), sub: line || undefined, children: title }) }, a.sub));
274
+ }), _jsx(DropdownMenuItem, { "data-slot": "me-add", onSelect: () => void signedIn.add(), children: _jsx(Line, { icon: _jsx(UserPlus, { size: 16, "aria-hidden": true }), children: t('Add account') }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: orgsOpen, onOpenChange: setOrgsOpen, children: [_jsx(DropdownMenuSubTrigger, { "data-slot": "me-orgs", children: _jsx(Line, { icon: _jsx(Mark, { org: here ?? all[0] }), trail: _jsx(Check, { size: 16, "aria-label": t('Current') }), children: t('{org} · {plan}', { org: (here ? (here.personal ? t('Personal') : here.display) : currentOrg), plan: planName || t('No plan') }) }) }), orgsOpen ? (_jsxs(DropdownMenuSubContent, { minW: 250, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, pointerEvents: "auto", children: [_jsx(DropdownMenuLabel, { children: t('Organizations') }), all.map((o) => (_jsx(DropdownMenuItem, { onSelect: () => o.name !== currentOrg && onOrg(o.name), children: _jsx(Line, { icon: _jsx(Mark, { org: o }), sub: [o.personal ? t('Personal') : said(o.role, t), planFor(o) || (isFree && o.personal ? t('Free') : '')].filter(Boolean).join(' - '), trail: o.name === currentOrg ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: o.display }) }, o.name))), _jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Plus, { size: 16, "aria-hidden": true }), children: t('Create organization') }) }), _jsx(DropdownMenuItem, { onSelect: () => out(site(settings('organization'))), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), children: t('Organization settings') }) }), where().team ? null : here && !here.personal ? (_jsx(DropdownMenuItem, { onSelect: () => out(`${ENTRY}&org=${encodeURIComponent(here.name)}`), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), trail: _jsx(ArrowUpRight, { size: 14, color: "var(--text-tertiary)", "aria-hidden": true }), children: t('Open in Hanzo Team') }) })) : (_jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), children: t('Create a team') }) })), superAdmin() ? (_jsx(DropdownMenuItem, { onSelect: choose, children: _jsx(Line, { icon: _jsx(Building2, { size: 16, "aria-hidden": true }), children: t('All organizations') }) })) : null] })) : null] }), _jsx(DropdownMenuItem, { onSelect: () => goSettings('usage'), children: _jsx(Line, { icon: _jsx(Activity, { size: 16, "aria-hidden": true }), children: t('Usage') }) }), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+, Meta+,", onSelect: () => goSettings('account'), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘,' : 'Ctrl+,' }) }), children: t('Settings') }) }), _jsx(DropdownMenuItem, { onSelect: triggerUpgrade, children: _jsx(Line, { icon: _jsx(Sparkles, { size: 16, "aria-hidden": true }), children: t(plans) }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: lang, onOpenChange: (next) => {
275
+ setLang(next);
276
+ if (!next)
277
+ setLangQuery('');
278
+ }, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(Languages, { size: 16, "aria-hidden": true }), children: t('Language') }) }), lang ? (_jsxs(DropdownMenuSubContent, { minW: 220, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, pointerEvents: "auto", children: [_jsx(XStack, { px: "$2", pt: "$1.5", pb: "$1", children: _jsx(SizableText, { render: _jsx("input", { type: "search", value: langQuery, onChange: (e) => setLangQuery(e.target.value), onKeyDown: (e) => e.stopPropagation(), placeholder: t('Search language...'), "aria-label": t('Search language') }), width: "100%", height: 32, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: STRONG, bg: "$panel", color: "$ink", focusVisibleStyle: FOCUS_RING, size: "$2" }) }), _jsx(YStack, { maxH: 260, overflowY: "auto", children: locales
279
+ .filter((l) => !l.review || l.code === locale)
280
+ .filter((l) => {
281
+ const q = langQuery.trim().toLowerCase();
282
+ if (!q)
283
+ return true;
284
+ return (l.name.toLowerCase().includes(q) ||
285
+ l.englishName.toLowerCase().includes(q) ||
286
+ l.code.toLowerCase().includes(q));
287
+ })
288
+ .map((l) => (_jsx(DropdownMenuItem, { onSelect: () => void setLocale(l.code), children: _jsx(Line, { trail: l.code === locale ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: l.englishName !== l.name ? `${l.name} (${l.englishName})` : l.name }) }, l.code))) })] })) : null] }), _jsxs(DropdownMenuSub, { open: help, onOpenChange: setHelp, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(LifeBuoy, { size: 16, "aria-hidden": true }), children: t('Help') }) }), help ? (_jsxs(DropdownMenuSubContent, { minW: 240, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, pointerEvents: "auto", children: [pages().map((p) => (_jsx(DropdownMenuItem, { onSelect: () => out(p.href), children: _jsx(Line, { icon: ICONS[p.key], trail: p.key === 'help' ? _jsx(ArrowUpRight, { size: 14, color: "var(--text-tertiary)", "aria-hidden": true }) : null, children: t(p.label) }) }, p.key))), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+/ Meta+/", onSelect: () => setKeys(true), children: _jsx(Line, { icon: _jsx(Keyboard, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘/' : 'Ctrl+/' }) }), children: t('Keyboard shortcuts') }) }), _jsx(DropdownMenuSeparator, {}), legal().map((p) => (_jsx(DropdownMenuItem, { onSelect: () => out(p.href), children: _jsx(Line, { icon: ICONS[p.key], children: t(p.label) }) }, p.key)))] })) : null] }), several && signedIn.current ? (_jsx(DropdownMenuItem, { "data-slot": "me-leave", onSelect: () => void signedIn.leave(signedIn.current), children: _jsx(Line, { icon: _jsx(LogOut, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }), children: t('Sign out {name}', { name: accountLabel(signedIn.current).title }) }) })) : null, host.signOut ? (_jsx(DropdownMenuItem, { onSelect: () => host.signOut?.(), children: _jsx(Line, { icon: _jsx(LogOut, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }), children: several ? t('Sign out of all accounts') : t('Log out') }) })) : null] })] })] }), _jsx(YStack, { "data-slot": "me-stats", role: "button", tabIndex: 0, "aria-label": t('Usage'), rounded: "$3", bg: "$panel", borderWidth: 1, borderColor: STRONG, cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, onPress: () => goSettings('usage'), onKeyDown: (e) => {
289
+ if (e.key === 'Enter' || e.key === ' ') {
290
+ e.preventDefault?.();
291
+ goSettings('usage');
292
+ }
293
+ }, children: _jsx(Meter, { read: liveRead, onPlans: triggerUpgrade, onBilling: () => goSettings('billing') }) }), _jsxs(XStack, { "data-slot": "me-dev-row", items: "center", justify: "space-between", gap: "$2", minH: 40, "$max-sm": { minH: 44 }, px: "$2.5", py: "$2", rounded: "$3", bg: "$panel", borderWidth: 1, borderColor: "$edge", children: [_jsxs(XStack, { items: "center", gap: "$1.5", minW: 0, flex: 1, children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, children: t('Developer mode') }), _jsx(InfoHint, { text: t('Show GitHub repositories, branches, terminals, and technical settings.') })] }), _jsx(Switch, { size: "sm", checked: devMode, onCheckedChange: setDevMode, "aria-label": t('Developer mode'), "data-slot": "me-dev-mode" })] }), _jsx(XStack, { height: 1, bg: "$edge", width: "100%" }), _jsxs(YStack, { gap: "$0.5", children: [isFree ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-hover-upgrade", onClick: triggerUpgrade, items: "center", gap: "$2", minH: 36, "$max-sm": { minH: 44 }, px: "$2.5", py: "$1.5", rounded: "$3", cursor: "pointer", bg: "$raised", borderWidth: 1, borderColor: STRONG, hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Sparkles, { size: 14, color: INK, "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, text: "start", children: t('Upgrade plan') })] })) : null, _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-hover-settings", onClick: () => goSettings('account'), items: "center", gap: "$2", minH: 34, "$max-sm": { minH: 44 }, px: "$2", py: "$1.5", rounded: "$3", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Settings, { size: 14, color: INK, "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$2", color: "$ink", flex: 1, text: "start", children: t('Open settings') }), _jsx(Text, { fontFamily: "$mono", fontSize: "$1", color: "$aside", children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘,' : 'Ctrl+,' }) })] }), all.length > 1 ? (_jsxs(YStack, { gap: "$0.5", children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-hover-workspaces", "aria-expanded": workspacesOpen, onClick: () => setWorkspacesOpen((v) => !v), items: "center", gap: "$2", minH: 34, "$max-sm": { minH: 44 }, px: "$2", py: "$1.5", rounded: "$3", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Building2, { size: 14, color: INK, "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$2", color: "$ink", flex: 1, text: "start", numberOfLines: 1, children: t('Switch workspace') }), workspacesOpen ? (_jsx(ChevronDown, { size: 13, color: SOFT, "aria-hidden": true })) : (_jsx(ChevronRight, { size: 13, color: SOFT, "aria-hidden": true }))] }), workspacesOpen ? (_jsx(YStack, { pl: "$4", gap: "$0.5", children: all.map((o) => (_jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: () => {
294
+ if (o.name !== currentOrg) {
295
+ setHoverOpen(false);
296
+ onOrg(o.name);
297
+ }
298
+ }, items: "center", gap: "$2", minH: 32, "$max-sm": { minH: 44 }, px: "$2", py: "$1", rounded: "$2", cursor: "pointer", bg: o.name === currentOrg ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Mark, { org: o }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$ink", flex: 1, text: "start", numberOfLines: 1, children: o.personal ? t('Personal') : o.display }), o.name === currentOrg ? _jsx(Check, { size: 12, color: INK, "aria-hidden": true }) : null] }, o.name))) })) : null] })) : null, host.signOut ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-hover-logout", onClick: () => {
299
+ setHoverOpen(false);
300
+ host.signOut?.();
301
+ }, items: "center", gap: "$2", minH: 34, "$max-sm": { minH: 44 }, px: "$2", py: "$1.5", rounded: "$3", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(LogOut, { size: 14, color: SOFT, "aria-hidden": true, "data-i18n-mirror": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$2", color: "$aside", flex: 1, text: "start", children: t('Log out') })] })) : null] })] }) })] }), _jsx(Create, { open: creating, onOpenChange: setCreating }), _jsx(Shortcuts, { open: keys, onOpenChange: setKeys, apple: apple })] }));
302
+ }
303
+ /** Split a printed shortcut into discrete keycap tokens: `⌘⇧O` → `['⌘','⇧','O']`, `Ctrl+Shift+O` → `['Ctrl','Shift','O']`. */
304
+ function splitShortcut(combo) {
305
+ if (combo.includes('+'))
306
+ return combo.split('+').filter(Boolean);
307
+ const mods = [];
308
+ let rest = combo;
309
+ while (rest.length > 1 && /^[⌘⌃⌥⇧]/.test(rest)) {
310
+ mods.push(rest[0]);
311
+ rest = rest.slice(1);
312
+ }
313
+ return rest ? [...mods, rest] : mods;
323
314
  }
324
- /** The app's keys (help.ts `KEYS`), one row each, spelled for this platform. */
325
- function Shortcuts({ open, onOpenChange, apple }) {
315
+ const SHORTCUT_GROUPS = ['Navigation', 'Workspace', 'Chat', 'Window'];
316
+ /** The app's keys (help.ts `KEYS`), categorized with crisp `--border-strong` keycaps for this platform. */
317
+ export function Shortcuts({ open, onOpenChange, apple }) {
326
318
  const { t } = useI18n();
327
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: 440, rounded: "$6", gap: "$3", children: [_jsx(DialogTitle, { children: t('Keyboard shortcuts') }), _jsx(YStack, { gap: "$1", children: KEYS.map((k) => (_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", minH: 32, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: t(k.does) }), _jsx(Kbd, { children: _jsx("bdi", { dir: "ltr", children: apple ? k.mac : k.pc }) })] }, k.does))) })] }) }));
319
+ const sections = useMemo(() => {
320
+ const byGroup = new Map();
321
+ for (const k of KEYS) {
322
+ const g = k.group ?? 'Navigation';
323
+ const list = byGroup.get(g);
324
+ if (list)
325
+ list.push(k);
326
+ else
327
+ byGroup.set(g, [k]);
328
+ }
329
+ return SHORTCUT_GROUPS.map((g) => ({ group: g, items: byGroup.get(g) ?? [] })).filter((s) => s.items.length > 0);
330
+ }, []);
331
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "shortcuts-dialog", width: 480, maxW: "calc(100vw - 24px)", maxH: "82dvh", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, rounded: "$6", gap: "$3", overflow: "hidden", children: [_jsxs(YStack, { gap: "$1", shrink: 0, children: [_jsx(DialogTitle, { children: t('Keyboard shortcuts') }), _jsx(SizableText, { size: "$2", color: "$quiet", children: t('Global commands and conversation controls.') })] }), _jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", gap: "$4", pr: "$1", children: sections.map((section) => (_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$1", fontWeight: "600", color: "$quiet", pb: "$1", children: t(section.group) }), _jsx(YStack, { rounded: "$4", borderWidth: 1, borderColor: "$edge", bg: "$panel", overflow: "hidden", children: section.items.map((k, idx) => {
332
+ const caps = splitShortcut(apple ? k.mac : k.pc);
333
+ return (_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", px: "$3", minH: 38, "$max-sm": { minH: 44 }, borderTopWidth: idx === 0 ? 0 : 1, borderColor: "$edge", children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, minW: 0, numberOfLines: 1, children: t(k.does) }), _jsx(XStack, { items: "center", gap: "$1", shrink: 0, "data-i18n-ltr": "", children: _jsx("bdi", { dir: "ltr", children: _jsx(XStack, { items: "center", gap: "$1", children: caps.map((cap, ci) => (_jsx(Kbd, { variant: "cap", children: cap }, `${k.does}-${ci}`))) }) }) })] }, k.does));
334
+ }) })] }, section.group))) })] }) }));
328
335
  }
329
336
  /**
330
337
  * The sheet that creates an organization: a name, then `POST /v1/account/orgs`,
331
- * the creator's own. The token in hand predates it, so it is renewed and the app
332
- * reloads in the new organization; `Made` says so if the new token does not carry
333
- * it yet.
338
+ * the creator's own.
334
339
  */
335
340
  function Create({ open, onOpenChange }) {
336
341
  const { t } = useI18n();
@@ -360,9 +365,6 @@ function Create({ open, onOpenChange }) {
360
365
  /* the next load simply says nothing */
361
366
  }
362
367
  renew();
363
- // The app again, where the person is, in the new organization. Not `/`: on
364
- // hanzo.ai that is the landing for everyone (owner, 2026-10-29), so a
365
- // person who made an organization from /chat was left on the marketing page.
366
368
  reopen(org);
367
369
  }
368
370
  catch (e) {
@@ -370,10 +372,10 @@ function Create({ open, onOpenChange }) {
370
372
  setBusy(false);
371
373
  }
372
374
  };
373
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { maxW: 440, rounded: "$6", gap: "$3", children: [_jsx(DialogTitle, { children: t('Create organization') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('You own it. Agents, credits and members belong to it, and you switch to it from this menu.') }), _jsx(Input, { autoFocus: true, value: name, onChangeText: setName, "aria-label": t('Organization name'), placeholder: t('Acme'), maxLength: 80, onKeyDown: (e) => {
375
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { width: 440, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, rounded: "$6", gap: "$3", children: [_jsx(DialogTitle, { children: t('Create organization') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('You own it. Agents, credits and members belong to it, and you switch to it from this menu.') }), _jsx(Input, { autoFocus: true, value: name, onChangeText: setName, "aria-label": t('Organization name'), placeholder: t('Acme'), maxLength: 80, onKeyDown: (e) => {
374
376
  if (e.key === 'Enter')
375
377
  void submit();
376
- } }), refused ? (_jsx(SizableText, { size: "$1", color: BAD, role: "alert", children: refused })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => onOpenChange(false), children: t('Cancel') }), _jsx(Button, { size: "sm", rounded: 999, disabled: busy || !name.trim(), onPress: () => void submit(), children: t(busy ? 'Creating…' : 'Create') })] })] }) }));
378
+ } }), refused ? (_jsx(SizableText, { size: "$1", color: BAD, role: "alert", children: refused })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", borderColor: STRONG, rounded: 999, onPress: () => onOpenChange(false), children: t('Cancel') }), _jsx(Button, { size: "sm", variant: "primary", tone: "accent", rounded: 999, disabled: busy || !name.trim(), onPress: () => void submit(), children: t(busy ? 'Creating…' : 'Create') })] })] }) }));
377
379
  }
378
380
  /**
379
381
  * What became of an organization this tab created: nothing to say once the token
@@ -389,7 +391,6 @@ export function Made() {
389
391
  return;
390
392
  if (orgs().includes(kept.org))
391
393
  return sessionStorage.removeItem(MADE);
392
- // Still out of the token: go on working where the person was.
393
394
  if (kept.from && current() !== kept.from && orgs().includes(kept.from)) {
394
395
  return reopen(kept.from);
395
396
  }
@@ -410,5 +411,5 @@ export function Made() {
410
411
  }
411
412
  setMade(null);
412
413
  };
413
- return (_jsxs(XStack, { "data-slot": "made", role: "status", items: "flex-start", gap: "$2", px: "$3", py: "$2.5", rounded: "$5", borderWidth: 1, borderColor: "$borderColor", bg: "$edge", children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$ink", children: t('{name} was created, and your sign-in does not include it yet, so you are still in this organization. It appears here once IAM adds you to it.', { name: made.name }) }), _jsx(XStack, { render: "button", "aria-label": t('Dismiss'), onPress: dismiss, p: "$1", rounded: 999, hoverStyle: { bg: '$hover' }, children: _jsx(X, { size: 13, "aria-hidden": true }) })] }));
414
+ return (_jsxs(XStack, { "data-slot": "made", role: "status", items: "flex-start", gap: "$2", px: "$3", py: "$2.5", rounded: "$5", borderWidth: 1, borderColor: STRONG, bg: "$panel", children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$ink", children: t('{name} was created, and your sign-in does not include it yet, so you are still in this organization. It appears here once IAM adds you to it.', { name: made.name }) }), _jsx(XStack, { render: _jsx("button", { type: "button" }), "aria-label": t('Dismiss'), onClick: dismiss, p: "$1", rounded: 999, cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: _jsx(X, { size: 13, color: SOFT, "aria-hidden": true }) })] }));
414
415
  }