@dxos/plugin-client 0.8.2-main.fbd8ed0 → 0.8.2-staging.42af850

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 (96) hide show
  1. package/dist/lib/browser/{app-graph-builder-ROTCC3C4.mjs → app-graph-builder-CBRN2DMK.mjs} +3 -3
  2. package/dist/lib/browser/chunk-DCUIJY75.mjs +694 -0
  3. package/dist/lib/{node-esm/chunk-34X2AMVA.mjs.map → browser/chunk-DCUIJY75.mjs.map} +1 -1
  4. package/dist/lib/browser/{chunk-XPHDZ277.mjs → chunk-IA3AVM4I.mjs} +12 -6
  5. package/dist/lib/browser/chunk-IA3AVM4I.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-BGY6BSUC.mjs → chunk-PSSNS4C6.mjs} +2 -2
  7. package/dist/lib/{node-esm/chunk-K3KGGSJZ.mjs.map → browser/chunk-PSSNS4C6.mjs.map} +1 -1
  8. package/dist/lib/browser/{chunk-4PLF3BEB.mjs → chunk-UCVFWBKT.mjs} +2 -2
  9. package/dist/lib/{node-esm/chunk-BP56BGZR.mjs.map → browser/chunk-UCVFWBKT.mjs.map} +1 -1
  10. package/dist/lib/browser/{client-ICXXK55V.mjs → client-NMS3MSFP.mjs} +5 -4
  11. package/dist/lib/browser/client-NMS3MSFP.mjs.map +7 -0
  12. package/dist/lib/browser/index.mjs +9 -9
  13. package/dist/lib/browser/{intent-resolver-L4STUWGK.mjs → intent-resolver-KGM6A3BF.mjs} +7 -7
  14. package/dist/lib/browser/intent-resolver-KGM6A3BF.mjs.map +7 -0
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/{migrations-DYDZ7DVP.mjs → migrations-QRQV6ZAM.mjs} +2 -2
  17. package/dist/lib/browser/{react-context-WEH7SL4I.mjs → react-context-IE2O2OYK.mjs} +2 -2
  18. package/dist/lib/browser/{react-surface-VXFG7BEM.mjs → react-surface-CKZHHWY3.mjs} +3 -3
  19. package/dist/lib/browser/{schema-defs-QVXP2JGN.mjs → schema-defs-DNRDVQQJ.mjs} +2 -2
  20. package/dist/lib/browser/types.mjs +1 -1
  21. package/dist/lib/node/{app-graph-builder-DOHFMHXU.cjs → app-graph-builder-BEEYM3A5.cjs} +15 -15
  22. package/dist/lib/node/chunk-73HHNJMV.cjs +719 -0
  23. package/dist/lib/node/{chunk-FABH7MJ3.cjs.map → chunk-73HHNJMV.cjs.map} +1 -1
  24. package/dist/lib/node/{chunk-J5SQ5Q22.cjs → chunk-BL6EBWOS.cjs} +15 -9
  25. package/dist/lib/node/chunk-BL6EBWOS.cjs.map +7 -0
  26. package/dist/lib/node/{chunk-ZVQIICEN.cjs → chunk-CIYUKY3J.cjs} +5 -5
  27. package/dist/lib/node/{chunk-ZVQIICEN.cjs.map → chunk-CIYUKY3J.cjs.map} +1 -1
  28. package/dist/lib/node/{chunk-W64EOF2B.cjs → chunk-DNKJCPU7.cjs} +5 -5
  29. package/dist/lib/node/{chunk-W64EOF2B.cjs.map → chunk-DNKJCPU7.cjs.map} +1 -1
  30. package/dist/lib/node/{client-OUBG63HJ.cjs → client-Q3EQS4HA.cjs} +10 -9
  31. package/dist/lib/node/client-Q3EQS4HA.cjs.map +7 -0
  32. package/dist/lib/node/index.cjs +16 -16
  33. package/dist/lib/node/{intent-resolver-IDLAVEHS.cjs → intent-resolver-Q4QBA5B2.cjs} +33 -33
  34. package/dist/lib/node/intent-resolver-Q4QBA5B2.cjs.map +7 -0
  35. package/dist/lib/node/meta.json +1 -1
  36. package/dist/lib/node/{migrations-ZI52SX4M.cjs → migrations-6FEWMF7U.cjs} +7 -7
  37. package/dist/lib/node/{react-context-SF3M3YLR.cjs → react-context-JS7Y5ZOK.cjs} +6 -6
  38. package/dist/lib/node/{react-surface-UGXE6OAD.cjs → react-surface-GHKLUOKW.cjs} +24 -24
  39. package/dist/lib/node/{schema-defs-BYGBDKOU.cjs → schema-defs-TA52ARBO.cjs} +7 -7
  40. package/dist/lib/node/types.cjs +3 -3
  41. package/dist/lib/node/types.cjs.map +1 -1
  42. package/dist/lib/node-esm/{app-graph-builder-XMXJG5YT.mjs → app-graph-builder-OZEAAKNT.mjs} +3 -3
  43. package/dist/lib/node-esm/{chunk-K3KGGSJZ.mjs → chunk-37E3EI46.mjs} +2 -2
  44. package/dist/lib/{browser/chunk-BGY6BSUC.mjs.map → node-esm/chunk-37E3EI46.mjs.map} +1 -1
  45. package/dist/lib/node-esm/{chunk-BP56BGZR.mjs → chunk-FJYSQRBO.mjs} +2 -2
  46. package/dist/lib/{browser/chunk-4PLF3BEB.mjs.map → node-esm/chunk-FJYSQRBO.mjs.map} +1 -1
  47. package/dist/lib/node-esm/{chunk-V6SJNSKG.mjs → chunk-STGGUFV2.mjs} +12 -6
  48. package/dist/lib/node-esm/chunk-STGGUFV2.mjs.map +7 -0
  49. package/dist/lib/node-esm/chunk-ULXZABZ4.mjs +695 -0
  50. package/dist/lib/{browser/chunk-7OW22D2O.mjs.map → node-esm/chunk-ULXZABZ4.mjs.map} +1 -1
  51. package/dist/lib/node-esm/{client-YJNEHNUV.mjs → client-EBFQZRSF.mjs} +5 -4
  52. package/dist/lib/node-esm/client-EBFQZRSF.mjs.map +7 -0
  53. package/dist/lib/node-esm/index.mjs +9 -9
  54. package/dist/lib/node-esm/{intent-resolver-73FZIXX5.mjs → intent-resolver-2GCG4LCE.mjs} +7 -7
  55. package/dist/lib/node-esm/intent-resolver-2GCG4LCE.mjs.map +7 -0
  56. package/dist/lib/node-esm/meta.json +1 -1
  57. package/dist/lib/node-esm/{migrations-GHO52HKW.mjs → migrations-AK43ZE6G.mjs} +2 -2
  58. package/dist/lib/node-esm/{react-context-EAKKTE5A.mjs → react-context-6N7NMUJE.mjs} +2 -2
  59. package/dist/lib/node-esm/{react-surface-R65DYUV6.mjs → react-surface-UCUL26AF.mjs} +3 -3
  60. package/dist/lib/node-esm/{schema-defs-O4OHIIBN.mjs → schema-defs-O2KQQXJH.mjs} +2 -2
  61. package/dist/lib/node-esm/types.mjs +1 -1
  62. package/dist/types/src/capabilities/client.d.ts +1 -1
  63. package/dist/types/src/capabilities/client.d.ts.map +1 -1
  64. package/dist/types/src/types.d.ts +6 -0
  65. package/dist/types/src/types.d.ts.map +1 -1
  66. package/package.json +26 -25
  67. package/src/capabilities/client.ts +2 -1
  68. package/src/capabilities/intent-resolver.ts +2 -2
  69. package/src/types.ts +12 -3
  70. package/dist/lib/browser/chunk-7OW22D2O.mjs +0 -623
  71. package/dist/lib/browser/chunk-XPHDZ277.mjs.map +0 -7
  72. package/dist/lib/browser/client-ICXXK55V.mjs.map +0 -7
  73. package/dist/lib/browser/intent-resolver-L4STUWGK.mjs.map +0 -7
  74. package/dist/lib/node/chunk-FABH7MJ3.cjs +0 -648
  75. package/dist/lib/node/chunk-J5SQ5Q22.cjs.map +0 -7
  76. package/dist/lib/node/client-OUBG63HJ.cjs.map +0 -7
  77. package/dist/lib/node/intent-resolver-IDLAVEHS.cjs.map +0 -7
  78. package/dist/lib/node-esm/chunk-34X2AMVA.mjs +0 -624
  79. package/dist/lib/node-esm/chunk-V6SJNSKG.mjs.map +0 -7
  80. package/dist/lib/node-esm/client-YJNEHNUV.mjs.map +0 -7
  81. package/dist/lib/node-esm/intent-resolver-73FZIXX5.mjs.map +0 -7
  82. /package/dist/lib/browser/{app-graph-builder-ROTCC3C4.mjs.map → app-graph-builder-CBRN2DMK.mjs.map} +0 -0
  83. /package/dist/lib/browser/{migrations-DYDZ7DVP.mjs.map → migrations-QRQV6ZAM.mjs.map} +0 -0
  84. /package/dist/lib/browser/{react-context-WEH7SL4I.mjs.map → react-context-IE2O2OYK.mjs.map} +0 -0
  85. /package/dist/lib/browser/{react-surface-VXFG7BEM.mjs.map → react-surface-CKZHHWY3.mjs.map} +0 -0
  86. /package/dist/lib/browser/{schema-defs-QVXP2JGN.mjs.map → schema-defs-DNRDVQQJ.mjs.map} +0 -0
  87. /package/dist/lib/node/{app-graph-builder-DOHFMHXU.cjs.map → app-graph-builder-BEEYM3A5.cjs.map} +0 -0
  88. /package/dist/lib/node/{migrations-ZI52SX4M.cjs.map → migrations-6FEWMF7U.cjs.map} +0 -0
  89. /package/dist/lib/node/{react-context-SF3M3YLR.cjs.map → react-context-JS7Y5ZOK.cjs.map} +0 -0
  90. /package/dist/lib/node/{react-surface-UGXE6OAD.cjs.map → react-surface-GHKLUOKW.cjs.map} +0 -0
  91. /package/dist/lib/node/{schema-defs-BYGBDKOU.cjs.map → schema-defs-TA52ARBO.cjs.map} +0 -0
  92. /package/dist/lib/node-esm/{app-graph-builder-XMXJG5YT.mjs.map → app-graph-builder-OZEAAKNT.mjs.map} +0 -0
  93. /package/dist/lib/node-esm/{migrations-GHO52HKW.mjs.map → migrations-AK43ZE6G.mjs.map} +0 -0
  94. /package/dist/lib/node-esm/{react-context-EAKKTE5A.mjs.map → react-context-6N7NMUJE.mjs.map} +0 -0
  95. /package/dist/lib/node-esm/{react-surface-R65DYUV6.mjs.map → react-surface-UCUL26AF.mjs.map} +0 -0
  96. /package/dist/lib/node-esm/{schema-defs-O4OHIIBN.mjs.map → schema-defs-O2KQQXJH.mjs.map} +0 -0
@@ -1,623 +0,0 @@
1
- import {
2
- ClientAction
3
- } from "./chunk-XPHDZ277.mjs";
4
- import {
5
- CLIENT_PLUGIN
6
- } from "./chunk-MCEXD5XH.mjs";
7
-
8
- // packages/plugins/plugin-client/src/components/DevicesContainer.tsx
9
- import { Check, X } from "@phosphor-icons/react";
10
- import React, { useCallback, useEffect, useState } from "react";
11
- import { QR } from "react-qr-rounded";
12
- import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
13
- import { log } from "@dxos/log";
14
- import { useClient, useMulticastObservable } from "@dxos/react-client";
15
- import { useDevices } from "@dxos/react-client/halo";
16
- import { Invitation, InvitationEncoder } from "@dxos/react-client/invitations";
17
- import { useNetworkStatus } from "@dxos/react-client/mesh";
18
- import { Button, Clipboard, IconButton, List, useId, useTranslation } from "@dxos/react-ui";
19
- import { ControlFrame, ControlFrameItem, ControlGroup, ControlItem, ControlPage, ControlSection } from "@dxos/react-ui-form";
20
- import { StackItem } from "@dxos/react-ui-stack";
21
- import { getSize, mx } from "@dxos/react-ui-theme";
22
- import { AuthCode, Centered, DeviceListItem, Emoji, Viewport } from "@dxos/shell/react";
23
- import { hexToEmoji } from "@dxos/util";
24
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-client/src/components/DevicesContainer.tsx";
25
- var DevicesContainer = ({ createInvitationUrl }) => {
26
- const { t } = useTranslation("os");
27
- const { dispatchPromise: dispatch } = useIntentDispatcher();
28
- const devices = useDevices();
29
- const { swarm: connectionState } = useNetworkStatus();
30
- const handleResetStorage = useCallback(() => dispatch(createIntent(ClientAction.ResetStorage)), [
31
- dispatch
32
- ]);
33
- const handleRecover = useCallback(() => dispatch(createIntent(ClientAction.ResetStorage, {
34
- mode: "recover"
35
- })), [
36
- dispatch
37
- ]);
38
- const handleJoinNewIdentity = useCallback(() => dispatch(createIntent(ClientAction.ResetStorage, {
39
- mode: "join new identity"
40
- })), [
41
- dispatch
42
- ]);
43
- return /* @__PURE__ */ React.createElement(Clipboard.Provider, null, /* @__PURE__ */ React.createElement(StackItem.Content, {
44
- classNames: "block overflow-y-auto"
45
- }, /* @__PURE__ */ React.createElement(ControlPage, null, /* @__PURE__ */ React.createElement(ControlSection, {
46
- title: t("devices verbose label", {
47
- ns: CLIENT_PLUGIN
48
- }),
49
- description: t("devices description", {
50
- ns: CLIENT_PLUGIN
51
- })
52
- }, /* @__PURE__ */ React.createElement(ControlFrame, null, /* @__PURE__ */ React.createElement(ControlFrameItem, {
53
- title: t("devices label", {
54
- ns: CLIENT_PLUGIN
55
- })
56
- }, /* @__PURE__ */ React.createElement(List, null, devices.map((device) => {
57
- return /* @__PURE__ */ React.createElement(DeviceListItem, {
58
- key: device.deviceKey.toHex(),
59
- device,
60
- connectionState
61
- });
62
- }))), createInvitationUrl && /* @__PURE__ */ React.createElement(ControlFrameItem, {
63
- title: "Add device"
64
- }, /* @__PURE__ */ React.createElement(DeviceInvitation, {
65
- createInvitationUrl
66
- })))), /* @__PURE__ */ React.createElement(ControlSection, {
67
- title: t("danger zone title", {
68
- ns: CLIENT_PLUGIN
69
- }),
70
- description: t("danger zone description", {
71
- ns: CLIENT_PLUGIN
72
- })
73
- }, /* @__PURE__ */ React.createElement(ControlGroup, null, /* @__PURE__ */ React.createElement(ControlItem, {
74
- title: t("reset device label"),
75
- description: t("reset device description", {
76
- ns: CLIENT_PLUGIN
77
- })
78
- }, /* @__PURE__ */ React.createElement(Button, {
79
- variant: "destructive",
80
- onClick: handleResetStorage,
81
- "data-testid": "devicesContainer.reset"
82
- }, t("reset device label"))), /* @__PURE__ */ React.createElement(ControlItem, {
83
- title: t("recover identity label"),
84
- description: t("recover identity description", {
85
- ns: CLIENT_PLUGIN
86
- })
87
- }, /* @__PURE__ */ React.createElement(Button, {
88
- variant: "destructive",
89
- onClick: handleRecover,
90
- "data-testid": "devicesContainer.recover"
91
- }, t("recover identity label"))), /* @__PURE__ */ React.createElement(ControlItem, {
92
- title: t("join new identity label"),
93
- description: t("join new identity description", {
94
- ns: CLIENT_PLUGIN
95
- })
96
- }, /* @__PURE__ */ React.createElement(Button, {
97
- variant: "destructive",
98
- onClick: handleJoinNewIdentity,
99
- "data-testid": "devicesContainer.joinExisting"
100
- }, t("join new identity label"))))))));
101
- };
102
- var DeviceInvitation = (props) => {
103
- const client = useClient();
104
- const [invitation, setInvitation] = useState();
105
- const onInvitationCreate = useCallback(() => {
106
- const invitation2 = client.halo.share();
107
- if (client.config.values.runtime?.app?.env?.DX_ENVIRONMENT !== "production") {
108
- const subscription = invitation2.subscribe((invitation3) => {
109
- const invitationCode = InvitationEncoder.encode(invitation3);
110
- if (invitation3.state === Invitation.State.CONNECTING) {
111
- log.info(JSON.stringify({
112
- invitationCode,
113
- authCode: invitation3.authCode
114
- }), void 0, {
115
- F: __dxlog_file,
116
- L: 141,
117
- S: void 0,
118
- C: (f, a) => f(...a)
119
- });
120
- subscription.unsubscribe();
121
- }
122
- });
123
- }
124
- setInvitation(invitation2);
125
- }, [
126
- client
127
- ]);
128
- const onInvitationDone = useCallback(() => {
129
- setInvitation(void 0);
130
- }, []);
131
- if (invitation) {
132
- return /* @__PURE__ */ React.createElement(DeviceInvitationImpl, {
133
- ...props,
134
- invitation,
135
- onInvitationCreate,
136
- onInvitationDone
137
- });
138
- } else {
139
- return /* @__PURE__ */ React.createElement(InvitationSection, {
140
- ...props,
141
- onInvitationCreate,
142
- onInvitationDone
143
- });
144
- }
145
- };
146
- var DeviceInvitationImpl = ({ invitation: invitationObservable, createInvitationUrl, onInvitationDone, onInvitationCreate }) => {
147
- const invitation = useMulticastObservable(invitationObservable);
148
- const url = createInvitationUrl(InvitationEncoder.encode(invitation));
149
- useEffect(() => {
150
- if (invitation.state >= Invitation.State.SUCCESS) {
151
- onInvitationDone();
152
- }
153
- }, [
154
- invitation.state
155
- ]);
156
- return /* @__PURE__ */ React.createElement(InvitationSection, {
157
- ...invitation,
158
- url,
159
- onInvitationDone,
160
- onInvitationCreate
161
- });
162
- };
163
- var InvitationSection = ({ state = -1, authCode, invitationId = "never", url = "never", onInvitationDone = () => {
164
- }, onInvitationCreate = () => {
165
- } }) => {
166
- const { t } = useTranslation(CLIENT_PLUGIN);
167
- const activeView = state < 0 ? "init" : state >= Invitation.State.CANCELLED ? "complete" : state >= Invitation.State.READY_FOR_AUTHENTICATION && authCode ? "auth-code" : "qr-code";
168
- return activeView === "init" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
169
- className: "text-description mbe-2"
170
- }, t("add device description")), /* @__PURE__ */ React.createElement(IconButton, {
171
- icon: "ph--plus--regular",
172
- label: t("create device invitation label"),
173
- disabled: state >= 0,
174
- classNames: "is-full",
175
- "data-testid": "devicesContainer.createInvitation",
176
- onClick: onInvitationCreate
177
- })) : /* @__PURE__ */ React.createElement(Viewport.Root, {
178
- activeView
179
- }, /* @__PURE__ */ React.createElement(Viewport.Views, null, /* @__PURE__ */ React.createElement(Viewport.View, {
180
- id: "init"
181
- }), /* @__PURE__ */ React.createElement(Viewport.View, {
182
- id: "complete"
183
- }, /* @__PURE__ */ React.createElement(InvitationComplete, {
184
- statusValue: state
185
- })), /* @__PURE__ */ React.createElement(Viewport.View, {
186
- id: "auth-code"
187
- }, /* @__PURE__ */ React.createElement(InvitationAuthCode, {
188
- id: invitationId,
189
- code: authCode ?? "never",
190
- onCancel: onInvitationDone
191
- })), /* @__PURE__ */ React.createElement(Viewport.View, {
192
- id: "qr-code"
193
- }, /* @__PURE__ */ React.createElement(InvitationQR, {
194
- id: invitationId,
195
- url,
196
- onCancel: onInvitationDone
197
- }))));
198
- };
199
- var InvitationQR = ({ id, url, onCancel }) => {
200
- const { t } = useTranslation("os");
201
- const qrLabel = useId("devices-container__qr-code");
202
- const emoji = hexToEmoji(id);
203
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
204
- className: "text-description"
205
- }, t("qr code description", {
206
- ns: CLIENT_PLUGIN
207
- })), /* @__PURE__ */ React.createElement("div", {
208
- role: "group",
209
- className: "grid grid-cols-[1fr_min-content] mlb-2 gap-2"
210
- }, /* @__PURE__ */ React.createElement("div", {
211
- role: "none",
212
- className: "is-full aspect-square relative text-description"
213
- }, /* @__PURE__ */ React.createElement(QR, {
214
- rounding: 100,
215
- backgroundColor: "transparent",
216
- color: "currentColor",
217
- "aria-labelledby": qrLabel,
218
- errorCorrectionLevel: "Q",
219
- cutout: true
220
- }, url ?? "never"), /* @__PURE__ */ React.createElement(Centered, null, /* @__PURE__ */ React.createElement(Emoji, {
221
- text: emoji
222
- }))), /* @__PURE__ */ React.createElement("span", {
223
- id: qrLabel,
224
- className: "sr-only"
225
- }, t("qr label"))), /* @__PURE__ */ React.createElement("div", {
226
- className: "flex justify-center"
227
- }, /* @__PURE__ */ React.createElement("div", {
228
- className: "flex gap-2"
229
- }, /* @__PURE__ */ React.createElement(Clipboard.Button, {
230
- value: url ?? "never"
231
- }), /* @__PURE__ */ React.createElement(Button, {
232
- variant: "ghost",
233
- onClick: onCancel
234
- }, t("cancel label")))));
235
- };
236
- var InvitationAuthCode = ({ id, code, onCancel }) => {
237
- const { t } = useTranslation("os");
238
- const emoji = hexToEmoji(id);
239
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("p", {
240
- className: "text-description"
241
- }, t("auth other device emoji message")), emoji && /* @__PURE__ */ React.createElement(Emoji, {
242
- text: emoji,
243
- className: "mli-auto mlb-2 text-center"
244
- }), /* @__PURE__ */ React.createElement("p", {
245
- className: "text-description"
246
- }, t("auth code message")), /* @__PURE__ */ React.createElement(AuthCode, {
247
- code,
248
- large: true,
249
- classNames: "mli-auto mlb-2 text-center grow"
250
- }), /* @__PURE__ */ React.createElement(Button, {
251
- variant: "ghost",
252
- onClick: onCancel
253
- }, t("cancel label")));
254
- };
255
- var InvitationComplete = ({ statusValue }) => {
256
- return statusValue > 0 ? /* @__PURE__ */ React.createElement(Check, {
257
- className: mx("m-1.5", getSize(6))
258
- }) : /* @__PURE__ */ React.createElement(X, {
259
- className: mx("m-1.5", getSize(6))
260
- });
261
- };
262
-
263
- // packages/plugins/plugin-client/src/components/JoinDialog.tsx
264
- import React2, { useCallback as useCallback2 } from "react";
265
- import { createIntent as createIntent2, LayoutAction, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
266
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
267
- import { Dialog, useTranslation as useTranslation2 } from "@dxos/react-ui";
268
- import { JoinPanel } from "@dxos/shell/react";
269
- var JOIN_DIALOG = `${CLIENT_PLUGIN}/JoinDialog`;
270
- var JoinDialog = (props) => {
271
- const { dispatchPromise: dispatch } = useIntentDispatcher2();
272
- const { t } = useTranslation2(CLIENT_PLUGIN);
273
- const handleCancelResetStorage = useCallback2(() => dispatch(createIntent2(ClientAction.ShareIdentity)), [
274
- dispatch
275
- ]);
276
- const handleDone = useCallback2(async (result) => {
277
- if (result?.identityKey) {
278
- await Promise.all([
279
- dispatch(createIntent2(LayoutAction.UpdateDialog, {
280
- part: "dialog",
281
- options: {
282
- state: false
283
- }
284
- })),
285
- dispatch(createIntent2(ObservabilityAction.SendEvent, {
286
- name: props.initialDisposition === "recover-identity" ? "identity.recover" : "identity.join"
287
- }))
288
- ]);
289
- }
290
- }, [
291
- dispatch
292
- ]);
293
- return /* @__PURE__ */ React2.createElement(Dialog.Content, null, /* @__PURE__ */ React2.createElement(Dialog.Title, {
294
- classNames: "sr-only"
295
- }, t("join space label", {
296
- ns: "os"
297
- })), /* @__PURE__ */ React2.createElement(JoinPanel, {
298
- mode: "halo-only",
299
- ...props,
300
- exitActionParent: /* @__PURE__ */ React2.createElement(Dialog.Close, {
301
- asChild: true
302
- }),
303
- doneActionParent: /* @__PURE__ */ React2.createElement(Dialog.Close, {
304
- asChild: true
305
- }),
306
- onCancelResetStorage: handleCancelResetStorage,
307
- onDone: handleDone
308
- }));
309
- };
310
-
311
- // packages/plugins/plugin-client/src/components/ProfileContainer.tsx
312
- import { Schema } from "effect";
313
- import React3, { useCallback as useCallback3, useMemo, useState as useState2 } from "react";
314
- import { debounce } from "@dxos/async";
315
- import { useClient as useClient2 } from "@dxos/react-client";
316
- import { useIdentity } from "@dxos/react-client/halo";
317
- import { ButtonGroup, Clipboard as Clipboard2, Input, useTranslation as useTranslation3 } from "@dxos/react-ui";
318
- import { Form, ControlItem as ControlItem2, ControlItemInput, ControlSection as ControlSection2, ControlPage as ControlPage2 } from "@dxos/react-ui-form";
319
- import { EmojiPickerBlock, HuePicker } from "@dxos/react-ui-pickers";
320
- import { StackItem as StackItem2 } from "@dxos/react-ui-stack";
321
- import { hexToHue, hexToEmoji as hexToEmoji2 } from "@dxos/util";
322
- var getDefaultHueValue = (identity) => hexToHue(identity?.identityKey.toHex() ?? "0");
323
- var getDefaultEmojiValue = (identity) => hexToEmoji2(identity?.identityKey.toHex() ?? "0");
324
- var getHueValue = (identity) => identity?.profile?.data?.hue || getDefaultHueValue(identity);
325
- var getEmojiValue = (identity) => identity?.profile?.data?.emoji || getDefaultEmojiValue(identity);
326
- var ProfileContainer = () => {
327
- const { t } = useTranslation3(CLIENT_PLUGIN);
328
- const client = useClient2();
329
- const identity = useIdentity();
330
- const [displayName, setDisplayNameDirectly] = useState2(identity?.profile?.displayName ?? "");
331
- const [emoji, setEmojiDirectly] = useState2(getEmojiValue(identity));
332
- const [hue, setHueDirectly] = useState2(getHueValue(identity));
333
- const updateProfile = useMemo(() => debounce((profile) => client.halo.updateProfile({
334
- displayName: profile.displayName,
335
- data: {
336
- emoji: profile.emoji,
337
- hue: profile.hue
338
- }
339
- }), 2e3), []);
340
- const handleSave = useCallback3((profile) => {
341
- setDisplayNameDirectly(profile.displayName);
342
- setEmojiDirectly(profile.emoji);
343
- setHueDirectly(profile.hue);
344
- updateProfile(profile);
345
- }, [
346
- identity
347
- ]);
348
- const values = useMemo(() => ({
349
- displayName,
350
- emoji,
351
- hue,
352
- did: identity?.did
353
- }), [
354
- identity,
355
- displayName,
356
- emoji,
357
- hue
358
- ]);
359
- const customElements = useMemo(() => ({
360
- displayName: ({ type, label, getValue, onValueChange }) => {
361
- const handleChange = useCallback3(({ target: { value } }) => onValueChange(type, value), [
362
- onValueChange,
363
- type
364
- ]);
365
- return /* @__PURE__ */ React3.createElement(ControlItemInput, {
366
- title: label,
367
- description: t("display name description")
368
- }, /* @__PURE__ */ React3.createElement(Input.TextInput, {
369
- value: getValue(),
370
- onChange: handleChange,
371
- placeholder: t("display name input placeholder"),
372
- classNames: "min-is-64"
373
- }));
374
- },
375
- emoji: ({ type, label, getValue, onValueChange }) => {
376
- const handleChange = useCallback3((nextEmoji) => onValueChange(type, nextEmoji), [
377
- onValueChange,
378
- type
379
- ]);
380
- const handleEmojiReset = useCallback3(() => onValueChange(type, getDefaultEmojiValue(identity)), [
381
- onValueChange,
382
- type
383
- ]);
384
- return /* @__PURE__ */ React3.createElement(ControlItem2, {
385
- title: label,
386
- description: t("icon description")
387
- }, /* @__PURE__ */ React3.createElement(EmojiPickerBlock, {
388
- triggerVariant: "default",
389
- emoji: getValue(),
390
- onChangeEmoji: handleChange,
391
- onClickClear: handleEmojiReset,
392
- classNames: "justify-self-end"
393
- }));
394
- },
395
- hue: ({ type, label, getValue, onValueChange }) => {
396
- const handleChange = useCallback3((nextHue) => onValueChange(type, nextHue), [
397
- onValueChange,
398
- type
399
- ]);
400
- const handleHueReset = useCallback3(() => onValueChange(type, getDefaultHueValue(identity)), [
401
- onValueChange,
402
- type
403
- ]);
404
- return /* @__PURE__ */ React3.createElement(ControlItem2, {
405
- title: label,
406
- description: t("hue description")
407
- }, /* @__PURE__ */ React3.createElement(HuePicker, {
408
- value: getValue(),
409
- onChange: handleChange,
410
- onReset: handleHueReset,
411
- classNames: "[--hue-preview-size:1.5rem] justify-self-end"
412
- }));
413
- },
414
- // TODO(wittjosiah): We need text input annotations for disabled and copyable.
415
- did: ({ label, getValue }) => {
416
- return /* @__PURE__ */ React3.createElement(ControlItemInput, {
417
- title: label,
418
- description: t("did description")
419
- }, /* @__PURE__ */ React3.createElement(ButtonGroup, null, /* @__PURE__ */ React3.createElement(Input.TextInput, {
420
- value: getValue(),
421
- disabled: true,
422
- classNames: "min-is-64"
423
- }), /* @__PURE__ */ React3.createElement(Clipboard2.IconButton, {
424
- value: getValue() ?? ""
425
- })));
426
- }
427
- }), [
428
- t
429
- ]);
430
- return /* @__PURE__ */ React3.createElement(StackItem2.Content, {
431
- classNames: "block overflow-y-auto"
432
- }, /* @__PURE__ */ React3.createElement(ControlPage2, null, /* @__PURE__ */ React3.createElement(Clipboard2.Provider, null, /* @__PURE__ */ React3.createElement(ControlSection2, {
433
- title: t("profile label"),
434
- description: t("profile description")
435
- }, /* @__PURE__ */ React3.createElement(Form, {
436
- schema: ProfileSchema,
437
- values,
438
- autoSave: true,
439
- onSave: handleSave,
440
- Custom: customElements,
441
- classNames: 'p-0 container-max-width [&_[role="form"]]:grid [&_[role="form"]]:grid-cols-1 md:[&_[role="form"]]:grid-cols-[1fr_min-content] [&_[role="form"]]:gap-4'
442
- })))));
443
- };
444
- var ProfileSchema = Schema.Struct({
445
- displayName: Schema.String.annotations({
446
- title: "Display name"
447
- }),
448
- emoji: Schema.String.annotations({
449
- title: "Avatar"
450
- }),
451
- hue: Schema.String.annotations({
452
- title: "Color"
453
- }),
454
- did: Schema.String.annotations({
455
- title: "DID"
456
- })
457
- });
458
-
459
- // packages/plugins/plugin-client/src/components/RecoveryCodeDialog.tsx
460
- import React4, { useCallback as useCallback4, useState as useState3 } from "react";
461
- import { AlertDialog, Button as Button2, Clipboard as Clipboard3, Input as Input2, useTranslation as useTranslation4 } from "@dxos/react-ui";
462
- var RECOVERY_CODE_DIALOG = `${CLIENT_PLUGIN}/RecoveryCodeDialog`;
463
- var RecoveryCodeDialog = ({ code }) => {
464
- const { t } = useTranslation4(CLIENT_PLUGIN);
465
- const [confirmation, setConfirmation] = useState3(false);
466
- const handleConfirmation = useCallback4((checked) => setConfirmation(checked), []);
467
- return /* @__PURE__ */ React4.createElement(AlertDialog.Content, {
468
- classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
469
- }, /* @__PURE__ */ React4.createElement(AlertDialog.Title, null, t("recovery code dialog title")), /* @__PURE__ */ React4.createElement("p", {
470
- className: "py-4"
471
- }, t("recovery code dialog description")), /* @__PURE__ */ React4.createElement(Clipboard3.Provider, null, /* @__PURE__ */ React4.createElement(Code, {
472
- code
473
- })), /* @__PURE__ */ React4.createElement("div", {
474
- className: "flex flex-col py-4 gap-2"
475
- }, /* @__PURE__ */ React4.createElement("p", null, t("recovery code dialog warning 1")), /* @__PURE__ */ React4.createElement("p", null, t("recovery code dialog warning 2"))), /* @__PURE__ */ React4.createElement("div", {
476
- className: "flex items-center gap-2 pbe-4"
477
- }, /* @__PURE__ */ React4.createElement(Input2.Root, null, /* @__PURE__ */ React4.createElement(Input2.Checkbox, {
478
- "data-testid": "recoveryCode.confirm",
479
- checked: confirmation,
480
- onCheckedChange: handleConfirmation
481
- }), /* @__PURE__ */ React4.createElement(Input2.Label, null, t("recovery code confirmation label")))), /* @__PURE__ */ React4.createElement("div", {
482
- className: "flex justify-end"
483
- }, /* @__PURE__ */ React4.createElement(AlertDialog.Action, {
484
- asChild: true
485
- }, /* @__PURE__ */ React4.createElement(Button2, {
486
- "data-testid": "recoveryCode.continue",
487
- variant: "primary",
488
- disabled: !confirmation
489
- }, t("continue label")))));
490
- };
491
- var Code = ({ code }) => {
492
- const words = code.split(" ");
493
- return /* @__PURE__ */ React4.createElement("div", {
494
- className: "relative p-2 border border-separator rounded group"
495
- }, /* @__PURE__ */ React4.createElement(Clipboard3.IconButton, {
496
- value: code,
497
- classNames: "absolute top-2 right-2 invisible group-hover:visible"
498
- }), /* @__PURE__ */ React4.createElement("div", {
499
- className: "grid grid-cols-4"
500
- }, words.map((word, i) => /* @__PURE__ */ React4.createElement("div", {
501
- key: i,
502
- className: "flex items-center p-2 gap-2"
503
- }, /* @__PURE__ */ React4.createElement("div", {
504
- className: "w-4 text-xs text-center text-subdued"
505
- }, i + 1), /* @__PURE__ */ React4.createElement("div", {
506
- className: "text-sm"
507
- }, word)))));
508
- };
509
-
510
- // packages/plugins/plugin-client/src/components/RecoveryCredentialsContainer.tsx
511
- import React5 from "react";
512
- import { createIntent as createIntent3, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
513
- import { useCredentials } from "@dxos/react-client/halo";
514
- import { Icon, IconButton as IconButton2, List as List2, ListItem, useTranslation as useTranslation5, Message } from "@dxos/react-ui";
515
- import { ControlGroup as ControlGroup2, ControlItem as ControlItem3, ControlPage as ControlPage3, ControlSection as ControlSection3 } from "@dxos/react-ui-form";
516
- import { StackItem as StackItem3 } from "@dxos/react-ui-stack";
517
- var MANAGE_CREDENTIALS_DIALOG = `${CLIENT_PLUGIN}/ManageCredentialsDialog`;
518
- var RecoveryCredentialsContainer = () => {
519
- const { t } = useTranslation5(CLIENT_PLUGIN);
520
- const { dispatchPromise: dispatch } = useIntentDispatcher3();
521
- const credentials = useCredentials();
522
- const recoveryCredentials = credentials.filter((credential) => credential.subject.assertion["@type"] === "dxos.halo.credentials.IdentityRecovery");
523
- return /* @__PURE__ */ React5.createElement(StackItem3.Content, {
524
- classNames: "block overflow-y-auto"
525
- }, /* @__PURE__ */ React5.createElement(ControlPage3, null, /* @__PURE__ */ React5.createElement(ControlSection3, {
526
- title: t("recovery setup dialog title"),
527
- description: t("recovery setup dialog description")
528
- }, /* @__PURE__ */ React5.createElement(ControlGroup2, null, /* @__PURE__ */ React5.createElement(ControlItem3, {
529
- title: t("create passkey label"),
530
- description: t("create passkey description")
531
- }, /* @__PURE__ */ React5.createElement(IconButton2, {
532
- label: t("create passkey label"),
533
- icon: "ph--key--duotone",
534
- variant: "primary",
535
- size: 5,
536
- onClick: () => dispatch(createIntent3(ClientAction.CreatePasskey))
537
- })), /* @__PURE__ */ React5.createElement(ControlItem3, {
538
- title: t("create recovery code label"),
539
- description: t("create recovery code description")
540
- }, /* @__PURE__ */ React5.createElement(IconButton2, {
541
- label: t("create recovery code label"),
542
- icon: "ph--receipt--duotone",
543
- variant: "default",
544
- size: 5,
545
- onClick: () => dispatch(createIntent3(ClientAction.CreateRecoveryCode))
546
- })))), /* @__PURE__ */ React5.createElement(ControlSection3, {
547
- title: t("credentials list label")
548
- }, recoveryCredentials.length < 1 ? /* @__PURE__ */ React5.createElement(Message.Root, {
549
- valence: "error",
550
- className: "container-max-width"
551
- }, /* @__PURE__ */ React5.createElement(Message.Title, null, /* @__PURE__ */ React5.createElement(Icon, {
552
- icon: "ph--shield-warning--duotone",
553
- size: 5,
554
- classNames: "inline-block align-top mbs-px mie-1"
555
- }), t("no credentials title")), /* @__PURE__ */ React5.createElement(Message.Body, null, t("no credentials message"))) : /* @__PURE__ */ React5.createElement(List2, {
556
- classNames: "container-max-width pli-2"
557
- }, recoveryCredentials.map((credential) => /* @__PURE__ */ React5.createElement(ListItem.Root, {
558
- key: credential.id?.toHex()
559
- }, /* @__PURE__ */ React5.createElement(ListItem.Endcap, null, /* @__PURE__ */ React5.createElement(Icon, {
560
- icon: "ph--key--regular",
561
- size: 5
562
- })), /* @__PURE__ */ React5.createElement(ListItem.Heading, null, credential.issuanceDate.toLocaleString())))))));
563
- };
564
-
565
- // packages/plugins/plugin-client/src/components/ResetDialog.tsx
566
- import React6, { useCallback as useCallback5 } from "react";
567
- import { createIntent as createIntent4, LayoutAction as LayoutAction2, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
568
- import { useClient as useClient3 } from "@dxos/react-client";
569
- import { Dialog as Dialog2, useTranslation as useTranslation6 } from "@dxos/react-ui";
570
- import { ConfirmReset } from "@dxos/shell/react";
571
- var RESET_DIALOG = `${CLIENT_PLUGIN}/ResetDialog`;
572
- var ResetDialog = ({ mode, onReset }) => {
573
- const { t } = useTranslation6(CLIENT_PLUGIN);
574
- const { dispatchPromise: dispatch } = useIntentDispatcher4();
575
- const client = useClient3();
576
- const handleReset = useCallback5(async () => {
577
- await client.reset();
578
- const target = mode === "join new identity" ? "deviceInvitation" : mode === "recover" ? "recoverIdentity" : void 0;
579
- await onReset?.({
580
- target
581
- });
582
- }, [
583
- dispatch,
584
- client,
585
- mode,
586
- onReset
587
- ]);
588
- const handleCancel = useCallback5(() => {
589
- void dispatch(createIntent4(LayoutAction2.UpdateDialog, {
590
- part: "dialog",
591
- options: {
592
- state: false
593
- }
594
- }));
595
- }, [
596
- dispatch
597
- ]);
598
- return /* @__PURE__ */ React6.createElement(Dialog2.Content, {
599
- classNames: "bs-content min-bs-[15rem] max-bs-full md:max-is-[40rem] overflow-hidden"
600
- }, /* @__PURE__ */ React6.createElement(Dialog2.Title, {
601
- classNames: "sr-only"
602
- }, t("reset dialog title")), /* @__PURE__ */ React6.createElement(Dialog2.Description, {
603
- classNames: "sr-only"
604
- }, t("reset dialog description")), /* @__PURE__ */ React6.createElement(ConfirmReset, {
605
- active: true,
606
- mode,
607
- onConfirm: handleReset,
608
- onCancel: handleCancel
609
- }));
610
- };
611
-
612
- export {
613
- DevicesContainer,
614
- JOIN_DIALOG,
615
- JoinDialog,
616
- ProfileContainer,
617
- RECOVERY_CODE_DIALOG,
618
- RecoveryCodeDialog,
619
- RecoveryCredentialsContainer,
620
- RESET_DIALOG,
621
- ResetDialog
622
- };
623
- //# sourceMappingURL=chunk-7OW22D2O.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { type PluginContext } from '@dxos/app-framework';\nimport { type Client, PublicKey, type ClientOptions } from '@dxos/react-client';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { CLIENT_PLUGIN } from './meta';\n\n// TODO(wittjosiah): Factor out. Generate?\nconst IdentitySchema = Schema.Struct({\n identityKey: Schema.instanceOf(PublicKey),\n spaceKey: Schema.optional(Schema.instanceOf(PublicKey)),\n profile: Schema.optional(\n Schema.Struct({\n displayName: Schema.optional(Schema.String),\n avatarCid: Schema.optional(Schema.String),\n data: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),\n }),\n ),\n});\n\nconst CLIENT_ACTION = `${CLIENT_PLUGIN}/action`;\nexport namespace ClientAction {\n export class CreateIdentity extends Schema.TaggedClass<CreateIdentity>()(`${CLIENT_ACTION}/create-identity`, {\n input: Schema.Struct({\n displayName: Schema.optional(Schema.String),\n }),\n output: IdentitySchema,\n }) {}\n\n export class JoinIdentity extends Schema.TaggedClass<JoinIdentity>()(`${CLIENT_ACTION}/join-identity`, {\n input: Schema.Struct({\n invitationCode: Schema.optional(Schema.String),\n }),\n output: Schema.Void,\n }) {}\n\n export class ShareIdentity extends Schema.TaggedClass<ShareIdentity>()(`${CLIENT_ACTION}/share-identity`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n\n export class RecoverIdentity extends Schema.TaggedClass<RecoverIdentity>()(`${CLIENT_ACTION}/recover-identity`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n\n export class ResetStorage extends Schema.TaggedClass<ResetStorage>()(`${CLIENT_ACTION}/reset-storage`, {\n input: Schema.Struct({\n mode: Schema.optional(Schema.String),\n }),\n output: Schema.Void,\n }) {}\n\n export class CreateAgent extends Schema.TaggedClass<CreateAgent>()(`${CLIENT_ACTION}/create-agent`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n\n export class CreateRecoveryCode extends Schema.TaggedClass<CreateRecoveryCode>()(\n `${CLIENT_ACTION}/create-recovery-code`,\n {\n input: Schema.Void,\n output: Schema.Void,\n },\n ) {}\n\n export class CreatePasskey extends Schema.TaggedClass<CreatePasskey>()(`${CLIENT_ACTION}/create-passkey`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n\n export class RedeemPasskey extends Schema.TaggedClass<RedeemPasskey>()(`${CLIENT_ACTION}/redeem-passkey`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n\n export class RedeemToken extends Schema.TaggedClass<RedeemToken>()(`${CLIENT_ACTION}/redeem-token`, {\n input: Schema.Struct({\n token: Schema.String,\n }),\n output: Schema.Void,\n }) {}\n}\n\nexport type ClientPluginOptions = ClientOptions & {\n /**\n * Base URL for the invitation link.\n */\n invitationUrl?: string;\n\n /**\n * Query parameter for the invitation code.\n */\n invitationParam?: string;\n\n /**\n * Run after the client has been initialized.\n */\n onClientInitialized?: (context: PluginContext, client: Client) => MaybePromise<void>;\n\n /**\n * Called when the client is reset.\n */\n onReset?: (params: { target?: string }) => MaybePromise<void>;\n};\n\nexport namespace Account {\n // TODO(wittjosiah): Cannot use slashes in ids until we have a router which decouples ids from url paths.\n const _id = 'dxos.org.plugin.client.account';\n // TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.\n // Ideally this should be worked into the data model in a generic way.\n export const id = `!${_id}`;\n\n export const Profile = `${_id}.profile`;\n export const Devices = `${_id}.devices`;\n export const Security = `${_id}.security`;\n}\n"],
5
- "mappings": "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",
6
- "names": ["Schema", "PublicKey", "IdentitySchema", "Schema", "Struct", "identityKey", "instanceOf", "PublicKey", "spaceKey", "optional", "profile", "displayName", "String", "avatarCid", "data", "Record", "key", "value", "Any", "CLIENT_ACTION", "CLIENT_PLUGIN", "ClientAction", "CreateIdentity", "TaggedClass", "input", "output", "JoinIdentity", "invitationCode", "Void", "ShareIdentity", "RecoverIdentity", "ResetStorage", "mode", "CreateAgent", "CreateRecoveryCode", "CreatePasskey", "RedeemPasskey", "RedeemToken", "token", "Account", "_id", "id", "Profile", "Devices", "Security"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/client.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, type PluginContext } from '@dxos/app-framework';\nimport { Client } from '@dxos/react-client';\n\nimport { ClientCapabilities } from './capabilities';\nimport { ClientEvents } from '../events';\nimport { type ClientPluginOptions } from '../types';\n\ntype ClientCapabilityOptions = Omit<ClientPluginOptions, 'appKey' | 'invitationUrl' | 'invitationParam' | 'onReset'> & {\n context: PluginContext;\n};\n\nexport default async ({ context, onClientInitialized, ...options }: ClientCapabilityOptions) => {\n const client = new Client(options);\n await client.initialize();\n await onClientInitialized?.(context, client);\n\n // TODO(wittjosiah): Remove. This is a hack to get the app to boot with the new identity after a reset.\n client.reloaded.on(() => {\n client.halo.identity.subscribe(async (identity) => {\n if (identity) {\n window.location.href = window.location.origin;\n }\n });\n });\n\n const subscription = client.spaces.isReady.subscribe(async (ready) => {\n if (ready) {\n await context.activatePromise(ClientEvents.SpacesReady);\n }\n });\n\n return contributes(ClientCapabilities.Client, client, async () => {\n subscription.unsubscribe();\n await client.destroy();\n });\n};\n"],
5
- "mappings": ";;;;;;;;;AAIA,SAASA,mBAAuC;AAChD,SAASC,cAAc;AAUvB,IAAA,iBAAe,OAAO,EAAEC,SAASC,qBAAqB,GAAGC,QAAAA,MAAkC;AACzF,QAAMC,SAAS,IAAIC,OAAOF,OAAAA;AAC1B,QAAMC,OAAOE,WAAU;AACvB,QAAMJ,sBAAsBD,SAASG,MAAAA;AAGrCA,SAAOG,SAASC,GAAG,MAAA;AACjBJ,WAAOK,KAAKC,SAASC,UAAU,OAAOD,aAAAA;AACpC,UAAIA,UAAU;AACZE,eAAOC,SAASC,OAAOF,OAAOC,SAASE;MACzC;IACF,CAAA;EACF,CAAA;AAEA,QAAMC,eAAeZ,OAAOa,OAAOC,QAAQP,UAAU,OAAOQ,UAAAA;AAC1D,QAAIA,OAAO;AACT,YAAMlB,QAAQmB,gBAAgBC,aAAaC,WAAW;IACxD;EACF,CAAA;AAEA,SAAOC,YAAYC,mBAAmBnB,QAAQD,QAAQ,YAAA;AACpDY,iBAAaS,YAAW;AACxB,UAAMrB,OAAOsB,QAAO;EACtB,CAAA;AACF;",
6
- "names": ["contributes", "Client", "context", "onClientInitialized", "options", "client", "Client", "initialize", "reloaded", "on", "halo", "identity", "subscribe", "window", "location", "href", "origin", "subscription", "spaces", "isReady", "ready", "activatePromise", "ClientEvents", "SpacesReady", "contributes", "ClientCapabilities", "unsubscribe", "destroy"]
7
- }