@eloxiv/client 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/dist/Account.d.ts +131 -0
  4. package/dist/Account.d.ts.map +1 -0
  5. package/dist/Account.js +169 -0
  6. package/dist/Account.js.map +1 -0
  7. package/dist/Agent.d.ts +496 -0
  8. package/dist/Agent.d.ts.map +1 -0
  9. package/dist/Agent.js +228 -0
  10. package/dist/Agent.js.map +1 -0
  11. package/dist/AgentSync.d.ts +990 -0
  12. package/dist/AgentSync.d.ts.map +1 -0
  13. package/dist/AgentSync.js +46 -0
  14. package/dist/AgentSync.js.map +1 -0
  15. package/dist/AppState.d.ts +127 -0
  16. package/dist/AppState.d.ts.map +1 -0
  17. package/dist/AppState.js +145 -0
  18. package/dist/AppState.js.map +1 -0
  19. package/dist/AppStateSync.d.ts +193 -0
  20. package/dist/AppStateSync.d.ts.map +1 -0
  21. package/dist/AppStateSync.js +23 -0
  22. package/dist/AppStateSync.js.map +1 -0
  23. package/dist/Auth.d.ts +95 -0
  24. package/dist/Auth.d.ts.map +1 -0
  25. package/dist/Auth.js +139 -0
  26. package/dist/Auth.js.map +1 -0
  27. package/dist/Avatars.d.ts +53 -0
  28. package/dist/Avatars.d.ts.map +1 -0
  29. package/dist/Avatars.js +121 -0
  30. package/dist/Avatars.js.map +1 -0
  31. package/dist/BrowserAnalytics.d.ts +56 -0
  32. package/dist/BrowserAnalytics.d.ts.map +1 -0
  33. package/dist/BrowserAnalytics.js +94 -0
  34. package/dist/BrowserAnalytics.js.map +1 -0
  35. package/dist/Chat.d.ts +712 -0
  36. package/dist/Chat.d.ts.map +1 -0
  37. package/dist/Chat.js +883 -0
  38. package/dist/Chat.js.map +1 -0
  39. package/dist/ChatIntegrity.d.ts +63 -0
  40. package/dist/ChatIntegrity.d.ts.map +1 -0
  41. package/dist/ChatIntegrity.js +89 -0
  42. package/dist/ChatIntegrity.js.map +1 -0
  43. package/dist/ChatSends.d.ts +103 -0
  44. package/dist/ChatSends.d.ts.map +1 -0
  45. package/dist/ChatSends.js +157 -0
  46. package/dist/ChatSends.js.map +1 -0
  47. package/dist/Client.d.ts +113 -0
  48. package/dist/Client.d.ts.map +1 -0
  49. package/dist/Client.js +189 -0
  50. package/dist/Client.js.map +1 -0
  51. package/dist/Collab.d.ts +138 -0
  52. package/dist/Collab.d.ts.map +1 -0
  53. package/dist/Collab.js +454 -0
  54. package/dist/Collab.js.map +1 -0
  55. package/dist/CollabTools.d.ts +129 -0
  56. package/dist/CollabTools.d.ts.map +1 -0
  57. package/dist/CollabTools.js +277 -0
  58. package/dist/CollabTools.js.map +1 -0
  59. package/dist/Connections.d.ts +288 -0
  60. package/dist/Connections.d.ts.map +1 -0
  61. package/dist/Connections.js +316 -0
  62. package/dist/Connections.js.map +1 -0
  63. package/dist/Consent.d.ts +338 -0
  64. package/dist/Consent.d.ts.map +1 -0
  65. package/dist/Consent.js +142 -0
  66. package/dist/Consent.js.map +1 -0
  67. package/dist/Desktop.d.ts +61 -0
  68. package/dist/Desktop.d.ts.map +1 -0
  69. package/dist/Desktop.js +101 -0
  70. package/dist/Desktop.js.map +1 -0
  71. package/dist/Directory.d.ts +36 -0
  72. package/dist/Directory.d.ts.map +1 -0
  73. package/dist/Directory.js +42 -0
  74. package/dist/Directory.js.map +1 -0
  75. package/dist/ErrorReporter.d.ts +48 -0
  76. package/dist/ErrorReporter.d.ts.map +1 -0
  77. package/dist/ErrorReporter.js +70 -0
  78. package/dist/ErrorReporter.js.map +1 -0
  79. package/dist/ExpoSqlite.d.ts +7 -0
  80. package/dist/ExpoSqlite.d.ts.map +1 -0
  81. package/dist/ExpoSqlite.js +7 -0
  82. package/dist/ExpoSqlite.js.map +1 -0
  83. package/dist/FileSync.d.ts +265 -0
  84. package/dist/FileSync.d.ts.map +1 -0
  85. package/dist/FileSync.js +29 -0
  86. package/dist/FileSync.js.map +1 -0
  87. package/dist/FileTables.gen.d.ts +109 -0
  88. package/dist/FileTables.gen.d.ts.map +1 -0
  89. package/dist/FileTables.gen.js +23 -0
  90. package/dist/FileTables.gen.js.map +1 -0
  91. package/dist/Foldkit.d.ts +487 -0
  92. package/dist/Foldkit.d.ts.map +1 -0
  93. package/dist/Foldkit.js +617 -0
  94. package/dist/Foldkit.js.map +1 -0
  95. package/dist/History.d.ts +133 -0
  96. package/dist/History.d.ts.map +1 -0
  97. package/dist/History.js +210 -0
  98. package/dist/History.js.map +1 -0
  99. package/dist/InboxSync.d.ts +428 -0
  100. package/dist/InboxSync.d.ts.map +1 -0
  101. package/dist/InboxSync.js +37 -0
  102. package/dist/InboxSync.js.map +1 -0
  103. package/dist/KernelTables.gen.d.ts +1522 -0
  104. package/dist/KernelTables.gen.d.ts.map +1 -0
  105. package/dist/KernelTables.gen.js +307 -0
  106. package/dist/KernelTables.gen.js.map +1 -0
  107. package/dist/Make.d.ts +75 -0
  108. package/dist/Make.d.ts.map +1 -0
  109. package/dist/Make.js +70 -0
  110. package/dist/Make.js.map +1 -0
  111. package/dist/Models.d.ts +88 -0
  112. package/dist/Models.d.ts.map +1 -0
  113. package/dist/Models.js +80 -0
  114. package/dist/Models.js.map +1 -0
  115. package/dist/Optimistic.d.ts +120 -0
  116. package/dist/Optimistic.d.ts.map +1 -0
  117. package/dist/Optimistic.js +231 -0
  118. package/dist/Optimistic.js.map +1 -0
  119. package/dist/PlatformSync.d.ts +273 -0
  120. package/dist/PlatformSync.d.ts.map +1 -0
  121. package/dist/PlatformSync.js +92 -0
  122. package/dist/PlatformSync.js.map +1 -0
  123. package/dist/Poll.d.ts +113 -0
  124. package/dist/Poll.d.ts.map +1 -0
  125. package/dist/Poll.js +179 -0
  126. package/dist/Poll.js.map +1 -0
  127. package/dist/Preferences.d.ts +18 -0
  128. package/dist/Preferences.d.ts.map +1 -0
  129. package/dist/Preferences.js +22 -0
  130. package/dist/Preferences.js.map +1 -0
  131. package/dist/Proposals.d.ts +29 -0
  132. package/dist/Proposals.d.ts.map +1 -0
  133. package/dist/Proposals.js +41 -0
  134. package/dist/Proposals.js.map +1 -0
  135. package/dist/React.d.ts +17 -0
  136. package/dist/React.d.ts.map +1 -0
  137. package/dist/React.js +17 -0
  138. package/dist/React.js.map +1 -0
  139. package/dist/Reader.d.ts +35 -0
  140. package/dist/Reader.d.ts.map +1 -0
  141. package/dist/Reader.js +136 -0
  142. package/dist/Reader.js.map +1 -0
  143. package/dist/Resources.d.ts +98 -0
  144. package/dist/Resources.d.ts.map +1 -0
  145. package/dist/Resources.js +161 -0
  146. package/dist/Resources.js.map +1 -0
  147. package/dist/Rows.d.ts +4 -0
  148. package/dist/Rows.d.ts.map +1 -0
  149. package/dist/Rows.js +16 -0
  150. package/dist/Rows.js.map +1 -0
  151. package/dist/Runtime.d.ts +254 -0
  152. package/dist/Runtime.d.ts.map +1 -0
  153. package/dist/Runtime.js +1249 -0
  154. package/dist/Runtime.js.map +1 -0
  155. package/dist/RuntimeRuns.d.ts +74 -0
  156. package/dist/RuntimeRuns.d.ts.map +1 -0
  157. package/dist/RuntimeRuns.js +118 -0
  158. package/dist/RuntimeRuns.js.map +1 -0
  159. package/dist/ServicesSync.d.ts +286 -0
  160. package/dist/ServicesSync.d.ts.map +1 -0
  161. package/dist/ServicesSync.js +40 -0
  162. package/dist/ServicesSync.js.map +1 -0
  163. package/dist/Session.d.ts +226 -0
  164. package/dist/Session.d.ts.map +1 -0
  165. package/dist/Session.js +763 -0
  166. package/dist/Session.js.map +1 -0
  167. package/dist/ShareGrant.d.ts +47 -0
  168. package/dist/ShareGrant.d.ts.map +1 -0
  169. package/dist/ShareGrant.js +20 -0
  170. package/dist/ShareGrant.js.map +1 -0
  171. package/dist/Sharing.d.ts +203 -0
  172. package/dist/Sharing.d.ts.map +1 -0
  173. package/dist/Sharing.js +520 -0
  174. package/dist/Sharing.js.map +1 -0
  175. package/dist/Skew.d.ts +52 -0
  176. package/dist/Skew.d.ts.map +1 -0
  177. package/dist/Skew.js +77 -0
  178. package/dist/Skew.js.map +1 -0
  179. package/dist/SpacesSync.d.ts +247 -0
  180. package/dist/SpacesSync.d.ts.map +1 -0
  181. package/dist/SpacesSync.js +30 -0
  182. package/dist/SpacesSync.js.map +1 -0
  183. package/dist/Storage.d.ts +51 -0
  184. package/dist/Storage.d.ts.map +1 -0
  185. package/dist/Storage.js +107 -0
  186. package/dist/Storage.js.map +1 -0
  187. package/dist/Sync.d.ts +48 -0
  188. package/dist/Sync.d.ts.map +1 -0
  189. package/dist/Sync.js +48 -0
  190. package/dist/Sync.js.map +1 -0
  191. package/dist/SyncTables.d.ts +13 -0
  192. package/dist/SyncTables.d.ts.map +1 -0
  193. package/dist/SyncTables.js +13 -0
  194. package/dist/SyncTables.js.map +1 -0
  195. package/dist/Tab.d.ts +36 -0
  196. package/dist/Tab.d.ts.map +1 -0
  197. package/dist/Tab.js +44 -0
  198. package/dist/Tab.js.map +1 -0
  199. package/dist/Transport.d.ts +139 -0
  200. package/dist/Transport.d.ts.map +1 -0
  201. package/dist/Transport.js +232 -0
  202. package/dist/Transport.js.map +1 -0
  203. package/dist/Upload.d.ts +41 -0
  204. package/dist/Upload.d.ts.map +1 -0
  205. package/dist/Upload.js +93 -0
  206. package/dist/Upload.js.map +1 -0
  207. package/dist/WebMcp.d.ts +78 -0
  208. package/dist/WebMcp.d.ts.map +1 -0
  209. package/dist/WebMcp.js +204 -0
  210. package/dist/WebMcp.js.map +1 -0
  211. package/dist/index.d.ts +27 -0
  212. package/dist/index.d.ts.map +1 -0
  213. package/dist/index.js +27 -0
  214. package/dist/index.js.map +1 -0
  215. package/package.json +97 -3
  216. package/src/Account.ts +249 -0
  217. package/src/Agent.ts +387 -0
  218. package/src/AgentSync.ts +59 -0
  219. package/src/AppState.ts +222 -0
  220. package/src/AppStateSync.ts +26 -0
  221. package/src/Auth.ts +225 -0
  222. package/src/Avatars.ts +144 -0
  223. package/src/BrowserAnalytics.ts +133 -0
  224. package/src/Chat.ts +1150 -0
  225. package/src/ChatIntegrity.ts +130 -0
  226. package/src/ChatSends.ts +209 -0
  227. package/src/Client.ts +319 -0
  228. package/src/Collab.ts +524 -0
  229. package/src/CollabTools.ts +381 -0
  230. package/src/Connections.ts +517 -0
  231. package/src/Consent.ts +176 -0
  232. package/src/Desktop.ts +139 -0
  233. package/src/Directory.ts +71 -0
  234. package/src/ErrorReporter.ts +112 -0
  235. package/src/ExpoSqlite.ts +6 -0
  236. package/src/FileSync.ts +34 -0
  237. package/src/FileTables.gen.ts +23 -0
  238. package/src/Foldkit.ts +960 -0
  239. package/src/History.ts +337 -0
  240. package/src/InboxSync.ts +47 -0
  241. package/src/KernelTables.gen.ts +329 -0
  242. package/src/Make.ts +120 -0
  243. package/src/Models.ts +134 -0
  244. package/src/Optimistic.ts +364 -0
  245. package/src/PlatformSync.ts +156 -0
  246. package/src/Poll.ts +227 -0
  247. package/src/Preferences.ts +42 -0
  248. package/src/Proposals.ts +57 -0
  249. package/src/React.ts +26 -0
  250. package/src/Reader.ts +180 -0
  251. package/src/Resources.ts +257 -0
  252. package/src/Rows.ts +16 -0
  253. package/src/Runtime.ts +1409 -0
  254. package/src/RuntimeRuns.ts +180 -0
  255. package/src/ServicesSync.ts +58 -0
  256. package/src/Session.ts +814 -0
  257. package/src/ShareGrant.ts +20 -0
  258. package/src/Sharing.ts +696 -0
  259. package/src/Skew.ts +97 -0
  260. package/src/SpacesSync.ts +61 -0
  261. package/src/Storage.ts +167 -0
  262. package/src/Sync.ts +125 -0
  263. package/src/SyncTables.ts +12 -0
  264. package/src/Tab.ts +59 -0
  265. package/src/Transport.ts +321 -0
  266. package/src/Upload.ts +125 -0
  267. package/src/WebMcp.ts +279 -0
  268. package/src/index.ts +26 -0
  269. package/src/web-globals.d.ts +103 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Desktop.js","sourceRoot":"","sources":["../src/Desktop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,O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,aAAa,GAAG,KAAK,EAChC,UAA6B,EAC7B,KAMC,EACc,EAAE;IACjB,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC,CAAA;IAC1E,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;IAClG,MAAM,UAAU,CAAC,KAAK,CAAC,MAAM,qBAAqB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;AAClG,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * The Directory's operations, headless (`POST /kernel/directory/<operation>`): an organisation's members, roles,
3
+ * groups, invitations and domains for an administrator, and a person's own (their organisations, accepting an
4
+ * invitation, joining through their address's domain). Inputs and outputs are typed from the Directory contract, so
5
+ * nothing is declared twice. Every call is made with a person's own session; administration needs
6
+ * `eloxiv.directory.manage` in the organisation `orgId` names, and is audited by the kernel.
7
+ */
8
+ import type { DirectoryContract } from "@eloxiv/contracts";
9
+ type Operations = Omit<(typeof DirectoryContract)["operations"], "createOrganization">;
10
+ /** A Directory operation the kernel serves over HTTP. */
11
+ export type DirectoryOperation = keyof Operations;
12
+ export type DirectoryInput<K extends DirectoryOperation> = Operations[K]["input"]["Encoded"];
13
+ export type DirectoryOutput<K extends DirectoryOperation> = Operations[K]["output"]["Type"];
14
+ /**
15
+ * A refused Directory call: the kernel's typed error (`Unauthenticated`, `Forbidden`: not permitted, not the invited
16
+ * or a verified address; `InvalidInput`: a request the directory cannot apply), its message and HTTP status.
17
+ */
18
+ export declare class DirectoryError extends Error {
19
+ readonly tag: string;
20
+ readonly status: number;
21
+ constructor(tag: string, message: string, status: number);
22
+ }
23
+ export interface DirectoryClientOptions {
24
+ readonly baseUrl: string;
25
+ /** The person's session token, read for every call. */
26
+ readonly token: () => string;
27
+ /** The organisation administration acts in (`x-eloxiv-org`); a person's own operations ignore it. */
28
+ readonly orgId?: (() => string | undefined) | undefined;
29
+ }
30
+ export declare const directoryClient: (options: DirectoryClientOptions) => {
31
+ /** One Directory operation; rejects with `DirectoryError`. */
32
+ call: <K extends DirectoryOperation>(operation: K, input: DirectoryInput<K>) => Promise<DirectoryOutput<K>>;
33
+ };
34
+ export type DirectoryClient = ReturnType<typeof directoryClient>;
35
+ export {};
36
+ //# sourceMappingURL=Directory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Directory.d.ts","sourceRoot":"","sources":["../src/Directory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,KAAK,UAAU,GAAG,IAAI,CAAC,CAAC,OAAO,iBAAiB,CAAC,CAAC,YAAY,CAAC,EAAE,oBAAoB,CAAC,CAAA;AAEtF,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG,MAAM,UAAU,CAAA;AACjD,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,kBAAkB,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAA;AAC5F,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,kBAAkB,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAE3F;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,YAAY,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAIvD;CACF;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,CAAA;IAC5B,qGAAqG;IACrG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAA;CACxD;AAED,eAAO,MAAM,eAAe,YAAa,sBAAsB;IAC7D,8DAA8D;IAC9D,IAAI,GAAS,CAAC,SAAS,kBAAkB,aAAa,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;CA4B/G,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * A refused Directory call: the kernel's typed error (`Unauthenticated`, `Forbidden`: not permitted, not the invited
3
+ * or a verified address; `InvalidInput`: a request the directory cannot apply), its message and HTTP status.
4
+ */
5
+ export class DirectoryError extends Error {
6
+ tag;
7
+ status;
8
+ constructor(tag, message, status) {
9
+ super(message);
10
+ this.tag = tag;
11
+ this.status = status;
12
+ }
13
+ }
14
+ export const directoryClient = (options) => ({
15
+ /** One Directory operation; rejects with `DirectoryError`. */
16
+ call: async (operation, input) => {
17
+ const orgId = options.orgId?.();
18
+ const response = await fetch(`${options.baseUrl}/kernel/directory/${operation}`, {
19
+ method: "POST",
20
+ headers: {
21
+ authorization: `Bearer ${options.token()}`,
22
+ "content-type": "application/json",
23
+ ...(orgId === undefined ? {} : { "x-eloxiv-org": orgId }),
24
+ },
25
+ body: JSON.stringify(input),
26
+ });
27
+ const text = await response.text();
28
+ let parsed;
29
+ try {
30
+ parsed = text.length === 0 ? {} : JSON.parse(text);
31
+ }
32
+ catch {
33
+ parsed = undefined;
34
+ }
35
+ if (!response.ok) {
36
+ const error = (parsed ?? {});
37
+ throw new DirectoryError(typeof error._tag === "string" ? error._tag : "Unknown", typeof error.message === "string" ? error.message : `${operation} failed (${response.status})`, response.status);
38
+ }
39
+ return parsed;
40
+ },
41
+ });
42
+ //# sourceMappingURL=Directory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Directory.js","sourceRoot":"","sources":["../src/Directory.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,GAAG,CAAQ;IACX,MAAM,CAAQ;IACvB,YAAY,GAAW,EAAE,OAAe,EAAE,MAAc;QACtD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AAUD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,OAA+B,EAAE,EAAE,CAAC,CAAC;IACnE,8DAA8D;IAC9D,IAAI,EAAE,KAAK,EAAgC,SAAY,EAAE,KAAwB,EAA+B,EAAE;QAChH,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,EAAE,EAAE,CAAA;QAC/B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,qBAAqB,SAAS,EAAE,EAAE;YAC/E,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE,EAAE;gBAC1C,cAAc,EAAE,kBAAkB;gBAClC,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;aAC1D;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;SAC5B,CAAC,CAAA;QACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAClC,IAAI,MAAe,CAAA;QACnB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,GAAG,SAAS,CAAA;QACpB,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,EAAE,CAA0C,CAAA;YACrE,MAAM,IAAI,cAAc,CACtB,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACvD,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,YAAY,QAAQ,CAAC,MAAM,GAAG,EAC9F,QAAQ,CAAC,MAAM,CAChB,CAAA;QACH,CAAC;QACD,OAAO,MAA4B,CAAA;IACrC,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * A client's unexpected errors, reported to the kernel's error capture (the Telemetry contract's `telemetry.captureError`):
3
+ * global exceptions and unhandled rejections (or any error the app passes), with the route they happened on as the
4
+ * router's registered template (never a path: a path's segments can be names or diagnoses, and no rule tells them from
5
+ * static ones), the invocation they followed, and the last breadcrumbs (navigations, actions, requests, UI events by a
6
+ * label the app chooses: a route template, an action's name). **Only labels leave**: never an error's message or
7
+ * stack, a URL or any input.
8
+ * Reports are sent one at a time; one that fails to send is dropped (error reporting never throws into the app).
9
+ */
10
+ import type { ClientErrorReport } from "@eloxiv/contracts";
11
+ type Breadcrumb = ClientErrorReport["breadcrumbs"][number];
12
+ /** A label as the kernel takes it: anything else replaced by `_`, at most 64 characters (`other` when empty). */
13
+ export declare const labelOf: (text: string) => string;
14
+ /** The route reported when the router names none (an unknown route) or names something that is not a template. */
15
+ export declare const UNKNOWN_ROUTE = "/unknown";
16
+ /** A router's registered template (`/orders/:id`) as reported: anything else is `UNKNOWN_ROUTE`. */
17
+ export declare const routeTemplateOf: (template: string | undefined) => string;
18
+ /** Where global errors come from: a browser's `window` (or `globalThis`), anything with these listeners. */
19
+ export interface ErrorSource {
20
+ readonly addEventListener: (type: "error" | "unhandledrejection", listener: (event: unknown) => void) => void;
21
+ readonly removeEventListener: (type: "error" | "unhandledrejection", listener: (event: unknown) => void) => void;
22
+ }
23
+ export interface ErrorReporterOptions {
24
+ /** Send a report (`client.call("telemetry.captureError", report)` of the typed client, say). */
25
+ readonly send: (report: ClientErrorReport) => Promise<unknown>;
26
+ /**
27
+ * The registered template of the route being shown (`/patients/:id/diagnosis/:code`), from the app's router, or
28
+ * undefined for a route it does not know; the URL itself is never read.
29
+ */
30
+ readonly route?: (() => string | undefined) | undefined;
31
+ /** How many breadcrumbs are kept (at most 20). */
32
+ readonly breadcrumbs?: number | undefined;
33
+ }
34
+ export declare const errorReporter: (options: ErrorReporterOptions) => {
35
+ /** Remember what the person just did (a navigation, an action, a request, a UI event), by a label. */
36
+ breadcrumb: (kind: Breadcrumb["kind"], name: string) => void;
37
+ /** The invocation the next report follows (the kernel's id of the last call that failed, say). */
38
+ correlate: (invocationId: string) => undefined;
39
+ /** Report an error the app caught. */
40
+ report: (error: unknown, kind?: ClientErrorReport["kind"]) => Promise<void>;
41
+ /** Report every uncaught exception and unhandled rejection of `source`; returns the uninstall. */
42
+ install: (source: ErrorSource) => () => void;
43
+ /** Wait for reports being sent. */
44
+ settled: () => Promise<void>;
45
+ };
46
+ export type ErrorReporter = ReturnType<typeof errorReporter>;
47
+ export {};
48
+ //# sourceMappingURL=ErrorReporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorReporter.d.ts","sourceRoot":"","sources":["../src/ErrorReporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,KAAK,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AAa,CAAC,CAAA"}
@@ -0,0 +1,70 @@
1
+ const LABEL = /^[A-Za-z0-9_.:/-]{1,64}$/u;
2
+ /** A label as the kernel takes it: anything else replaced by `_`, at most 64 characters (`other` when empty). */
3
+ export const labelOf = (text) => {
4
+ const label = text.replaceAll(/[^A-Za-z0-9_.:/-]/gu, "_").slice(0, 64);
5
+ return label === "" ? "other" : label;
6
+ };
7
+ /** The route reported when the router names none (an unknown route) or names something that is not a template. */
8
+ export const UNKNOWN_ROUTE = "/unknown";
9
+ const TEMPLATE = /^\/[A-Za-z0-9_.:\-/*]{0,199}$/u;
10
+ /** A router's registered template (`/orders/:id`) as reported: anything else is `UNKNOWN_ROUTE`. */
11
+ export const routeTemplateOf = (template) => template !== undefined && TEMPLATE.test(template) ? template : UNKNOWN_ROUTE;
12
+ const nameOf = (error) => {
13
+ const name = error?.name;
14
+ return typeof name === "string" && LABEL.test(name) ? name : "Error";
15
+ };
16
+ export const errorReporter = (options) => {
17
+ const keep = Math.min(Math.max(options.breadcrumbs ?? 20, 0), 20);
18
+ const trail = [];
19
+ let lastInvocation;
20
+ let sending = Promise.resolve();
21
+ const breadcrumb = (kind, name) => {
22
+ trail.push({ kind, name: labelOf(name), at: Date.now() });
23
+ while (trail.length > keep)
24
+ trail.shift();
25
+ };
26
+ const report = (error, kind = "exception") => {
27
+ const invocation = error?.invocationId;
28
+ const invocationId = typeof invocation === "string" ? invocation : lastInvocation;
29
+ const payload = {
30
+ kind,
31
+ errorName: nameOf(error),
32
+ route: routeTemplateOf(options.route?.()),
33
+ ...(invocationId !== undefined && /^[0-9a-f-]{8,64}$/u.test(invocationId) ? { invocationId } : {}),
34
+ breadcrumbs: [...trail],
35
+ };
36
+ const previous = sending;
37
+ sending = (async () => {
38
+ await previous;
39
+ try {
40
+ await options.send(payload);
41
+ }
42
+ catch {
43
+ // Dropped: reporting an error never throws into the app.
44
+ }
45
+ })();
46
+ return sending;
47
+ };
48
+ const onError = (event) => void report(event?.error ?? event);
49
+ const onRejection = (event) => void report(event?.reason ?? event, "rejection");
50
+ return {
51
+ /** Remember what the person just did (a navigation, an action, a request, a UI event), by a label. */
52
+ breadcrumb,
53
+ /** The invocation the next report follows (the kernel's id of the last call that failed, say). */
54
+ correlate: (invocationId) => void (lastInvocation = invocationId),
55
+ /** Report an error the app caught. */
56
+ report,
57
+ /** Report every uncaught exception and unhandled rejection of `source`; returns the uninstall. */
58
+ install: (source) => {
59
+ source.addEventListener("error", onError);
60
+ source.addEventListener("unhandledrejection", onRejection);
61
+ return () => {
62
+ source.removeEventListener("error", onError);
63
+ source.removeEventListener("unhandledrejection", onRejection);
64
+ };
65
+ },
66
+ /** Wait for reports being sent. */
67
+ settled: () => sending,
68
+ };
69
+ };
70
+ //# sourceMappingURL=ErrorReporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorReporter.js","sourceRoot":"","sources":["../src/ErrorReporter.ts"],"names":[],"mappings":"AAaA,MAAM,KAAK,GAAG,2BAA2B,CAAA;AAEzC,iHAAiH;AACjH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAU,EAAE;IAC9C,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACtE,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAA;AACvC,CAAC,CAAA;AAED,kHAAkH;AAClH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAA;AAEvC,MAAM,QAAQ,GAAG,gCAAgC,CAAA;AAEjD,oGAAoG;AACpG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAA4B,EAAU,EAAE,CACtE,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAA;AAoB9E,M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BAAoB,EAAE,WAAW,CAAC,CAAA;YAC/D,CAAC,CAAA;QACH,CAAC;QACD,mCAAmC;QACnC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO;KACvB,CAAA;AACH,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The replica's SQLite storage on React Native (decision 7), through `expo-sqlite`:
3
+ * `connectSync({ ..., storage: expoSQLiteStoreProvider() })`. The app installs `expo-sqlite` itself, so this is a
4
+ * separate entry (`@eloxiv/client/expo-sqlite`) that nothing else in the SDK imports.
5
+ */
6
+ export { expoSQLiteStoreProvider } from "@rocicorp/zero/expo-sqlite";
7
+ //# sourceMappingURL=ExpoSqlite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoSqlite.d.ts","sourceRoot":"","sources":["../src/ExpoSqlite.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The replica's SQLite storage on React Native (decision 7), through `expo-sqlite`:
3
+ * `connectSync({ ..., storage: expoSQLiteStoreProvider() })`. The app installs `expo-sqlite` itself, so this is a
4
+ * separate entry (`@eloxiv/client/expo-sqlite`) that nothing else in the SDK imports.
5
+ */
6
+ export { expoSQLiteStoreProvider } from "@rocicorp/zero/expo-sqlite";
7
+ //# sourceMappingURL=ExpoSqlite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExpoSqlite.js","sourceRoot":"","sources":["../src/ExpoSqlite.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,265 @@
1
+ import { eloxivFileTable } from "./FileTables.gen.ts";
2
+ export { eloxivFileTable };
3
+ /** The file metadata table (the generated `eloxivFileTable`). */
4
+ export declare const fileTable: import("@rocicorp/zero").TableBuilderWithColumns<{
5
+ name: "eloxivFile";
6
+ columns: {
7
+ readonly id: {
8
+ type: "string";
9
+ optional: false;
10
+ customType: string;
11
+ };
12
+ readonly orgId: {
13
+ type: "string";
14
+ optional: false;
15
+ customType: string;
16
+ } & {
17
+ serverName: string;
18
+ };
19
+ readonly ownerType: Omit<{
20
+ type: "string";
21
+ optional: false;
22
+ customType: string;
23
+ } & {
24
+ serverName: string;
25
+ }, "optional"> & {
26
+ optional: true;
27
+ };
28
+ readonly ownerId: Omit<{
29
+ type: "string";
30
+ optional: false;
31
+ customType: string;
32
+ } & {
33
+ serverName: string;
34
+ }, "optional"> & {
35
+ optional: true;
36
+ };
37
+ readonly name: {
38
+ type: "string";
39
+ optional: false;
40
+ customType: string;
41
+ };
42
+ readonly declaredType: {
43
+ type: "string";
44
+ optional: false;
45
+ customType: string;
46
+ } & {
47
+ serverName: string;
48
+ };
49
+ readonly contentType: Omit<{
50
+ type: "string";
51
+ optional: false;
52
+ customType: string;
53
+ } & {
54
+ serverName: string;
55
+ }, "optional"> & {
56
+ optional: true;
57
+ };
58
+ readonly size: {
59
+ type: "number";
60
+ optional: false;
61
+ customType: number;
62
+ };
63
+ readonly sha256: Omit<{
64
+ type: "string";
65
+ optional: false;
66
+ customType: string;
67
+ }, "optional"> & {
68
+ optional: true;
69
+ };
70
+ readonly state: {
71
+ type: "string";
72
+ optional: false;
73
+ customType: "available" | "deleted" | "processing" | "quarantined" | "rejected" | "uploading";
74
+ };
75
+ readonly stateReason: Omit<{
76
+ type: "string";
77
+ optional: false;
78
+ customType: string;
79
+ } & {
80
+ serverName: string;
81
+ }, "optional"> & {
82
+ optional: true;
83
+ };
84
+ readonly uploadedBy: {
85
+ type: "string";
86
+ optional: false;
87
+ customType: string;
88
+ } & {
89
+ serverName: string;
90
+ };
91
+ readonly createdAt: {
92
+ type: "number";
93
+ optional: false;
94
+ customType: number;
95
+ } & {
96
+ serverName: string;
97
+ };
98
+ readonly completedAt: Omit<{
99
+ type: "number";
100
+ optional: false;
101
+ customType: number;
102
+ } & {
103
+ serverName: string;
104
+ }, "optional"> & {
105
+ optional: true;
106
+ };
107
+ };
108
+ primaryKey: readonly [string, ...string[]];
109
+ } & {
110
+ primaryKey: ["id"];
111
+ }>;
112
+ export declare const fileTables: readonly [import("@rocicorp/zero").TableBuilderWithColumns<{
113
+ name: "eloxivFile";
114
+ columns: {
115
+ readonly id: {
116
+ type: "string";
117
+ optional: false;
118
+ customType: string;
119
+ };
120
+ readonly orgId: {
121
+ type: "string";
122
+ optional: false;
123
+ customType: string;
124
+ } & {
125
+ serverName: string;
126
+ };
127
+ readonly ownerType: Omit<{
128
+ type: "string";
129
+ optional: false;
130
+ customType: string;
131
+ } & {
132
+ serverName: string;
133
+ }, "optional"> & {
134
+ optional: true;
135
+ };
136
+ readonly ownerId: Omit<{
137
+ type: "string";
138
+ optional: false;
139
+ customType: string;
140
+ } & {
141
+ serverName: string;
142
+ }, "optional"> & {
143
+ optional: true;
144
+ };
145
+ readonly name: {
146
+ type: "string";
147
+ optional: false;
148
+ customType: string;
149
+ };
150
+ readonly declaredType: {
151
+ type: "string";
152
+ optional: false;
153
+ customType: string;
154
+ } & {
155
+ serverName: string;
156
+ };
157
+ readonly contentType: Omit<{
158
+ type: "string";
159
+ optional: false;
160
+ customType: string;
161
+ } & {
162
+ serverName: string;
163
+ }, "optional"> & {
164
+ optional: true;
165
+ };
166
+ readonly size: {
167
+ type: "number";
168
+ optional: false;
169
+ customType: number;
170
+ };
171
+ readonly sha256: Omit<{
172
+ type: "string";
173
+ optional: false;
174
+ customType: string;
175
+ }, "optional"> & {
176
+ optional: true;
177
+ };
178
+ readonly state: {
179
+ type: "string";
180
+ optional: false;
181
+ customType: "available" | "deleted" | "processing" | "quarantined" | "rejected" | "uploading";
182
+ };
183
+ readonly stateReason: Omit<{
184
+ type: "string";
185
+ optional: false;
186
+ customType: string;
187
+ } & {
188
+ serverName: string;
189
+ }, "optional"> & {
190
+ optional: true;
191
+ };
192
+ readonly uploadedBy: {
193
+ type: "string";
194
+ optional: false;
195
+ customType: string;
196
+ } & {
197
+ serverName: string;
198
+ };
199
+ readonly createdAt: {
200
+ type: "number";
201
+ optional: false;
202
+ customType: number;
203
+ } & {
204
+ serverName: string;
205
+ };
206
+ readonly completedAt: Omit<{
207
+ type: "number";
208
+ optional: false;
209
+ customType: number;
210
+ } & {
211
+ serverName: string;
212
+ }, "optional"> & {
213
+ optional: true;
214
+ };
215
+ };
216
+ primaryKey: readonly [string, ...string[]];
217
+ } & {
218
+ primaryKey: ["id"];
219
+ }>];
220
+ /** Named queries (`files.ofRecord`, `files.staged`). */
221
+ export declare const fileQueries: {
222
+ files: {
223
+ /** The files attached to one record (the kernel keeps only those you may read). */
224
+ ofRecord: import("@rocicorp/zero").QueryDefinition<"eloxivFile", {
225
+ readonly entity: string;
226
+ readonly id: string;
227
+ }, {
228
+ readonly entity: string;
229
+ readonly id: string;
230
+ }, {
231
+ readonly id: string;
232
+ readonly orgId: string;
233
+ readonly ownerType: string | null;
234
+ readonly ownerId: string | null;
235
+ readonly name: string;
236
+ readonly declaredType: string;
237
+ readonly contentType: string | null;
238
+ readonly size: number;
239
+ readonly sha256: string | null;
240
+ readonly state: "available" | "deleted" | "processing" | "quarantined" | "rejected" | "uploading";
241
+ readonly stateReason: string | null;
242
+ readonly uploadedBy: string;
243
+ readonly createdAt: number;
244
+ readonly completedAt: number | null;
245
+ }, unknown>;
246
+ /** Files you uploaded and have not attached to a record yet. */
247
+ staged: import("@rocicorp/zero").QueryDefinition<"eloxivFile", import("@rocicorp/zero").ReadonlyJSONValue | undefined, import("@rocicorp/zero").ReadonlyJSONValue | undefined, {
248
+ readonly id: string;
249
+ readonly orgId: string;
250
+ readonly ownerType: string | null;
251
+ readonly ownerId: string | null;
252
+ readonly name: string;
253
+ readonly declaredType: string;
254
+ readonly contentType: string | null;
255
+ readonly size: number;
256
+ readonly sha256: string | null;
257
+ readonly state: "available" | "deleted" | "processing" | "quarantined" | "rejected" | "uploading";
258
+ readonly stateReason: string | null;
259
+ readonly uploadedBy: string;
260
+ readonly createdAt: number;
261
+ readonly completedAt: number | null;
262
+ }, unknown>;
263
+ };
264
+ };
265
+ //# sourceMappingURL=FileSync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSync.d.ts","sourceRoot":"","sources":["../src/FileSync.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,eAAe,EAAE,CAAA;AAC1B,iEAAiE;AACjE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAkB,CAAA;AAExC,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA6B,CAAA;AAMpD,wDAAwD;AACxD,eAAO,MAAM,WAAW;IACtB,KAAK;QACH,mFAAmF;QACnF,QAAQ;6BAAoD,MAAM;yBAAe,MAAM;;;;;;;;;;;;;;;;;;;;QAGvF,gEAAgE;QAChE,MAAM;;;;;;;;;;;;;;;;;CAET,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * File metadata in each person's replica (the Files contract): the kernel's `eloxiv.file` table, generated from
3
+ * the kernel's Drizzle declaration of it (`FileTables.gen.ts`), and its named queries. An app that installs the
4
+ * kernel's `filesModule` adds `fileTables` and `fileQueries` to its sync schema (and, for files attached to its
5
+ * records, keeps those entities' tables in the schema too).
6
+ *
7
+ * The kernel filters every query that reads the table: a replica holds a file's metadata (never its bytes)
8
+ * exactly while its actor may read the record the file is attached to (that entity's read policy, evaluated
9
+ * live), or while it is a file the actor uploaded and has not attached yet; deleted files leave the replica.
10
+ */
11
+ import { createBuilder, createSchema, defineQueryWithType } from "@rocicorp/zero";
12
+ import { eloxivFileTable } from "./FileTables.gen.js";
13
+ export { eloxivFileTable };
14
+ /** The file metadata table (the generated `eloxivFileTable`). */
15
+ export const fileTable = eloxivFileTable;
16
+ export const fileTables = [eloxivFileTable];
17
+ const localSchema = createSchema({ tables: [eloxivFileTable] });
18
+ const zql = createBuilder(localSchema);
19
+ const defineQuery = defineQueryWithType();
20
+ /** Named queries (`files.ofRecord`, `files.staged`). */
21
+ export const fileQueries = {
22
+ files: {
23
+ /** The files attached to one record (the kernel keeps only those you may read). */
24
+ ofRecord: defineQuery(({ args }) => zql.eloxivFile.where("ownerType", args.entity).where("ownerId", args.id).orderBy("createdAt", "asc")),
25
+ /** Files you uploaded and have not attached to a record yet. */
26
+ staged: defineQuery(() => zql.eloxivFile.where("ownerType", "IS", null).orderBy("createdAt", "desc")),
27
+ },
28
+ };
29
+ //# sourceMappingURL=FileSync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSync.js","sourceRoot":"","sources":["../src/FileSync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,OAAO,EAAE,eAAe,EAAE,CAAA;AAC1B,iEAAiE;AACjE,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAA;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,eAAe,CAAU,CAAA;AAEpD,MAAM,WAAW,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;AAC/D,MAAM,GAAG,GAAG,aAAa,CAAC,WAAW,CAAC,CAAA;AACtC,MAAM,WAAW,GAAG,mBAAmB,EAAsB,CAAA;AAE7D,wDAAwD;AACxD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE;QACL,mFAAmF;QACnF,QAAQ,EAAE,WAAW,CAAC,CAAC,EAAE,IAAI,EAA8D,EAAE,EAAE,CAC7F,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CACrG;QACD,gEAAgE;QAChE,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;KACtG;CACF,CAAA"}