@interface-db/react-native 1.0.67

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 (84) hide show
  1. package/LICENSE.md +202 -0
  2. package/NOTICE +4 -0
  3. package/README.md +46 -0
  4. package/dist/EventSourceImpl.d.ts +10 -0
  5. package/dist/EventSourceImpl.d.ts.map +1 -0
  6. package/dist/EventSourceImpl.js +9 -0
  7. package/dist/EventSourceImpl.js.map +1 -0
  8. package/dist/EventSourceShim.d.ts +31 -0
  9. package/dist/EventSourceShim.d.ts.map +1 -0
  10. package/dist/EventSourceShim.js +228 -0
  11. package/dist/EventSourceShim.js.map +1 -0
  12. package/dist/NetworkListener.d.ts +5 -0
  13. package/dist/NetworkListener.d.ts.map +1 -0
  14. package/dist/NetworkListener.js +19 -0
  15. package/dist/NetworkListener.js.map +1 -0
  16. package/dist/Storage.d.ts +3 -0
  17. package/dist/Storage.d.ts.map +1 -0
  18. package/dist/Storage.js +5 -0
  19. package/dist/Storage.js.map +1 -0
  20. package/dist/Storage.native.d.ts +22 -0
  21. package/dist/Storage.native.d.ts.map +1 -0
  22. package/dist/Storage.native.js +79 -0
  23. package/dist/Storage.native.js.map +1 -0
  24. package/dist/Streams.d.ts +15 -0
  25. package/dist/Streams.d.ts.map +1 -0
  26. package/dist/Streams.js +9 -0
  27. package/dist/Streams.js.map +1 -0
  28. package/dist/Streams.native.d.ts +6 -0
  29. package/dist/Streams.native.d.ts.map +1 -0
  30. package/dist/Streams.native.js +9 -0
  31. package/dist/Streams.native.js.map +1 -0
  32. package/dist/cli.d.ts +2 -0
  33. package/dist/cli.d.ts.map +1 -0
  34. package/dist/cli.js +18 -0
  35. package/dist/cli.js.map +1 -0
  36. package/dist/index.d.ts +56 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/index.js +87 -0
  39. package/dist/index.js.map +1 -0
  40. package/dist/module/EventSourceImpl.d.ts +10 -0
  41. package/dist/module/EventSourceImpl.d.ts.map +1 -0
  42. package/dist/module/EventSourceImpl.js +4 -0
  43. package/dist/module/EventSourceImpl.js.map +1 -0
  44. package/dist/module/EventSourceShim.d.ts +31 -0
  45. package/dist/module/EventSourceShim.d.ts.map +1 -0
  46. package/dist/module/EventSourceShim.js +226 -0
  47. package/dist/module/EventSourceShim.js.map +1 -0
  48. package/dist/module/NetworkListener.d.ts +5 -0
  49. package/dist/module/NetworkListener.d.ts.map +1 -0
  50. package/dist/module/NetworkListener.js +13 -0
  51. package/dist/module/NetworkListener.js.map +1 -0
  52. package/dist/module/Storage.d.ts +3 -0
  53. package/dist/module/Storage.d.ts.map +1 -0
  54. package/dist/module/Storage.js +3 -0
  55. package/dist/module/Storage.js.map +1 -0
  56. package/dist/module/Storage.native.d.ts +22 -0
  57. package/dist/module/Storage.native.d.ts.map +1 -0
  58. package/dist/module/Storage.native.js +75 -0
  59. package/dist/module/Storage.native.js.map +1 -0
  60. package/dist/module/Streams.d.ts +15 -0
  61. package/dist/module/Streams.d.ts.map +1 -0
  62. package/dist/module/Streams.js +6 -0
  63. package/dist/module/Streams.js.map +1 -0
  64. package/dist/module/Streams.native.d.ts +6 -0
  65. package/dist/module/Streams.native.d.ts.map +1 -0
  66. package/dist/module/Streams.native.js +6 -0
  67. package/dist/module/Streams.native.js.map +1 -0
  68. package/dist/module/cli.d.ts +2 -0
  69. package/dist/module/cli.d.ts.map +1 -0
  70. package/dist/module/cli.js +2 -0
  71. package/dist/module/cli.js.map +1 -0
  72. package/dist/module/index.d.ts +56 -0
  73. package/dist/module/index.d.ts.map +1 -0
  74. package/dist/module/index.js +76 -0
  75. package/dist/module/index.js.map +1 -0
  76. package/dist/module/version.d.ts +3 -0
  77. package/dist/module/version.d.ts.map +1 -0
  78. package/dist/module/version.js +3 -0
  79. package/dist/module/version.js.map +1 -0
  80. package/dist/version.d.ts +3 -0
  81. package/dist/version.d.ts.map +1 -0
  82. package/dist/version.js +5 -0
  83. package/dist/version.js.map +1 -0
  84. package/package.json +65 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Storage.native.d.ts","sourceRoot":"","sources":["../src/Storage.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAkB7E,qBAAa,iBAAkB,SAAQ,cAAc;IACnD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAA0B;gBAC5B,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,uBAAuB;IAM1D,OAAO,CAAC,OAAO;IAIT,OAAO,CAAC,CAAC,KAAA;IAMT,OAAO,CAAC,CAAC,KAAA,EAAE,CAAC,KAAA;IAIZ,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAY/B,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAKnE;AAED,cAAM,YAAa,SAAQ,cAAc;gBAC3B,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,uBAAuB;IAYpD,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAIjC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAErC,QAAQ,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAE7D,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;CAGtC;;AAED,wBAA+D"}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AsyncStorageStore = void 0;
4
+ const core_1 = require("@interface-db/core");
5
+ const version = 5;
6
+ // AsyncStorage is an optional peer dependency. The `require` must sit
7
+ // directly inside a `try` block: that's what makes Metro treat it as an
8
+ // optional dependency (`transformer.allowOptionalDependencies`, enabled by
9
+ // default in the Expo and React Native metro configs), so bundling doesn't
10
+ // fail when it isn't installed. When it can't be loaded, `init` surfaces a
11
+ // helpful error unless a custom `Store` is passed.
12
+ let AsyncStorage = null;
13
+ let asyncStorageLoadError = null;
14
+ try {
15
+ AsyncStorage = require('@react-native-async-storage/async-storage').default;
16
+ }
17
+ catch (e) {
18
+ asyncStorageLoadError = e;
19
+ }
20
+ class AsyncStorageStore extends core_1.StoreInterface {
21
+ appId;
22
+ dbName;
23
+ constructor(appId, dbName) {
24
+ super(appId, dbName);
25
+ this.appId = appId;
26
+ this.dbName = dbName;
27
+ }
28
+ makeKey(k) {
29
+ return `instant_${this.appId}_${version}_${this.dbName}_${k}`;
30
+ }
31
+ async getItem(k) {
32
+ const res = await AsyncStorage.getItem(this.makeKey(k));
33
+ if (res === null)
34
+ return res;
35
+ return JSON.parse(res);
36
+ }
37
+ async setItem(k, v) {
38
+ await AsyncStorage.setItem(this.makeKey(k), JSON.stringify(v));
39
+ }
40
+ async removeItem(k) {
41
+ await AsyncStorage.removeItem(this.makeKey(k));
42
+ }
43
+ async getAllKeys() {
44
+ const allKeys = await AsyncStorage.getAllKeys();
45
+ const keys = [];
46
+ const keyPrefix = this.makeKey('');
47
+ for (const key of allKeys) {
48
+ if (key.startsWith(keyPrefix)) {
49
+ keys.push(key.substring(keyPrefix.length));
50
+ }
51
+ }
52
+ return keys;
53
+ }
54
+ async multiSet(keyValuePairs) {
55
+ await AsyncStorage.multiSet(keyValuePairs.map(([k, v]) => [this.makeKey(k), JSON.stringify(v)]));
56
+ }
57
+ }
58
+ exports.AsyncStorageStore = AsyncStorageStore;
59
+ class MissingStore extends core_1.StoreInterface {
60
+ constructor(appId, dbName) {
61
+ super(appId, dbName);
62
+ throw new Error('Instant needs a store to persist data on device. ' +
63
+ 'Install `@react-native-async-storage/async-storage`, ' +
64
+ 'or pass a `Store` to `init` (e.g. from `@interface-db/react-native-mmkv` or `@interface-db/expo-sqlite`).' +
65
+ (asyncStorageLoadError
66
+ ? `\n\nLoading async-storage failed with: ${asyncStorageLoadError}`
67
+ : ''));
68
+ }
69
+ async getItem(_k) {
70
+ return null;
71
+ }
72
+ async removeItem(_k) { }
73
+ async multiSet(_keyValuePairs) { }
74
+ async getAllKeys() {
75
+ return [];
76
+ }
77
+ }
78
+ exports.default = AsyncStorage ? AsyncStorageStore : MissingStore;
79
+ //# sourceMappingURL=Storage.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Storage.native.js","sourceRoot":"","sources":["../src/Storage.native.ts"],"names":[],"mappings":";;;AAAA,6CAA6E;AAE7E,MAAM,OAAO,GAAG,CAAC,CAAC;AAElB,sEAAsE;AACtE,wEAAwE;AACxE,2EAA2E;AAC3E,2EAA2E;AAC3E,2EAA2E;AAC3E,mDAAmD;AACnD,IAAI,YAAY,GAAQ,IAAI,CAAC;AAC7B,IAAI,qBAAqB,GAAY,IAAI,CAAC;AAC1C,IAAI,CAAC;IACH,YAAY,GAAG,OAAO,CAAC,2CAA2C,CAAC,CAAC,OAAO,CAAC;AAC9E,CAAC;AAAC,OAAO,CAAC,EAAE,CAAC;IACX,qBAAqB,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,MAAa,iBAAkB,SAAQ,qBAAc;IAC3C,KAAK,CAAS;IACd,MAAM,CAA0B;IACxC,YAAY,KAAa,EAAE,MAA+B;QACxD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,OAAO,CAAC,CAAS;QACvB,OAAO,WAAW,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,CAAC;QACb,MAAM,GAAG,GAAG,MAAM,YAAY,C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,8CA4CC;AAED,MAAM,YAAa,SAAQ,qBAAc;IACvC,YAAY,KAAa,EAAE,MAA+B;QACxD,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,mDAAmD;YACjD,uDAAuD;YACvD,2GAA2G;YAC3G,CAAC,qBAAqB;gBACpB,CAAC,CAAC,0CAA0C,qBAAqB,EAAE;gBACnE,CAAC,CAAC,EAAE,CAAC,CACV,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,EAAU,IAAkB,CAAC;IAE9C,KAAK,CAAC,QAAQ,CAAC,cAAoC,IAAkB,CAAC;IAEtE,KAAK,CAAC,UAAU;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAED,kBAAe,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC","sourcesContent":["import { StoreInterface, StoreInterfaceStoreName } from '@interface-db/core';\n\nconst version = 5;\n\n// AsyncStorage is an optional peer dependency. The `require` must sit\n// directly inside a `try` block: that's what makes Metro treat it as an\n// optional dependency (`transformer.allowOptionalDependencies`, enabled by\n// default in the Expo and React Native metro configs), so bundling doesn't\n// fail when it isn't installed. When it can't be loaded, `init` surfaces a\n// helpful error unless a custom `Store` is passed.\nlet AsyncStorage: any = null;\nlet asyncStorageLoadError: unknown = null;\ntry {\n AsyncStorage = require('@react-native-async-storage/async-storage').default;\n} catch (e) {\n asyncStorageLoadError = e;\n}\n\nexport class AsyncStorageStore extends StoreInterface {\n private appId: string;\n private dbName: StoreInterfaceStoreName;\n constructor(appId: string, dbName: StoreInterfaceStoreName) {\n super(appId, dbName);\n this.appId = appId;\n this.dbName = dbName;\n }\n\n private makeKey(k: string): string {\n return `instant_${this.appId}_${version}_${this.dbName}_${k}`;\n }\n\n async getItem(k) {\n const res = await AsyncStorage.getItem(this.makeKey(k));\n if (res === null) return res;\n return JSON.parse(res);\n }\n\n async setItem(k, v) {\n await AsyncStorage.setItem(this.makeKey(k), JSON.stringify(v));\n }\n\n async removeItem(k: string): Promise<void> {\n await AsyncStorage.removeItem(this.makeKey(k));\n }\n\n async getAllKeys(): Promise<string[]> {\n const allKeys = await AsyncStorage.getAllKeys();\n const keys: string[] = [];\n const keyPrefix = this.makeKey('');\n for (const key of allKeys) {\n if (key.startsWith(keyPrefix)) {\n keys.push(key.substring(keyPrefix.length));\n }\n }\n return keys;\n }\n\n async multiSet(keyValuePairs: Array<[string, any]>): Promise<void> {\n await AsyncStorage.multiSet(\n keyValuePairs.map(([k, v]) => [this.makeKey(k), JSON.stringify(v)]),\n );\n }\n}\n\nclass MissingStore extends StoreInterface {\n constructor(appId: string, dbName: StoreInterfaceStoreName) {\n super(appId, dbName);\n throw new Error(\n 'Instant needs a store to persist data on device. ' +\n 'Install `@react-native-async-storage/async-storage`, ' +\n 'or pass a `Store` to `init` (e.g. from `@interface-db/react-native-mmkv` or `@interface-db/expo-sqlite`).' +\n (asyncStorageLoadError\n ? `\\n\\nLoading async-storage failed with: ${asyncStorageLoadError}`\n : ''),\n );\n }\n\n async getItem(_k: string): Promise<any> {\n return null;\n }\n\n async removeItem(_k: string): Promise<void> {}\n\n async multiSet(_keyValuePairs: Array<[string, any]>): Promise<void> {}\n\n async getAllKeys(): Promise<string[]> {\n return [];\n }\n}\n\nexport default AsyncStorage ? AsyncStorageStore : MissingStore;\n"]}
@@ -0,0 +1,15 @@
1
+ export declare const streamConstructors: {
2
+ ReadableStream: {
3
+ new (underlyingSource: UnderlyingByteSource, strategy?: {
4
+ highWaterMark?: number;
5
+ }): ReadableStream<Uint8Array<ArrayBuffer>>;
6
+ new <R = any>(underlyingSource: UnderlyingDefaultSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
7
+ new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
8
+ prototype: ReadableStream;
9
+ };
10
+ WritableStream: {
11
+ new <W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
12
+ prototype: WritableStream;
13
+ };
14
+ };
15
+ //# sourceMappingURL=Streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Streams.d.ts","sourceRoot":"","sources":["../src/Streams.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB;;;yBAIgn5oC,CAAC;;;;;;;;;;CAD/o5oC,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.streamConstructors = void 0;
4
+ // RN may need a polyfill for streams, so we put those in Streams.native.ts
5
+ exports.streamConstructors = {
6
+ ReadableStream: ReadableStream,
7
+ WritableStream: WritableStream,
8
+ };
9
+ //# sourceMappingURL=Streams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Streams.js","sourceRoot":"","sources":["../src/Streams.ts"],"names":[],"mappings":";;;AAAA,2EAA2E;AAC9D,QAAA,kBAAkB,GAAG;IAChC,cAAc,EAAE,cAAc;IAC9B,cAAc,EAAE,cAAc;CAC/B,CAAC","sourcesContent":["// RN may need a polyfill for streams, so we put those in Streams.native.ts\nexport const streamConstructors = {\n ReadableStream: ReadableStream,\n WritableStream: WritableStream,\n};\n"]}
@@ -0,0 +1,6 @@
1
+ import { ReadableStream, WritableStream } from 'web-streams-polyfill';
2
+ export declare const streamConstructors: {
3
+ ReadableStream: typeof ReadableStream;
4
+ WritableStream: typeof WritableStream;
5
+ };
6
+ //# sourceMappingURL=Streams.native.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Streams.native.d.ts","sourceRoot":"","sources":["../src/Streams.native.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtE,eAAO,MAAM,kBAAkB;;;CAG9B,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.streamConstructors = void 0;
4
+ const web_streams_polyfill_1 = require("web-streams-polyfill");
5
+ exports.streamConstructors = {
6
+ ReadableStream: web_streams_polyfill_1.ReadableStream,
7
+ WritableStream: web_streams_polyfill_1.WritableStream,
8
+ };
9
+ //# sourceMappingURL=Streams.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Streams.native.js","sourceRoot":"","sources":["../src/Streams.native.ts"],"names":[],"mappings":";;;AAAA,+DAAsE;AAEzD,QAAA,kBAAkB,GAAG;IAChC,cAAc,EAAE,qCAAc;IAC9B,cAAc,EAAE,qCAAc;CAC/B,CAAC","sourcesContent":["import { ReadableStream, WritableStream } from 'web-streams-polyfill';\n\nexport const streamConstructors = {\n ReadableStream: ReadableStream,\n WritableStream: WritableStream,\n};\n"]}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from '@interface-db/core';
2
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
package/dist/cli.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("@interface-db/core"), exports);
18
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC","sourcesContent":["export * from '@interface-db/core';\n"]}
@@ -0,0 +1,56 @@
1
+ import 'react-native-get-random-values';
2
+ import Store from './Storage';
3
+ import NetworkListener from './NetworkListener';
4
+ import { InstantReactAbstractDatabase } from '@interface-db/react-common';
5
+ import { i, id, tx, lookup, InstantAPIError, setInstantWarningsEnabled, SyncTableCallbackEventType, createInstantRouteHandler, type RoomSchemaShape, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantSchemaDatabase, type ConnectionStatus, type BackwardsCompatibleSchema, type IInstantDatabase, type Config, type Query, type QueryResponse, type InstantObject, type AuthState, type User, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type InstantUnknownSchemaDef, type LinkAttrDef, type LinkDef, type LinksDef, type ResolveAttrs, type ValueTypes, type InstantEntity, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type RoomsOf, type RoomsDef, type PresenceOf, type TopicsOf, type TopicOf, type RoomHandle, type CreateParams, type InstantConfig, type InstantSchemaDef, type InstantUnknownSchema, type TransactionChunk, type InstantRules, type UpdateParams, type LinkParams, type ValidQuery, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, StoreInterface, type StoreInterfaceStoreName, CreateReadStreamOpts, CreateWriteStreamOpts, InstantWritableStream, InstantReadableStream, type Logger } from '@interface-db/core';
6
+ /**
7
+ *
8
+ * The first step: init your application!
9
+ *
10
+ * Visit https://interfacedb.com/dash to get your `appId` :)
11
+ *
12
+ * @example
13
+ * import { init } from "@interface-db/react-native"
14
+ *
15
+ * const db = init({ appId: "my-app-id" })
16
+ *
17
+ * // You can also provide a schema for type safety and editor autocomplete!
18
+ *
19
+ * import { init } from "@interface-db/react-native"
20
+ * import schema from ""../instant.schema.ts";
21
+ *
22
+ * const db = init({ appId: "my-app-id", schema })
23
+ *
24
+ * // To learn more: https://interfacedb.com/docs/modeling-data
25
+ */
26
+ declare function init<Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema, UseDates extends boolean = false>(config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {
27
+ useDateObjects?: UseDates;
28
+ }): InstantReactNativeDatabase<Schema, UseDates, InstantConfig<Schema, UseDates>>;
29
+ /**
30
+ * @deprecated
31
+ * `init_experimental` is deprecated. You can replace it with `init`.
32
+ *
33
+ * @example
34
+ *
35
+ * // Before
36
+ * import { init_experimental } from "@interface-db/react-native"
37
+ * const db = init_experimental({ ... });
38
+ *
39
+ * // After
40
+ * import { init } from "@interface-db/react-native"
41
+ * const db = init({ ... });
42
+ */
43
+ declare const init_experimental: typeof init;
44
+ declare class InstantReactNativeDatabase<Schema extends InstantSchemaDef<any, any, any>, UseDates extends boolean, Config extends InstantConfig<Schema, UseDates> = InstantConfig<Schema, UseDates>> extends InstantReactAbstractDatabase<Schema, UseDates, Config> {
45
+ static Store: typeof Store;
46
+ static NetworkListener: typeof NetworkListener;
47
+ static EventSourceImpl: {
48
+ new (url: string | URL, eventSourceInitDict?: EventSourceInit): EventSource;
49
+ prototype: EventSource;
50
+ readonly CONNECTING: 0;
51
+ readonly OPEN: 1;
52
+ readonly CLOSED: 2;
53
+ } | typeof import("./EventSourceShim").default;
54
+ }
55
+ export { init, init_experimental, id, tx, lookup, i, createInstantRouteHandler, InstantReactNativeDatabase, InstantAPIError, setInstantWarningsEnabled, SyncTableCallbackEventType, type Config, type Query, type QueryResponse, type InstantObject, type User, type AuthState, type ConnectionStatus, type InstantQuery, type InstantQueryResult, type InstantSchema, type InstantSchemaDatabase, type IInstantDatabase, type InstantEntity, type RoomSchemaShape, type PresencePeer, type AttrsDefs, type CardinalityKind, type DataAttrDef, type EntitiesDef, type EntitiesWithLinks, type EntityDef, type InstantGraph, type CreateParams, type LinkAttrDef, type InstantConfig, type LinkDef, type InstantUnknownSchemaDef, type LinksDef, type RoomsOf, type RoomsDef, type RoomHandle, type PresenceOf, type TopicsOf, type TopicOf, type ResolveAttrs, type ValueTypes, type InstaQLEntity, type InstaQLResult, type InstaQLEntitySubquery, type InstantSchemaDef, type InstantUnknownSchema, type BackwardsCompatibleSchema, type InstantRules, type UpdateParams, type LinkParams, type ValidQuery, type CheckMagicCodeParams, type CheckMagicCodeResponse, type ExchangeCodeForTokenParams, type SendMagicCodeParams, type TransactionChunk, type SendMagicCodeResponse, type SignInWithIdTokenParams, type VerifyMagicCodeParams, type VerifyResponse, type FileOpts, type UploadFileResponse, type DeleteFileResponse, type CreateReadStreamOpts, type CreateWriteStreamOpts, type InstantWritableStream, type InstantReadableStream, StoreInterface, type StoreInterfaceStoreName, type SyncTableCallback, type SyncTableCallbackEvent, type SyncTableInitialSyncBatch, type SyncTableInitialSyncComplete, type SyncTableSyncTransaction, type SyncTableLoadFromStorage, type SyncTableSetupError, type Logger, };
56
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,MAAM,WAAW,CAAC;AAE9B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE1E,OAAO,EACL,CAAC,EACD,EAAE,EACF,EAAE,EAC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AAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EAGxB,KAAK,MAAM,GACZ,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.StoreInterface = exports.SyncTableCallbackEventType = exports.setInstantWarningsEnabled = exports.InstantAPIError = exports.InstantReactNativeDatabase = exports.createInstantRouteHandler = exports.i = exports.lookup = exports.tx = exports.id = exports.init_experimental = void 0;
7
+ exports.init = init;
8
+ require("react-native-get-random-values");
9
+ const Storage_1 = __importDefault(require("./Storage"));
10
+ const EventSourceImpl_1 = __importDefault(require("./EventSourceImpl"));
11
+ const NetworkListener_1 = __importDefault(require("./NetworkListener"));
12
+ const version_1 = __importDefault(require("./version"));
13
+ const Streams_1 = require("./Streams");
14
+ const react_common_1 = require("@interface-db/react-common");
15
+ const core_1 = require("@interface-db/core");
16
+ Object.defineProperty(exports, "i", { enumerable: true, get: function () { return core_1.i; } });
17
+ Object.defineProperty(exports, "id", { enumerable: true, get: function () { return core_1.id; } });
18
+ Object.defineProperty(exports, "tx", { enumerable: true, get: function () { return core_1.tx; } });
19
+ Object.defineProperty(exports, "lookup", { enumerable: true, get: function () { return core_1.lookup; } });
20
+ Object.defineProperty(exports, "InstantAPIError", { enumerable: true, get: function () { return
21
+ // error
22
+ core_1.InstantAPIError; } });
23
+ Object.defineProperty(exports, "setInstantWarningsEnabled", { enumerable: true, get: function () { return core_1.setInstantWarningsEnabled; } });
24
+ Object.defineProperty(exports, "SyncTableCallbackEventType", { enumerable: true, get: function () { return
25
+ // sync table enums
26
+ core_1.SyncTableCallbackEventType; } });
27
+ Object.defineProperty(exports, "createInstantRouteHandler", { enumerable: true, get: function () { return
28
+ // types
29
+ core_1.createInstantRouteHandler; } });
30
+ Object.defineProperty(exports, "StoreInterface", { enumerable: true, get: function () { return core_1.StoreInterface; } });
31
+ /**
32
+ *
33
+ * The first step: init your application!
34
+ *
35
+ * Visit https://interfacedb.com/dash to get your `appId` :)
36
+ *
37
+ * @example
38
+ * import { init } from "@interface-db/react-native"
39
+ *
40
+ * const db = init({ appId: "my-app-id" })
41
+ *
42
+ * // You can also provide a schema for type safety and editor autocomplete!
43
+ *
44
+ * import { init } from "@interface-db/react-native"
45
+ * import schema from ""../instant.schema.ts";
46
+ *
47
+ * const db = init({ appId: "my-app-id", schema })
48
+ *
49
+ * // To learn more: https://interfacedb.com/docs/modeling-data
50
+ */
51
+ function init(
52
+ // Allows config with missing `useDateObjects`, but keeps `UseDates`
53
+ // as a non-nullable in the InstantConfig type.
54
+ config) {
55
+ const configStrict = {
56
+ ReadableStream: Streams_1.streamConstructors.ReadableStream,
57
+ WritableStream: Streams_1.streamConstructors.WritableStream,
58
+ ...config,
59
+ useDateObjects: (config.useDateObjects ?? false),
60
+ };
61
+ return new InstantReactNativeDatabase(configStrict, {
62
+ '@instantdb/react': version_1.default,
63
+ });
64
+ }
65
+ /**
66
+ * @deprecated
67
+ * `init_experimental` is deprecated. You can replace it with `init`.
68
+ *
69
+ * @example
70
+ *
71
+ * // Before
72
+ * import { init_experimental } from "@interface-db/react-native"
73
+ * const db = init_experimental({ ... });
74
+ *
75
+ * // After
76
+ * import { init } from "@interface-db/react-native"
77
+ * const db = init({ ... });
78
+ */
79
+ const init_experimental = init;
80
+ exports.init_experimental = init_experimental;
81
+ class InstantReactNativeDatabase extends react_common_1.InstantReactAbstractDatabase {
82
+ static Store = Storage_1.default;
83
+ static NetworkListener = NetworkListener_1.default;
84
+ static EventSourceImpl = EventSourceImpl_1.default;
85
+ }
86
+ exports.InstantReactNativeDatabase = InstantReactNativeDatabase;
87
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AA0LE,oBAAI;AA1LN,0CAAwC;AAExC,wDAA8B;AAC9B,wEAAgD;AAChD,wEAAgD;AAChD,wDAAgC;AAChC,uCAA+C;AAE/C,6DAA0E;AAE1E,6CA+F4B;AAsF1B,kFApLA,QAAC,OAoLA;AAHD,mFAhLA,SAAE,OAgLA;AACF,mFAhLA,SAAE,OAgLA;AACF,uFAhLA,aAAM,OAgLA;AAMN;IArLA,QAAQ;IACR,sBAAe,OAoLA;AACf,0GApLA,gCAAyB,OAoLA;AAGzB;IArLA,mBAAmB;IACnB,iCAA0B,OAoLA;AAR1B;IA1KA,QAAQ;IACR,gCAAyB,OAyKA;AAmFzB,+FAjLA,qBAAc,OAiLA;AAxKhB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAS,IAAI;AAIX,oEAAoE;AACpE,+CAA+C;AAC/C,MAEC;IAMD,MAAM,YAAY,GAAG;QACnB,cAAc,EAAE,4BAAkB,CAAC,cAAc;QACjD,cAAc,EAAE,4BAAkB,CAAC,cAAc;QACjD,GAAG,MAAM;QACT,cAAc,EAAE,CAAC,MAAM,CAAC,cAAc,IAAI,KAAK,CAAa;KAC7D,CAAC;IACF,OAAO,IAAI,0BAA0B,CAInC,YAAY,EAAE;QACd,kBAAkB,EAAE,iBAAO;KAC5B,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAiB7B,8CAAiB;AAfnB,MAAM,0BAOJ,SAAQ,2CAAsD;IAC9D,MAAM,CAAC,KAAK,GAAG,iBAAK,CAAC;IACrB,MAAM,CAAC,eAAe,GAAG,yBAAe,CAAC;IACzC,MAAM,CAAC,eAAe,GAAG,yBAAe,CAAC;;AAWzC,gEAA0B","sourcesContent":["import 'react-native-get-random-values';\n\nimport Store from './Storage';\nimport EventSourceImpl from './EventSourceImpl';\nimport NetworkListener from './NetworkListener';\nimport version from './version';\nimport { streamConstructors } from './Streams';\n\nimport { InstantReactAbstractDatabase } from '@interface-db/react-common';\n\nimport {\n i,\n id,\n tx,\n lookup,\n // error\n InstantAPIError,\n setInstantWarningsEnabled,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n createInstantRouteHandler,\n type RoomSchemaShape,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantSchemaDatabase,\n type ConnectionStatus,\n type BackwardsCompatibleSchema,\n type IInstantDatabase,\n type Config,\n type Query,\n type QueryResponse,\n type InstantObject,\n type AuthState,\n type User,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type InstantGraph,\n type InstantUnknownSchemaDef,\n type LinkAttrDef,\n type LinkDef,\n type LinksDef,\n type ResolveAttrs,\n type ValueTypes,\n type InstantEntity,\n type ConfigWithSchema,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type RoomsOf,\n type RoomsDef,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type RoomHandle,\n type CreateParams,\n type InstantConfig,\n type InstantSchemaDef,\n type InstantUnknownSchema,\n type TransactionChunk,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type ValidQuery,\n type CheckMagicCodeParams,\n type CheckMagicCodeResponse,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n StoreInterface,\n type StoreInterfaceStoreName,\n CreateReadStreamOpts,\n CreateWriteStreamOpts,\n InstantWritableStream,\n InstantReadableStream,\n type Logger,\n} from '@interface-db/core';\n\n/**\n *\n * The first step: init your application!\n *\n * Visit https://interfacedb.com/dash to get your `appId` :)\n *\n * @example\n * import { init } from \"@interface-db/react-native\"\n *\n * const db = init({ appId: \"my-app-id\" })\n *\n * // You can also provide a schema for type safety and editor autocomplete!\n *\n * import { init } from \"@interface-db/react-native\"\n * import schema from \"\"../instant.schema.ts\";\n *\n * const db = init({ appId: \"my-app-id\", schema })\n *\n * // To learn more: https://interfacedb.com/docs/modeling-data\n */\nfunction init<\n Schema extends InstantSchemaDef<any, any, any> = InstantUnknownSchema,\n UseDates extends boolean = false,\n>(\n // Allows config with missing `useDateObjects`, but keeps `UseDates`\n // as a non-nullable in the InstantConfig type.\n config: Omit<InstantConfig<Schema, UseDates>, 'useDateObjects'> & {\n useDateObjects?: UseDates;\n },\n): InstantReactNativeDatabase<\n Schema,\n UseDates,\n InstantConfig<Schema, UseDates>\n> {\n const configStrict = {\n ReadableStream: streamConstructors.ReadableStream,\n WritableStream: streamConstructors.WritableStream,\n ...config,\n useDateObjects: (config.useDateObjects ?? false) as UseDates,\n };\n return new InstantReactNativeDatabase<\n Schema,\n UseDates,\n InstantConfig<Schema, UseDates>\n >(configStrict, {\n '@instantdb/react': version,\n });\n}\n\n/**\n * @deprecated\n * `init_experimental` is deprecated. You can replace it with `init`.\n *\n * @example\n *\n * // Before\n * import { init_experimental } from \"@interface-db/react-native\"\n * const db = init_experimental({ ... });\n *\n * // After\n * import { init } from \"@interface-db/react-native\"\n * const db = init({ ... });\n */\nconst init_experimental = init;\n\nclass InstantReactNativeDatabase<\n Schema extends InstantSchemaDef<any, any, any>,\n UseDates extends boolean,\n Config extends InstantConfig<Schema, UseDates> = InstantConfig<\n Schema,\n UseDates\n >,\n> extends InstantReactAbstractDatabase<Schema, UseDates, Config> {\n static Store = Store;\n static NetworkListener = NetworkListener;\n static EventSourceImpl = EventSourceImpl;\n}\n\nexport {\n init,\n init_experimental,\n id,\n tx,\n lookup,\n i,\n createInstantRouteHandler,\n InstantReactNativeDatabase,\n\n // error\n InstantAPIError,\n setInstantWarningsEnabled,\n\n // sync table enums\n SyncTableCallbackEventType,\n\n // types\n type Config,\n type Query,\n type QueryResponse,\n type InstantObject,\n type User,\n type AuthState,\n type ConnectionStatus,\n type InstantQuery,\n type InstantQueryResult,\n type InstantSchema,\n type InstantSchemaDatabase,\n type IInstantDatabase,\n type InstantEntity,\n type RoomSchemaShape,\n\n // presence types\n type PresencePeer,\n\n // schema types\n type AttrsDefs,\n type CardinalityKind,\n type DataAttrDef,\n type EntitiesDef,\n type EntitiesWithLinks,\n type EntityDef,\n type InstantGraph,\n type CreateParams,\n type LinkAttrDef,\n type InstantConfig,\n type LinkDef,\n type InstantUnknownSchemaDef,\n type LinksDef,\n type RoomsOf,\n type RoomsDef,\n type RoomHandle,\n type PresenceOf,\n type TopicsOf,\n type TopicOf,\n type ResolveAttrs,\n type ValueTypes,\n type InstaQLEntity,\n type InstaQLResult,\n type InstaQLEntitySubquery,\n type InstantSchemaDef,\n type InstantUnknownSchema,\n type BackwardsCompatibleSchema,\n type InstantRules,\n type UpdateParams,\n type LinkParams,\n type ValidQuery,\n type CheckMagicCodeParams,\n type CheckMagicCodeResponse,\n type ExchangeCodeForTokenParams,\n type SendMagicCodeParams,\n type TransactionChunk,\n type SendMagicCodeResponse,\n type SignInWithIdTokenParams,\n type VerifyMagicCodeParams,\n type VerifyResponse,\n\n // storage types\n type FileOpts,\n type UploadFileResponse,\n type DeleteFileResponse,\n\n // stream types\n type CreateReadStreamOpts,\n type CreateWriteStreamOpts,\n type InstantWritableStream,\n type InstantReadableStream,\n\n // custom store\n StoreInterface,\n type StoreInterfaceStoreName,\n\n // sync table types\n type SyncTableCallback,\n type SyncTableCallbackEvent,\n type SyncTableInitialSyncBatch,\n type SyncTableInitialSyncComplete,\n type SyncTableSyncTransaction,\n type SyncTableLoadFromStorage,\n type SyncTableSetupError,\n\n // logger\n type Logger,\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import EventSourceShim from './EventSourceShim';
2
+ declare const EventSourceImpl: {
3
+ new (url: string | URL, eventSourceInitDict?: EventSourceInit): EventSource;
4
+ prototype: EventSource;
5
+ readonly CONNECTING: 0;
6
+ readonly OPEN: 1;
7
+ readonly CLOSED: 2;
8
+ } | typeof EventSourceShim;
9
+ export default EventSourceImpl;
10
+ //# sourceMappingURL=EventSourceImpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventSourceImpl.d.ts","sourceRoot":"","sources":["../../src/EventSourceImpl.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,QAAA,MAAM,eAAe;;;;;;0BAC+C,CAAC;AAErE,eAAe,eAAe,CAAC"}
@@ -0,0 +1,4 @@
1
+ import EventSourceShim from './EventSourceShim';
2
+ const EventSourceImpl = typeof EventSource === 'undefined' ? EventSourceShim : EventSource;
3
+ export default EventSourceImpl;
4
+ //# sourceMappingURL=EventSourceImpl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventSourceImpl.js","sourceRoot":"","sources":["../../src/EventSourceImpl.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,eAAe,GACnB,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC;AAErE,eAAe,eAAe,CAAC","sourcesContent":["import EventSourceShim from './EventSourceShim';\n\nconst EventSourceImpl =\n typeof EventSource === 'undefined' ? EventSourceShim : EventSource;\n\nexport default EventSourceImpl;\n"]}
@@ -0,0 +1,31 @@
1
+ import { type EventSourceType } from '@interface-db/core';
2
+ declare class EventSource implements EventSourceType {
3
+ private ERROR;
4
+ static CONNECTING: number;
5
+ static OPEN: number;
6
+ static CLOSED: number;
7
+ private CRLF;
8
+ private LF;
9
+ private CR;
10
+ readonly url: string;
11
+ onopen: any;
12
+ onerror: any;
13
+ onmessage: any;
14
+ debug: boolean;
15
+ private status;
16
+ private headers;
17
+ private _xhr;
18
+ private lineEndingCharacter;
19
+ private _lastIndexProcessed;
20
+ constructor(url: any);
21
+ get readyState(): number;
22
+ open(): void;
23
+ _logDebug(...msg: any[]): void;
24
+ _handleEvent(response: any): void;
25
+ _detectNewlineChar(response: any): string | null;
26
+ _getLastDoubleNewlineIndex(response: any): any;
27
+ dispatch(type: any, data: any): void;
28
+ close(): void;
29
+ }
30
+ export default EventSource;
31
+ //# sourceMappingURL=EventSourceShim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EventSourceShim.d.ts","sourceRoot":"","sources":["../../src/EventSourceShim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAa1D,cAAM,WAAY,YAAW,eAAe;IAC1C,OAAO,CAAC,KAAK,CAAM;IACnB,MAAM,CAAC,UAAU,SAAK;IACtB,MAAM,CAAC,IAAI,SAAK;IAChB,MAAM,CAAC,MAAM,SAAK;IAElB,OAAO,CAAC,IAAI,CAAU;IACtB,OAAO,CAAC,EAAE,CAAQ;IAClB,OAAO,CAAC,EAAE,CAAQ;IAElB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,MAAM,MAAC;IACP,OAAO,MAAC;IACR,SAAS,MAAC;IAEV,KAAK,EAAE,OAAO,CAAC;IAEf,OAAO,CAAC,MAAM,CAAS;IAEvB,OAAO,CAAC,OAAO,CAIb;IAEF,OAAO,CAAC,IAAI,CAAwB;IACpC,OAAO,CAAC,mBAAmB,CAAgB;IAC3C,OAAO,CAAC,mBAAmB,CAAS;gBAExB,GAAG,KAAA;IAiBf,IAAW,UAAU,WAKpB;IAED,IAAI;IA8FJ,SAAS,CAAC,GAAG,GAAG,OAAA;IAMhB,YAAY,CAAC,QAAQ,KAAA;IA8DrB,kBAAkB,CAAC,QAAQ,KAAA;IAU3B,0BAA0B,CAAC,QAAQ,KAAA;IAWnC,QAAQ,CAAC,IAAI,KAAA,EAAE,IAAI,KAAA;IAuBnB,KAAK;CASN;AAED,eAAe,WAAW,CAAC"}