@stream-io/video-react-bindings 0.2.33 → 0.2.35

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 (42) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/index.cjs.js +609 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.es.js +589 -0
  6. package/dist/index.es.js.map +1 -0
  7. package/dist/src/contexts/StreamI18nContext.d.ts +2 -2
  8. package/dist/src/i18n/StreamI18n.d.ts +29 -0
  9. package/dist/src/i18n/index.d.ts +3 -0
  10. package/dist/src/i18n/types.d.ts +7 -0
  11. package/dist/src/i18n/utils.d.ts +2 -0
  12. package/index.ts +2 -0
  13. package/package.json +13 -11
  14. package/src/contexts/StreamI18nContext.tsx +5 -3
  15. package/src/i18n/StreamI18n.ts +124 -0
  16. package/src/i18n/index.ts +3 -0
  17. package/src/i18n/types.ts +19 -0
  18. package/src/i18n/utils.ts +10 -0
  19. package/dist/index.js +0 -4
  20. package/dist/index.js.map +0 -1
  21. package/dist/src/contexts/StreamCallContext.js +0 -26
  22. package/dist/src/contexts/StreamCallContext.js.map +0 -1
  23. package/dist/src/contexts/StreamI18nContext.js +0 -40
  24. package/dist/src/contexts/StreamI18nContext.js.map +0 -1
  25. package/dist/src/contexts/StreamVideoContext.js +0 -23
  26. package/dist/src/contexts/StreamVideoContext.js.map +0 -1
  27. package/dist/src/contexts/index.js +0 -4
  28. package/dist/src/contexts/index.js.map +0 -1
  29. package/dist/src/hooks/callStateHooks.js +0 -311
  30. package/dist/src/hooks/callStateHooks.js.map +0 -1
  31. package/dist/src/hooks/index.js +0 -10
  32. package/dist/src/hooks/index.js.map +0 -1
  33. package/dist/src/hooks/permissions.js +0 -23
  34. package/dist/src/hooks/permissions.js.map +0 -1
  35. package/dist/src/hooks/store.js +0 -33
  36. package/dist/src/hooks/store.js.map +0 -1
  37. package/dist/src/hooks/useObservableValue.js +0 -17
  38. package/dist/src/hooks/useObservableValue.js.map +0 -1
  39. package/dist/src/wrappers/Restricted.js +0 -17
  40. package/dist/src/wrappers/Restricted.js.map +0 -1
  41. package/dist/src/wrappers/index.js +0 -2
  42. package/dist/src/wrappers/index.js.map +0 -1
@@ -1,311 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { CallState, } from '@stream-io/video-client';
3
- import { useCall } from '../contexts';
4
- import { useObservableValue } from './useObservableValue';
5
- /**
6
- * Utility hook, which provides the current call's state.
7
- *
8
- * @category Call State
9
- */
10
- export const useCallState = () => {
11
- const call = useCall();
12
- // return an empty and unlinked CallState object if there is no call in the provider
13
- // this ensures that the hooks always return a value and many null checks can be avoided
14
- if (!call) {
15
- const message = 'You are using useCallState() outside a Call context. ' +
16
- 'Please wrap your component in <StreamCall /> and provide a "call" instance.';
17
- console.warn(message);
18
- return new CallState();
19
- }
20
- return call.state;
21
- };
22
- /**
23
- * Utility hook which provides information whether the current call is being recorded. It will return `true` if the call is being recorded.
24
- *
25
- * @category Call State
26
- */
27
- export const useIsCallRecordingInProgress = () => {
28
- const { recording$ } = useCallState();
29
- return useObservableValue(recording$);
30
- };
31
- /**
32
- * Utility hook which provides information whether the current call is broadcasting.
33
- *
34
- * @category Call State
35
- */
36
- export const useIsCallBroadcastingInProgress = () => {
37
- const { egress$ } = useCallState();
38
- const egress = useObservableValue(egress$);
39
- if (!egress)
40
- return false;
41
- return egress.broadcasting;
42
- };
43
- /**
44
- * Utility hook which provides information whether the current call is live.
45
- *
46
- * @category Call State
47
- */
48
- export const useIsCallLive = () => {
49
- const { backstage$ } = useCallState();
50
- const isBackstageOn = useObservableValue(backstage$);
51
- return !isBackstageOn;
52
- };
53
- /**
54
- * Returns the list of blocked users in the current call.
55
- */
56
- export const useCallBlockedUserIds = () => {
57
- const { blockedUserIds$ } = useCallState();
58
- return useObservableValue(blockedUserIds$);
59
- };
60
- /**
61
- * Returns the timestamp when this call was created.
62
- */
63
- export const useCallCreatedAt = () => {
64
- const { createdAt$ } = useCallState();
65
- return useObservableValue(createdAt$);
66
- };
67
- /**
68
- * Returns the timestamp when this call was ended.
69
- */
70
- export const useCallEndedAt = () => {
71
- const { endedAt$ } = useCallState();
72
- return useObservableValue(endedAt$);
73
- };
74
- /**
75
- * Returns the timestamp telling when the call is scheduled to start.
76
- */
77
- export const useCallStartsAt = () => {
78
- const { startsAt$ } = useCallState();
79
- return useObservableValue(startsAt$);
80
- };
81
- /**
82
- * Returns the timestamp when this call was updated.
83
- */
84
- export const useCallUpdatedAt = () => {
85
- const { updatedAt$ } = useCallState();
86
- return useObservableValue(updatedAt$);
87
- };
88
- /**
89
- * Returns the information about the call's creator.
90
- */
91
- export const useCallCreatedBy = () => {
92
- const { createdBy$ } = useCallState();
93
- return useObservableValue(createdBy$);
94
- };
95
- /**
96
- * Returns the call's custom data.
97
- */
98
- export const useCallCustomData = () => {
99
- const { custom$ } = useCallState();
100
- return useObservableValue(custom$);
101
- };
102
- /**
103
- * Returns the call's Egress information.
104
- */
105
- export const useCallEgress = () => {
106
- const { egress$ } = useCallState();
107
- return useObservableValue(egress$);
108
- };
109
- /**
110
- * Returns the call's Ingress information.
111
- */
112
- export const useCallIngress = () => {
113
- const { ingress$ } = useCallState();
114
- return useObservableValue(ingress$);
115
- };
116
- /**
117
- * Returns the data for the current call session.
118
- */
119
- export const useCallSession = () => {
120
- const { session$ } = useCallState();
121
- return useObservableValue(session$);
122
- };
123
- /**
124
- * Returns the call's settings.
125
- */
126
- export const useCallSettings = () => {
127
- const { settings$ } = useCallState();
128
- return useObservableValue(settings$);
129
- };
130
- /**
131
- * Returns whether the call has transcribing enabled.
132
- */
133
- export const useIsCallTranscribingInProgress = () => {
134
- const { transcribing$ } = useCallState();
135
- return useObservableValue(transcribing$);
136
- };
137
- /**
138
- * Returns information about the user who has marked this call as ended.
139
- */
140
- export const useCallEndedBy = () => {
141
- const { endedBy$ } = useCallState();
142
- return useObservableValue(endedBy$);
143
- };
144
- /**
145
- * Utility hook which provides a boolean indicating whether there is
146
- * a participant in the current call which shares their screen.
147
- *
148
- * @category Call State
149
- */
150
- export const useHasOngoingScreenShare = () => {
151
- const { hasOngoingScreenShare$ } = useCallState();
152
- return useObservableValue(hasOngoingScreenShare$);
153
- };
154
- /**
155
- * Utility hook which provides the latest stats report of the current call.
156
- *
157
- * The latest stats report of the current call.
158
- * When stats gathering is enabled, this observable will emit a new value
159
- * at a regular (configurable) interval.
160
- *
161
- * Consumers of this observable can implement their own batching logic
162
- * in case they want to show historical stats data.
163
- *
164
- * @category Call State
165
- */
166
- export const useCallStatsReport = () => {
167
- const { callStatsReport$ } = useCallState();
168
- return useObservableValue(callStatsReport$);
169
- };
170
- /**
171
- * Utility hook which provides the dominant speaker of the current call.
172
- *
173
- * @category Call State
174
- */
175
- export const useDominantSpeaker = () => {
176
- const { dominantSpeaker$ } = useCallState();
177
- return useObservableValue(dominantSpeaker$);
178
- };
179
- /**
180
- * Utility hook which provides a list of call members.
181
- *
182
- * @category Call State
183
- */
184
- export const useCallMembers = () => {
185
- const { members$ } = useCallState();
186
- return useObservableValue(members$);
187
- };
188
- /**
189
- * Utility hook providing the current calling state of the call. For example, `RINGING` or `JOINED`.
190
- *
191
- * @category Call State
192
- */
193
- export const useCallCallingState = () => {
194
- const { callingState$ } = useCallState();
195
- return useObservableValue(callingState$);
196
- };
197
- /**
198
- * Utility hook providing the actual start time of the current session.
199
- * Useful for calculating the call duration.
200
- *
201
- * @category Call State
202
- */
203
- export const useCallStartedAt = () => {
204
- const { startedAt$ } = useCallState();
205
- return useObservableValue(startedAt$);
206
- };
207
- /**
208
- * A hook which provides a list of all participants that have joined an active call.
209
- *
210
- * @category Call State
211
- *
212
- * @param options.sortBy - A comparator function to sort the participants by.
213
- * Make sure to memoize output of the `combineComparators` function
214
- * (or keep it out of component's scope if possible) before passing it down to this property.
215
- */
216
- export const useParticipants = ({ sortBy, } = {}) => {
217
- const { participants$ } = useCallState();
218
- const participants = useObservableValue(participants$);
219
- return useMemo(() => {
220
- if (sortBy) {
221
- return [...participants].sort(sortBy);
222
- }
223
- return participants;
224
- }, [participants, sortBy]);
225
- };
226
- /**
227
- * A hook which provides a StreamVideoLocalParticipant object.
228
- * It signals that I have joined a call.
229
- *
230
- * @category Call State
231
- */
232
- export const useLocalParticipant = () => {
233
- const { localParticipant$ } = useCallState();
234
- return useObservableValue(localParticipant$);
235
- };
236
- /**
237
- * A hook which provides a list of all other participants than me that have joined an active call.
238
- *
239
- * @category Call State
240
- */
241
- export const useRemoteParticipants = () => {
242
- const { remoteParticipants$ } = useCallState();
243
- return useObservableValue(remoteParticipants$);
244
- };
245
- /**
246
- * Returns the approximate participant count of the active call.
247
- * This includes the anonymous users as well, and it is computed on the server.
248
- *
249
- * @category Call State
250
- */
251
- export const useParticipantCount = () => {
252
- const { participantCount$ } = useCallState();
253
- return useObservableValue(participantCount$);
254
- };
255
- /**
256
- * Returns the approximate anonymous participant count of the active call.
257
- * The regular participants are not included in this count. It is computed on the server.
258
- *
259
- * @category Call State
260
- */
261
- export const useAnonymousParticipantCount = () => {
262
- const { anonymousParticipantCount$ } = useCallState();
263
- return useObservableValue(anonymousParticipantCount$);
264
- };
265
- /**
266
- * Returns the generated thumbnail of the current call, if enabled in settings.
267
- */
268
- export const useCallThumbnail = () => {
269
- const { thumbnails$ } = useCallState();
270
- return useObservableValue(thumbnails$);
271
- };
272
- /**
273
- * Returns the camera state of the current call.
274
- *
275
- * @category Camera Manager State
276
- *
277
- */
278
- export const useCameraState = () => {
279
- const call = useCall();
280
- const { camera } = call;
281
- const status = useObservableValue(camera.state.status$);
282
- const direction = useObservableValue(camera.state.direction$);
283
- return {
284
- status,
285
- direction,
286
- };
287
- };
288
- /**
289
- * Returns the microphone state of the current call.
290
- *
291
- * @category Microphone Manager State
292
- */
293
- export const useMicrophoneState = () => {
294
- const call = useCall();
295
- const { microphone } = call;
296
- const status = useObservableValue(microphone.state.status$);
297
- const selectedDevice = useObservableValue(microphone.state.selectedDevice$);
298
- return {
299
- status,
300
- selectedDevice,
301
- };
302
- };
303
- export const useScreenShareState = () => {
304
- const call = useCall();
305
- const { screenShare } = call;
306
- const status = useObservableValue(screenShare.state.status$);
307
- return {
308
- status,
309
- };
310
- };
311
- //# sourceMappingURL=callStateHooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callStateHooks.js","sourceRoot":"","sources":["../../../src/hooks/callStateHooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAKL,SAAS,GAOV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE;IAC/B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,oFAAoF;IACpF,wFAAwF;IACxF,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,OAAO,GACX,uDAAuD;YACvD,6EAA6E,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,OAAO,IAAI,SAAS,EAAE,CAAC;KACxB;IACD,OAAO,IAAI,CAAC,KAAK,CAAC;AACpB,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAAY,EAAE;IACxD,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,EAAE,CAAC;IACtC,OAAO,kBAAkB,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAY,EAAE;IAC3D,MAAM,EAAE,OAAO,EAAE,GAAG,YAAY,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,OA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"}
@@ -1,10 +0,0 @@
1
- import * as CallStateHooks from './callStateHooks';
2
- export * from './permissions';
3
- export * from './store';
4
- /**
5
- * A hook-alike function that exposes all call state hooks.
6
- *
7
- * @category Call State
8
- */
9
- export const useCallStateHooks = () => CallStateHooks;
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE,CAAC,cAAc,CAAC"}
@@ -1,23 +0,0 @@
1
- import { useCallState } from './callStateHooks';
2
- import { useObservableValue } from './useObservableValue';
3
- /**
4
- * Hook that returns true if the local participant has all the given permissions.
5
- *
6
- * @param permissions the permissions to check.
7
- *
8
- * @category Call State
9
- */
10
- export const useHasPermissions = (...permissions) => {
11
- const capabilities = useOwnCapabilities();
12
- return permissions.every((permission) => capabilities === null || capabilities === void 0 ? void 0 : capabilities.includes(permission));
13
- };
14
- /**
15
- * A hook which returns the local participant's own capabilities.
16
- *
17
- * @category Call State
18
- */
19
- export const useOwnCapabilities = () => {
20
- const { ownCapabilities$ } = useCallState();
21
- return useObservableValue(ownCapabilities$);
22
- };
23
- //# sourceMappingURL=permissions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/hooks/permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,WAA4B,EAAW,EAAE;IAC5E,MAAM,YAAY,GAAG,kBAAkB,EAAE,CAAC;IAC1C,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;AAC/E,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAgC,EAAE;IAClE,MAAM,EAAE,gBAAgB,EAAE,GAAG,YAAY,EAAE,CAAC;IAC5C,OAAO,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;AAC9C,CAAC,CAAC"}
@@ -1,33 +0,0 @@
1
- import { useStreamVideoClient } from '../contexts';
2
- import { useObservableValue } from './useObservableValue';
3
- /**
4
- * Utility hook which provides access to client's state store.
5
- */
6
- export const useStore = () => {
7
- const client = useStreamVideoClient();
8
- if (!client) {
9
- throw new Error(`StreamVideoClient isn't initialized or this hook is called outside of <StreamVideo> context.`);
10
- }
11
- return client.readOnlyStateStore;
12
- };
13
- /**
14
- * Utility hook which provides a list of all notifications about created calls.
15
- * In the ring call settings, these calls can be outgoing (I have called somebody)
16
- * or incoming (somebody has called me).
17
- *
18
- * @category Client State
19
- */
20
- export const useCalls = () => {
21
- const { calls$ } = useStore();
22
- return useObservableValue(calls$);
23
- };
24
- /**
25
- * Returns the current connected user.
26
- *
27
- * @category Client State
28
- */
29
- export const useConnectedUser = () => {
30
- const { connectedUser$ } = useStore();
31
- return useObservableValue(connectedUser$);
32
- };
33
- //# sourceMappingURL=store.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../src/hooks/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACtC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CACb,8FAA8F,CAC/F,CAAC;KACH;IACD,OAAO,MAAM,CAAC,kBAAkB,CAAC;AACnC,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC9B,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,EAAE,cAAc,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtC,OAAO,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAC5C,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { useEffect, useState } from 'react';
2
- import { RxUtils } from '@stream-io/video-client';
3
- /**
4
- * Utility hook which provides the current value of the given observable.
5
- * @internal
6
- */
7
- export const useObservableValue = (observable$) => {
8
- const [value, setValue] = useState(() => RxUtils.getCurrentValue(observable$));
9
- useEffect(() => {
10
- const subscription = observable$.subscribe(setValue);
11
- return () => {
12
- subscription.unsubscribe();
13
- };
14
- }, [observable$]);
15
- return value;
16
- };
17
- //# sourceMappingURL=useObservableValue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useObservableValue.js","sourceRoot":"","sources":["../../../src/hooks/useObservableValue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAI,WAA0B,EAAE,EAAE;IAClE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAI,GAAG,EAAE,CACzC,OAAO,CAAC,eAAe,CAAC,WAAW,CAAC,CACrC,CAAC;IACF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACrD,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
@@ -1,17 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import { useCall } from '../contexts';
3
- import { useOwnCapabilities } from '../hooks';
4
- export const Restricted = ({ canRequestOnly, hasPermissionsOnly, requiredGrants, requireAll = true, children, }) => {
5
- const call = useCall();
6
- const ownCapabilities = useOwnCapabilities();
7
- const hasPermissions = requiredGrants[requireAll ? 'every' : 'some']((capability) => ownCapabilities === null || ownCapabilities === void 0 ? void 0 : ownCapabilities.includes(capability));
8
- if (hasPermissionsOnly)
9
- return hasPermissions ? _jsx(_Fragment, { children: children }) : null;
10
- const canRequest = requiredGrants.some((capability) => !!call && call.permissionsContext.canRequest(capability));
11
- if (canRequestOnly)
12
- return canRequest ? _jsx(_Fragment, { children: children }) : null;
13
- if (hasPermissions || canRequest)
14
- return _jsx(_Fragment, { children: children });
15
- return null;
16
- };
17
- //# sourceMappingURL=Restricted.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Restricted.js","sourceRoot":"","sources":["../../../src/wrappers/Restricted.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAsB9C,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EACzB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,UAAU,GAAG,IAAI,EACjB,QAAQ,GACQ,EAAE,EAAE;IACpB,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;IAC7C,MAAM,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAClE,CAAC,UAAU,EAAE,EAAE,CAAC,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,CAAC,UAAU,CAAC,CACtD,CAAC;IAEF,IAAI,kBAAkB;QAAE,OAAO,cAAc,CAAC,CAAC,CAAC,4BAAG,QAAQ,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAEvE,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CACpC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CACzE,CAAC;IAEF,IAAI,cAAc;QAAE,OAAO,UAAU,CAAC,CAAC,CAAC,4BAAG,QAAQ,GAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAE/D,IAAI,cAAc,IAAI,UAAU;QAAE,OAAO,4BAAG,QAAQ,GAAI,CAAC;IAEzD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './Restricted';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/wrappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}