moi-computer 0.12.1-next.4 → 0.13.1-next.0
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/client/api/query-client.ts +5 -0
- package/client/app/app-router.tsx +1 -1
- package/client/app/routes/workspace-route.tsx +2 -0
- package/client/features/account/account-provider.tsx +28 -77
- package/client/features/account/account-test-utils.tsx +95 -93
- package/client/features/account/api.ts +32 -109
- package/client/features/account/profile-actions.ts +31 -0
- package/client/features/app-settings/settings-page.tsx +0 -4
- package/client/features/chat/messages/tool-group/subagent-card.tsx +1 -0
- package/client/features/collab/client.ts +38 -13
- package/client/features/collab/components/user-avatar.tsx +4 -10
- package/client/features/collab/hooks.tsx +9 -8
- package/client/features/collab/host-state.ts +45 -85
- package/client/features/collab/testing/fake-engine.ts +13 -1
- package/client/features/collab/users.ts +0 -12
- package/client/features/connectors/api.ts +12 -4
- package/client/features/connectors/mcp-server-cards.tsx +17 -7
- package/client/features/connectors/read-connectors.ts +35 -0
- package/client/features/dev/cloud-avatar-upload.tsx +58 -0
- package/client/features/dev/cloud-page.tsx +363 -0
- package/client/features/dev/collab/local-user-settings.tsx +1 -1
- package/client/features/dev/dev-index-page.tsx +6 -0
- package/client/features/dev/dev-routes.tsx +2 -0
- package/client/features/identity/host-api.ts +34 -0
- package/client/features/identity/store.ts +32 -0
- package/client/features/identity/types.ts +41 -0
- package/client/features/identity/use-identity.ts +6 -0
- package/client/features/workspace/harness-transition.ts +1 -0
- package/client/features/workspace/settings/connectors-settings.tsx +31 -10
- package/client/features/workspace/settings/general-settings.tsx +17 -14
- package/client/features/workspace-members/api.ts +20 -0
- package/client/features/workspace-members/hooks.ts +127 -0
- package/client/features/workspace-members/keys.ts +6 -0
- package/client/features/workspace-members/store.ts +123 -0
- package/client/features/workspace-members/types.ts +53 -0
- package/client/index.html +1 -1
- package/client/index.tsx +5 -9
- package/client/main.tsx +2 -2
- package/dist/{chunk-71fn6rmj.js → chunk-00s35r33.js} +68 -68
- package/dist/{chunk-g0tcwqxc.js → chunk-7rz6g7g7.js} +1 -1
- package/dist/chunk-af2jyddf.js +2 -0
- package/dist/chunk-cekekc3f.css +1 -0
- package/dist/chunk-ep5vh16c.js +75 -0
- package/dist/{chunk-2y59vrxg.js → chunk-kdgk4dac.js} +1 -1
- package/dist/chunk-s5s1vzdw.js +2 -0
- package/dist/{chunk-58dyt9bk.js → chunk-svxhxfeq.js} +2 -2
- package/dist/chunk-t0r0bds1.js +1 -0
- package/dist/chunk-vp2qzc0d.js +1 -0
- package/dist/chunk-wz5qv1bn.js +2 -0
- package/dist/index.html +2 -2
- package/lib/types.ts +4 -2
- package/package.json +7 -4
- package/server/api/index.ts +26 -1
- package/server/app-config.ts +3 -1
- package/server/harness/claude-code/index.ts +3 -6
- package/server/harness/claude-code/mcp.ts +17 -0
- package/server/harness/codex/NOTES.md +9 -2
- package/server/harness/codex/client.ts +8 -5
- package/server/harness/codex/connectors.ts +92 -0
- package/server/harness/codex/index.ts +2 -1
- package/server/harness/codex/pagination.ts +8 -5
- package/server/harness/codex/transport.ts +13 -6
- package/server/harness/types.ts +4 -1
- package/server/onboarding/prompt.md +2 -2
- package/skill/references/DESIGN.md +22 -3
- package/client/features/account/identity.ts +0 -23
- package/client/features/app-settings/users-settings.tsx +0 -195
- package/dist/chunk-0mjzg20x.js +0 -2
- package/dist/chunk-5aj040e5.css +0 -1
- package/dist/chunk-7yg1m8hx.js +0 -2
- package/dist/chunk-825hys3h.js +0 -1
- package/dist/chunk-9bb8m9rx.js +0 -2
- package/dist/chunk-n0nab26d.js +0 -1
- package/dist/chunk-v88n1bay.js +0 -74
|
@@ -80,9 +80,17 @@ Use the shared radius scale and existing control shapes. Reserve `rounded-full`
|
|
|
80
80
|
|
|
81
81
|
### Texture
|
|
82
82
|
|
|
83
|
-
Texture is
|
|
83
|
+
Texture gives an open surface depth and character without adding containers or decoration. It helps most where content is sparse and the background shows. A view filled with content is fine without one. Apply it to the root next to an opaque semantic color, such as `bg-background texture-noise`.
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
| Texture | Look | Use for |
|
|
86
|
+
| ------------------------- | ---------------------------------------- | ---------------------------------------------- |
|
|
87
|
+
| `texture-gradient-linear` | Soft tint that deepens toward the bottom | The default; safe behind any content |
|
|
88
|
+
| `texture-inset-shadow` | Soft glow around the edges | A focal value or a centered composition |
|
|
89
|
+
| `texture-noise` | Fine grain | A tactile surface behind sparse, large content |
|
|
90
|
+
| `texture-grid` | Thin 24 px line grid | Plans, schedules, drawing, and measurement |
|
|
91
|
+
| `texture-checker` | 32 px checker, the strongest pattern | Playful content, games, and placeholder areas |
|
|
92
|
+
|
|
93
|
+
Pick the texture that suits the content, and keep related widgets and views on the same one. Behind dense content such as tables or long text, use only the gradient or inset shadow. Use one texture per applet.
|
|
86
94
|
|
|
87
95
|
### Interaction and states
|
|
88
96
|
|
|
@@ -103,10 +111,21 @@ Use brief, interruptible motion to explain changes or acknowledge input. Respect
|
|
|
103
111
|
|
|
104
112
|
## Widgets
|
|
105
113
|
|
|
106
|
-
|
|
114
|
+
Each widget does one of two jobs:
|
|
115
|
+
|
|
116
|
+
- **Glance:** summarizes current information and emphasizes the key value.
|
|
117
|
+
- **Action:** completes one small task in place. Prefer an action widget when the task fits the footprint.
|
|
118
|
+
|
|
119
|
+
A widget must add value beyond navigation. The Overview already lists every view, so a widget that only opens a view is redundant. Show real content or let people act in place; a link to a view is secondary.
|
|
120
|
+
|
|
121
|
+
Never show content that invites an interaction the widget cannot complete.
|
|
122
|
+
|
|
123
|
+
Choose the smallest footprint the content fills. If a large part of the widget is empty, reduce its span. Keep supporting controls limited to the immediate task. Don't put tabs, deeper navigation, or multi-step work in a widget. Keep hover feedback on controls, but leave the widget surface unchanged.
|
|
107
124
|
|
|
108
125
|
The host owns the widget’s outer shape, clipping, and elevation. Do not add another outer card.
|
|
109
126
|
|
|
127
|
+
Give every widget root a [texture](#texture) so it does not look flat, unless media or a visualization fills it edge to edge.
|
|
128
|
+
|
|
110
129
|
The grid has four columns, 160 px rows, 8 px gaps, and a maximum width of 640 px. Widgets span one to four rows and columns. Width is flexible; height is fixed:
|
|
111
130
|
|
|
112
131
|
`rowSpan × 160 + (rowSpan − 1) × 8`
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { getCurrentUser, getDirectory, publishUsers } from '@/client/features/collab/host-state'
|
|
2
|
-
import type { CloudSession, CloudTeam } from './api'
|
|
3
|
-
|
|
4
|
-
// The session identifies the viewer. Keep the injected directory until the team
|
|
5
|
-
// request resolves, and preserve known avatar and color information by user id.
|
|
6
|
-
export function syncCloudIdentity(session: CloudSession, team?: CloudTeam): void {
|
|
7
|
-
if (!session || session.user.isAnonymous) {
|
|
8
|
-
publishUsers({ users: [] })
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
const { id, name, email } = session.user
|
|
12
|
-
const sameAccount = getCurrentUser()?.id === id
|
|
13
|
-
const known = new Map((getDirectory() ?? []).map(user => [user.id, user]))
|
|
14
|
-
const users =
|
|
15
|
-
team?.members.map(user => ({
|
|
16
|
-
...known.get(user.userId),
|
|
17
|
-
id: user.userId,
|
|
18
|
-
name: user.name,
|
|
19
|
-
email: user.email
|
|
20
|
-
})) ?? (sameAccount ? [...known.values()] : [])
|
|
21
|
-
const profile = { ...known.get(id), id, name, email }
|
|
22
|
-
publishUsers({ me: id, users: [...users.filter(user => user.id !== id), profile] })
|
|
23
|
-
}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { useState, useSyncExternalStore } from 'react'
|
|
2
|
-
import { IconX } from '@tabler/icons-react'
|
|
3
|
-
import { useIsMutating, useMutation, useQueryClient } from '@tanstack/react-query'
|
|
4
|
-
import { Field, FieldLabel } from '@/ui-components/field'
|
|
5
|
-
import { Button } from '@/client/components/ui/button'
|
|
6
|
-
import { Input } from '@/client/components/ui/input'
|
|
7
|
-
import { Skeleton } from '@/client/components/ui/skeleton'
|
|
8
|
-
import { toast } from '@/client/components/ui/toast'
|
|
9
|
-
import { User } from '@/client/features/collab/components/user'
|
|
10
|
-
import {
|
|
11
|
-
getDirectory,
|
|
12
|
-
normalizeUserProfile,
|
|
13
|
-
subscribeDirectoryStore
|
|
14
|
-
} from '@/client/features/collab/host-state'
|
|
15
|
-
import { useAccount } from '../account/account-provider'
|
|
16
|
-
import { SettingsSection } from './settings-section'
|
|
17
|
-
import {
|
|
18
|
-
accountKeys,
|
|
19
|
-
CloudApiError,
|
|
20
|
-
cancelInvitation,
|
|
21
|
-
inviteMember,
|
|
22
|
-
removeMember
|
|
23
|
-
} from '../account/api'
|
|
24
|
-
import type { CloudSession, TeamMember } from '../account/api'
|
|
25
|
-
|
|
26
|
-
export function UsersSettings() {
|
|
27
|
-
const { team, removingMemberIds, setRemovingMemberIds } = useAccount()
|
|
28
|
-
const directory = useSyncExternalStore(subscribeDirectoryStore, getDirectory, getDirectory)
|
|
29
|
-
const qc = useQueryClient()
|
|
30
|
-
const [email, setEmail] = useState('')
|
|
31
|
-
const mutation = useMutation({
|
|
32
|
-
mutationKey: accountKeys.team,
|
|
33
|
-
mutationFn: (action: () => Promise<unknown>) => action(),
|
|
34
|
-
onSuccess: () => qc.invalidateQueries({ queryKey: accountKeys.team }),
|
|
35
|
-
onError: error => {
|
|
36
|
-
toast.add({ title: 'Couldn’t update users', description: error.message, type: 'error' })
|
|
37
|
-
if (error instanceof CloudApiError && error.status === 401)
|
|
38
|
-
void qc.invalidateQueries({ queryKey: accountKeys.session })
|
|
39
|
-
}
|
|
40
|
-
})
|
|
41
|
-
const pending = useIsMutating({ mutationKey: accountKeys.team }) > 0
|
|
42
|
-
|
|
43
|
-
function act(action: () => Promise<unknown>) {
|
|
44
|
-
if (!pending) mutation.mutate(action)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function remove(member: TeamMember) {
|
|
48
|
-
const userId = qc.getQueryData<CloudSession>(accountKeys.session)?.user.id
|
|
49
|
-
const restore = () => setRemovingMemberIds(ids => ids.filter(id => id !== member.id))
|
|
50
|
-
let undone = false
|
|
51
|
-
setRemovingMemberIds(ids => [...ids, member.id])
|
|
52
|
-
// Keep access intact until the toast closes, so Undo needs no restore API.
|
|
53
|
-
const id = toast.add({
|
|
54
|
-
title: `${member.name.trim() || member.email} removed`,
|
|
55
|
-
timeout: 5000,
|
|
56
|
-
onClose: () => {
|
|
57
|
-
if (undone || qc.getQueryData<CloudSession>(accountKeys.session)?.user.id !== userId) {
|
|
58
|
-
restore()
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
void mutation.mutateAsync(() => removeMember(member.id)).then(restore, restore)
|
|
62
|
-
},
|
|
63
|
-
actionProps: {
|
|
64
|
-
children: 'Undo',
|
|
65
|
-
onClick: () => {
|
|
66
|
-
undone = true
|
|
67
|
-
toast.close(id)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
if (team.isPending)
|
|
74
|
-
return (
|
|
75
|
-
<SettingsSection title="Users">
|
|
76
|
-
<div className="flex flex-col gap-4" aria-label="Loading users">
|
|
77
|
-
<Skeleton className="h-6 w-32" />
|
|
78
|
-
<Skeleton className="h-24 w-full" />
|
|
79
|
-
</div>
|
|
80
|
-
</SettingsSection>
|
|
81
|
-
)
|
|
82
|
-
if (team.isError)
|
|
83
|
-
return (
|
|
84
|
-
<SettingsSection title="Users">
|
|
85
|
-
<div className="flex flex-col items-start gap-3">
|
|
86
|
-
<p role="alert">{team.error.message}</p>
|
|
87
|
-
<Button variant="outline" onClick={() => void team.refetch()}>
|
|
88
|
-
Try again
|
|
89
|
-
</Button>
|
|
90
|
-
</div>
|
|
91
|
-
</SettingsSection>
|
|
92
|
-
)
|
|
93
|
-
const { members, invitations, role } = team.data
|
|
94
|
-
const owner = role === 'owner'
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<SettingsSection title="Users">
|
|
98
|
-
<ul className="flex flex-col gap-4">
|
|
99
|
-
{members
|
|
100
|
-
.filter(member => !removingMemberIds.includes(member.id))
|
|
101
|
-
.map(member => (
|
|
102
|
-
<li key={member.id} className="flex items-center gap-3">
|
|
103
|
-
<User
|
|
104
|
-
profile={normalizeUserProfile({
|
|
105
|
-
...directory?.find(user => user.id === member.userId),
|
|
106
|
-
id: member.userId,
|
|
107
|
-
name: member.name,
|
|
108
|
-
email: member.email
|
|
109
|
-
})}
|
|
110
|
-
size="sm"
|
|
111
|
-
showYouLabel={member.me}
|
|
112
|
-
description={member.name?.trim() ? member.email : undefined}
|
|
113
|
-
className="flex-1"
|
|
114
|
-
/>
|
|
115
|
-
<span className="text-xs text-muted-foreground">
|
|
116
|
-
{member.role === 'owner' ? 'Owner' : 'Member'}
|
|
117
|
-
</span>
|
|
118
|
-
{owner && !member.me && (
|
|
119
|
-
<Button
|
|
120
|
-
variant="ghost"
|
|
121
|
-
size="sm"
|
|
122
|
-
disabled={pending}
|
|
123
|
-
aria-label={`Remove ${member.email}`}
|
|
124
|
-
onClick={() => remove(member)}
|
|
125
|
-
>
|
|
126
|
-
Remove
|
|
127
|
-
</Button>
|
|
128
|
-
)}
|
|
129
|
-
</li>
|
|
130
|
-
))}
|
|
131
|
-
{owner &&
|
|
132
|
-
invitations.map(invitation => (
|
|
133
|
-
<li
|
|
134
|
-
key={`invitation-${invitation.id}`}
|
|
135
|
-
className="group/invitation flex items-center gap-3"
|
|
136
|
-
tabIndex={0}
|
|
137
|
-
>
|
|
138
|
-
<User
|
|
139
|
-
profile={normalizeUserProfile({ id: invitation.id, email: invitation.email })}
|
|
140
|
-
size="sm"
|
|
141
|
-
description={`Invitation expires ${new Date(invitation.expiresAt).toLocaleDateString()}`}
|
|
142
|
-
className="flex-1 text-muted-foreground [&_[data-slot=avatar]]:opacity-50"
|
|
143
|
-
/>
|
|
144
|
-
<div className="flex shrink-0 items-center gap-2">
|
|
145
|
-
<span className="text-xs text-muted-foreground [@media(hover:hover)]:group-focus-within/invitation:hidden [@media(hover:hover)]:group-hover/invitation:hidden">
|
|
146
|
-
Pending invite
|
|
147
|
-
</span>
|
|
148
|
-
<Button
|
|
149
|
-
variant="ghost"
|
|
150
|
-
size="icon-sm"
|
|
151
|
-
className="text-muted-foreground transition-none group-focus-within/invitation:inline-flex group-hover/invitation:inline-flex [@media(hover:hover)]:hidden"
|
|
152
|
-
disabled={pending}
|
|
153
|
-
aria-label={`Cancel invitation for ${invitation.email}`}
|
|
154
|
-
onClick={() => act(() => cancelInvitation(invitation.id))}
|
|
155
|
-
>
|
|
156
|
-
<IconX stroke={1.75} />
|
|
157
|
-
</Button>
|
|
158
|
-
</div>
|
|
159
|
-
</li>
|
|
160
|
-
))}
|
|
161
|
-
</ul>
|
|
162
|
-
{owner && (
|
|
163
|
-
<form
|
|
164
|
-
className="flex items-end gap-2"
|
|
165
|
-
onSubmit={event => {
|
|
166
|
-
event.preventDefault()
|
|
167
|
-
const value = email.trim()
|
|
168
|
-
if (!value) return
|
|
169
|
-
act(async () => {
|
|
170
|
-
await inviteMember(value)
|
|
171
|
-
setEmail('')
|
|
172
|
-
})
|
|
173
|
-
}}
|
|
174
|
-
>
|
|
175
|
-
<Field className="min-w-0 flex-1">
|
|
176
|
-
<FieldLabel htmlFor="invite-email">Invite someone</FieldLabel>
|
|
177
|
-
<Input
|
|
178
|
-
id="invite-email"
|
|
179
|
-
type="email"
|
|
180
|
-
required
|
|
181
|
-
autoComplete="off"
|
|
182
|
-
placeholder="Email"
|
|
183
|
-
value={email}
|
|
184
|
-
disabled={pending}
|
|
185
|
-
onChange={event => setEmail(event.target.value)}
|
|
186
|
-
/>
|
|
187
|
-
</Field>
|
|
188
|
-
<Button type="submit" disabled={pending}>
|
|
189
|
-
Invite
|
|
190
|
-
</Button>
|
|
191
|
-
</form>
|
|
192
|
-
)}
|
|
193
|
-
</SettingsSection>
|
|
194
|
-
)
|
|
195
|
-
}
|
package/dist/chunk-0mjzg20x.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var N=Object.create;var{getPrototypeOf:H,defineProperty:k,getOwnPropertyNames:J}=Object;var E=Object.prototype.hasOwnProperty;function V(a){return this[a]}var M,Z,e=(a,r,t)=>{var i=a!=null&&typeof a==="object";if(i){var o=r?M??=new WeakMap:Z??=new WeakMap,s=o.get(a);if(s)return s}t=a!=null?N(H(a)):{};let d=r||!a||!a.__esModule||!E.call(a,"default")?k(t,"default",{value:a,enumerable:!0}):t;if(a&&typeof a==="object"||typeof a==="function"){for(let l of J(a))if(!E.call(d,l))k(d,l,{get:V.bind(a,l),enumerable:!0})}if(i)o.set(a,d);return d};var x=(a,r)=>()=>(r||a((r={exports:{}}).exports,r),r.exports);var F=(a)=>a;function Q(a,r){this[a]=F.bind(null,r)}var se=(a,r)=>{for(var t in r)k(a,t,{get:r[t],enumerable:!0,configurable:!0,set:Q.bind(r,t)})};var Le=((a)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var A,y,u,U=(a,r)=>{for(var[t,i,o]of A||[])for(var s=[a],d=globalThis,l=d.document,j,w,m,p,g;w=s.pop();)if(!y[w]&&(m=i[w])){y[w]=1;for(p=1;p<m.length;p++)s.push(o[m[p]]);if(!r&&w!==a&&(j=l&&l.head)){if(u===void 0)u=(p=l.querySelector("meta[property=csp-nonce]"))&&(p.nonce||p.getAttribute("nonce"))||"";if(g=l.createElement("link"),g.rel="modulepreload",g.crossOrigin="",u)g.nonce=u;g.href=new d.URL(m[0],t),j.appendChild(g)}}},G=(a,r,t,i)=>{for(var o={},s=0;s<r.length;s++)o[r[s]]=t[s];(A||=[]).push([a,o,r]),y||={},U(r[i],1)};G(import.meta.url,["0mjzg20x","v88n1bay","825hys3h","g0tcwqxc","nf2wkvf9","71fn6rmj","7yg1m8hx","9bb8m9rx","58dyt9bk","n0nab26d","2y59vrxg"],[["/chunk-0mjzg20x.js"],["/chunk-v88n1bay.js",6,0,7,8],["/chunk-825hys3h.js",7],["/chunk-g0tcwqxc.js",0,8],["/chunk-nf2wkvf9.js"],["/chunk-71fn6rmj.js",10,6,0,7],["/chunk-7yg1m8hx.js",0,7],["/chunk-9bb8m9rx.js",0,8],["/chunk-58dyt9bk.js"],["/chunk-n0nab26d.js",10],["/chunk-2y59vrxg.js"]],0);
|
|
2
|
-
if(typeof globalThis.structuredClone==="function")globalThis.structuredClone=globalThis.structuredClone.bind(globalThis);var h=["pink","orange","amber","lime","emerald","cyan","blue","violet"];function b(a){return typeof a==="string"&&h.includes(a)}function S(a){let r=2166136261;for(let t=0;t<a.length;t++)r^=a.charCodeAt(t),r=Math.imul(r,16777619);return h[(r>>>0)%h.length]??h[0]}var Fe=1;var K=8192,W=320;function X(a){return typeof a==="object"&&a!==null&&!Array.isArray(a)}function f(a,r=256){return typeof a==="string"&&a.length>0&&!a.includes("\x00")&&new TextEncoder().encode(a).length<=r}function ye(a){return X(a)&&f(a.id,240)&&a.id.trim().length>0&&(a.name===void 0||f(a.name)&&a.name.trim().length>0)&&b(a.color)&&(a.avatar===void 0||f(a.avatar,K))&&(a.email===void 0||f(a.email,W))}var aa=["Curious Kiwi","Cheerful Cherry","Sleepy Peach","Excited Banana","Cosmic Mango","Velvet Lemon","Electric Plum","Wandering Pear","Dramatic Papaya","Suspicious Pineapple","Confused Coconut","Sneaky Tangerine","Gentle Fig","Quiet Apricot","Mellow Melon","Dreamy Guava"];function P(a,r){let t=a.filter((i)=>i!==r);return t[Math.floor(Math.random()*t.length)]??a[0]}function ra(a){return{name:P(aa,a?.name),color:P(h,a?.color)}}function ta(a,r){let t=r.name.trim();return{id:a,...t?{name:t}:{},color:r.color}}function L(){return ta(`local-${crypto.randomUUID().slice(0,8)}`,ra())}var _="moi:local-profile",ea=Object.freeze([]),c,n,T,I=!1,v=new Set,z=new Set;function C(a,r){return JSON.stringify(a)===JSON.stringify(r)}function re(a){if(!a||typeof a.id!=="string"||!a.id.trim())throw Error("A user profile needs an id.");if(a.name!==void 0&&typeof a.name!=="string")throw Error("A user profile name must be a string when provided.");if(a.color!==void 0&&!b(a.color))throw Error("A user profile color must be one of the user palette names.");let r=a.id.trim(),t=a.name?.trim(),i={id:r,...t?{name:t}:{},color:a.color??S(r),...a.avatar!==void 0?{avatar:a.avatar}:{},...a.email!==void 0?{email:a.email}:{}};if(!ye(i))throw Error("Invalid user profile.");return Object.freeze(i)}function oa(a){if(!Array.isArray(a))throw Error("Users must be an array.");let r=new Set,t=a.map((i)=>{let o=re(i);if(r.has(o.id))throw Error("Users must have unique ids.");return r.add(o.id),o});return Object.freeze(t)}function le(a){if(!a||typeof a!=="object")throw Error("Users must be published as an object.");let r=oa(a.users),t;if(a.me!==void 0&&a.me!==null){if(typeof a.me!=="string")throw Error("The current user id must be a string.");let o=a.me.trim();if(t=r.find((s)=>s.id===o),!t)throw Error("The current user must be listed in users.")}let i=n!=="external"||!C(c,t);if(n="external",i)c=t;if(T=t?r:ea,i)v.forEach((o)=>o());z.forEach((o)=>o())}function Y(){return T}function pe(a){return z.add(a),()=>{z.delete(a)}}function O(){return c}function oe(a){return v.add(a),()=>{v.delete(a)}}function be(){return n}function Be({provider:a,profile:r}){if(n==="external")return;if(a===void 0){if(n===void 0||n==="local")return;n=void 0,c=void 0}else{let t=r===void 0?void 0:re(r);if(n===a&&C(c,t))return;n=a,c=t}v.forEach((t)=>t())}function ia(){try{localStorage.setItem(_,JSON.stringify(c))}catch{}}function ve(a){if(n!==void 0&&n!=="local")return;let r=re(a);n="local",c=r,ia(),v.forEach((t)=>t())}function D(a,r){if(!a||!r||r.provider!==void 0||n!==void 0)return;try{let t=localStorage.getItem(_);if(t){ve(JSON.parse(t));return}}catch{}ve(L())}function q(){if(typeof window>"u"||I)return;I=!0;let a=window;a.moi??={};let r={publishUsers:le};a.moi.collab=r}function R(a){if(a.key!==_||!a.newValue||n!=="local")return;try{let r=re(JSON.parse(a.newValue));if(C(r,c))return;c=r,v.forEach((t)=>t())}catch{}}function B(){return window.addEventListener("storage",R),()=>window.removeEventListener("storage",R)}q();B();async function na(a){let[{mount:r},t,i]=await Promise.all([(U("v88n1bay"),import("/chunk-v88n1bay.js")),(U("825hys3h"),import("/chunk-825hys3h.js")).then((o)=>o.loadAppConfig()),(U("g0tcwqxc"),import("/chunk-g0tcwqxc.js")).then((o)=>o.loadProxyUser())]);D(t?.environment==="local"&&!t.demo,i),r(a)}globalThis.__init=na;export{e,x,se,Le,U,Fe,X,ye,re,le,Y,pe,O,oe,be,Be,ve};
|