tinybase 5.3.1 → 5.3.2

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 (565) hide show
  1. package/cjs/common/index.cjs +5 -7
  2. package/cjs/common/with-schemas/index.cjs +5 -7
  3. package/cjs/es6/common/index.cjs +5 -7
  4. package/cjs/es6/common/with-schemas/index.cjs +5 -7
  5. package/cjs/es6/index.cjs +18 -12
  6. package/cjs/es6/indexes/index.cjs +0 -6
  7. package/cjs/es6/indexes/with-schemas/index.cjs +0 -6
  8. package/cjs/es6/mergeable-store/index.cjs +17 -11
  9. package/cjs/es6/mergeable-store/with-schemas/index.cjs +17 -11
  10. package/cjs/es6/metrics/index.cjs +1 -1
  11. package/cjs/es6/metrics/with-schemas/index.cjs +1 -1
  12. package/cjs/es6/min/common/index.cjs +1 -1
  13. package/cjs/es6/min/common/index.cjs.gz +0 -0
  14. package/cjs/es6/min/common/with-schemas/index.cjs +1 -1
  15. package/cjs/es6/min/common/with-schemas/index.cjs.gz +0 -0
  16. package/cjs/es6/min/index.cjs +1 -1
  17. package/cjs/es6/min/index.cjs.gz +0 -0
  18. package/cjs/es6/min/indexes/index.cjs +1 -1
  19. package/cjs/es6/min/indexes/index.cjs.gz +0 -0
  20. package/cjs/es6/min/indexes/with-schemas/index.cjs +1 -1
  21. package/cjs/es6/min/indexes/with-schemas/index.cjs.gz +0 -0
  22. package/cjs/es6/min/mergeable-store/index.cjs +1 -1
  23. package/cjs/es6/min/mergeable-store/index.cjs.gz +0 -0
  24. package/cjs/es6/min/mergeable-store/with-schemas/index.cjs +1 -1
  25. package/cjs/es6/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
  26. package/cjs/es6/min/persisters/persister-pglite/index.cjs +1 -1
  27. package/cjs/es6/min/persisters/persister-pglite/index.cjs.gz +0 -0
  28. package/cjs/es6/min/persisters/persister-pglite/with-schemas/index.cjs +1 -1
  29. package/cjs/es6/min/persisters/persister-pglite/with-schemas/index.cjs.gz +0 -0
  30. package/cjs/es6/min/store/index.cjs +1 -1
  31. package/cjs/es6/min/store/index.cjs.gz +0 -0
  32. package/cjs/es6/min/store/with-schemas/index.cjs +1 -1
  33. package/cjs/es6/min/store/with-schemas/index.cjs.gz +0 -0
  34. package/cjs/es6/min/synchronizers/index.cjs +1 -1
  35. package/cjs/es6/min/synchronizers/index.cjs.gz +0 -0
  36. package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/index.cjs +1 -1
  37. package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/index.cjs.gz +0 -0
  38. package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +1 -1
  39. package/cjs/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs.gz +0 -0
  40. package/cjs/es6/min/synchronizers/synchronizer-local/index.cjs +1 -1
  41. package/cjs/es6/min/synchronizers/synchronizer-local/index.cjs.gz +0 -0
  42. package/cjs/es6/min/synchronizers/synchronizer-local/with-schemas/index.cjs +1 -1
  43. package/cjs/es6/min/synchronizers/synchronizer-local/with-schemas/index.cjs.gz +0 -0
  44. package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
  45. package/cjs/es6/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
  46. package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
  47. package/cjs/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
  48. package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
  49. package/cjs/es6/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
  50. package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
  51. package/cjs/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
  52. package/cjs/es6/min/synchronizers/with-schemas/index.cjs +1 -1
  53. package/cjs/es6/min/synchronizers/with-schemas/index.cjs.gz +0 -0
  54. package/cjs/es6/min/tools/index.cjs +1 -1
  55. package/cjs/es6/min/tools/index.cjs.gz +0 -0
  56. package/cjs/es6/min/tools/with-schemas/index.cjs +1 -1
  57. package/cjs/es6/min/tools/with-schemas/index.cjs.gz +0 -0
  58. package/cjs/es6/min/ui-react/index.cjs +1 -1
  59. package/cjs/es6/min/ui-react/index.cjs.gz +0 -0
  60. package/cjs/es6/min/ui-react/with-schemas/index.cjs +1 -1
  61. package/cjs/es6/min/ui-react/with-schemas/index.cjs.gz +0 -0
  62. package/cjs/es6/min/ui-react-dom/index.cjs +1 -1
  63. package/cjs/es6/min/ui-react-dom/index.cjs.gz +0 -0
  64. package/cjs/es6/min/ui-react-dom/with-schemas/index.cjs +1 -1
  65. package/cjs/es6/min/ui-react-dom/with-schemas/index.cjs.gz +0 -0
  66. package/cjs/es6/min/ui-react-inspector/index.cjs +1 -1
  67. package/cjs/es6/min/ui-react-inspector/index.cjs.gz +0 -0
  68. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  69. package/cjs/es6/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  70. package/cjs/es6/min/with-schemas/index.cjs +1 -1
  71. package/cjs/es6/min/with-schemas/index.cjs.gz +0 -0
  72. package/cjs/es6/persisters/persister-pglite/index.cjs +1 -1
  73. package/cjs/es6/persisters/persister-pglite/with-schemas/index.cjs +1 -1
  74. package/cjs/es6/queries/index.cjs +1 -1
  75. package/cjs/es6/queries/with-schemas/index.cjs +1 -1
  76. package/cjs/es6/store/index.cjs +0 -6
  77. package/cjs/es6/store/with-schemas/index.cjs +0 -6
  78. package/cjs/es6/synchronizers/index.cjs +5 -7
  79. package/cjs/es6/synchronizers/synchronizer-broadcast-channel/index.cjs +5 -7
  80. package/cjs/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +5 -7
  81. package/cjs/es6/synchronizers/synchronizer-local/index.cjs +5 -7
  82. package/cjs/es6/synchronizers/synchronizer-local/with-schemas/index.cjs +5 -7
  83. package/cjs/es6/synchronizers/synchronizer-ws-client/index.cjs +5 -7
  84. package/cjs/es6/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +5 -7
  85. package/cjs/es6/synchronizers/synchronizer-ws-server/index.cjs +5 -7
  86. package/cjs/es6/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +5 -7
  87. package/cjs/es6/synchronizers/with-schemas/index.cjs +5 -7
  88. package/cjs/es6/tools/index.cjs +7 -4
  89. package/cjs/es6/tools/with-schemas/index.cjs +7 -4
  90. package/cjs/es6/ui-react/index.cjs +101 -109
  91. package/cjs/es6/ui-react/with-schemas/index.cjs +101 -109
  92. package/cjs/es6/ui-react-dom/index.cjs +14 -8
  93. package/cjs/es6/ui-react-dom/with-schemas/index.cjs +14 -8
  94. package/cjs/es6/ui-react-inspector/index.cjs +18 -16
  95. package/cjs/es6/ui-react-inspector/with-schemas/index.cjs +18 -16
  96. package/cjs/es6/with-schemas/index.cjs +18 -12
  97. package/cjs/index.cjs +18 -12
  98. package/cjs/indexes/index.cjs +0 -6
  99. package/cjs/indexes/with-schemas/index.cjs +0 -6
  100. package/cjs/mergeable-store/index.cjs +17 -11
  101. package/cjs/mergeable-store/with-schemas/index.cjs +17 -11
  102. package/cjs/metrics/index.cjs +1 -1
  103. package/cjs/metrics/with-schemas/index.cjs +1 -1
  104. package/cjs/min/common/index.cjs +1 -1
  105. package/cjs/min/common/index.cjs.gz +0 -0
  106. package/cjs/min/common/with-schemas/index.cjs +1 -1
  107. package/cjs/min/common/with-schemas/index.cjs.gz +0 -0
  108. package/cjs/min/index.cjs +1 -1
  109. package/cjs/min/index.cjs.gz +0 -0
  110. package/cjs/min/indexes/index.cjs +1 -1
  111. package/cjs/min/indexes/index.cjs.gz +0 -0
  112. package/cjs/min/indexes/with-schemas/index.cjs +1 -1
  113. package/cjs/min/indexes/with-schemas/index.cjs.gz +0 -0
  114. package/cjs/min/mergeable-store/index.cjs +1 -1
  115. package/cjs/min/mergeable-store/index.cjs.gz +0 -0
  116. package/cjs/min/mergeable-store/with-schemas/index.cjs +1 -1
  117. package/cjs/min/mergeable-store/with-schemas/index.cjs.gz +0 -0
  118. package/cjs/min/persisters/persister-pglite/index.cjs +1 -1
  119. package/cjs/min/persisters/persister-pglite/index.cjs.gz +0 -0
  120. package/cjs/min/persisters/persister-pglite/with-schemas/index.cjs +1 -1
  121. package/cjs/min/persisters/persister-pglite/with-schemas/index.cjs.gz +0 -0
  122. package/cjs/min/store/index.cjs +1 -1
  123. package/cjs/min/store/index.cjs.gz +0 -0
  124. package/cjs/min/store/with-schemas/index.cjs +1 -1
  125. package/cjs/min/store/with-schemas/index.cjs.gz +0 -0
  126. package/cjs/min/synchronizers/index.cjs +1 -1
  127. package/cjs/min/synchronizers/index.cjs.gz +0 -0
  128. package/cjs/min/synchronizers/synchronizer-broadcast-channel/index.cjs +1 -1
  129. package/cjs/min/synchronizers/synchronizer-broadcast-channel/index.cjs.gz +0 -0
  130. package/cjs/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +1 -1
  131. package/cjs/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs.gz +0 -0
  132. package/cjs/min/synchronizers/synchronizer-local/index.cjs +1 -1
  133. package/cjs/min/synchronizers/synchronizer-local/index.cjs.gz +0 -0
  134. package/cjs/min/synchronizers/synchronizer-local/with-schemas/index.cjs +1 -1
  135. package/cjs/min/synchronizers/synchronizer-local/with-schemas/index.cjs.gz +0 -0
  136. package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs +1 -1
  137. package/cjs/min/synchronizers/synchronizer-ws-client/index.cjs.gz +0 -0
  138. package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +1 -1
  139. package/cjs/min/synchronizers/synchronizer-ws-client/with-schemas/index.cjs.gz +0 -0
  140. package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs +1 -1
  141. package/cjs/min/synchronizers/synchronizer-ws-server/index.cjs.gz +0 -0
  142. package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +1 -1
  143. package/cjs/min/synchronizers/synchronizer-ws-server/with-schemas/index.cjs.gz +0 -0
  144. package/cjs/min/synchronizers/with-schemas/index.cjs +1 -1
  145. package/cjs/min/synchronizers/with-schemas/index.cjs.gz +0 -0
  146. package/cjs/min/tools/index.cjs +1 -1
  147. package/cjs/min/tools/index.cjs.gz +0 -0
  148. package/cjs/min/tools/with-schemas/index.cjs +1 -1
  149. package/cjs/min/tools/with-schemas/index.cjs.gz +0 -0
  150. package/cjs/min/ui-react/index.cjs +1 -1
  151. package/cjs/min/ui-react/index.cjs.gz +0 -0
  152. package/cjs/min/ui-react/with-schemas/index.cjs +1 -1
  153. package/cjs/min/ui-react/with-schemas/index.cjs.gz +0 -0
  154. package/cjs/min/ui-react-dom/index.cjs +1 -1
  155. package/cjs/min/ui-react-dom/index.cjs.gz +0 -0
  156. package/cjs/min/ui-react-dom/with-schemas/index.cjs +1 -1
  157. package/cjs/min/ui-react-dom/with-schemas/index.cjs.gz +0 -0
  158. package/cjs/min/ui-react-inspector/index.cjs +1 -1
  159. package/cjs/min/ui-react-inspector/index.cjs.gz +0 -0
  160. package/cjs/min/ui-react-inspector/with-schemas/index.cjs +1 -1
  161. package/cjs/min/ui-react-inspector/with-schemas/index.cjs.gz +0 -0
  162. package/cjs/min/with-schemas/index.cjs +1 -1
  163. package/cjs/min/with-schemas/index.cjs.gz +0 -0
  164. package/cjs/persisters/persister-pglite/index.cjs +1 -1
  165. package/cjs/persisters/persister-pglite/with-schemas/index.cjs +1 -1
  166. package/cjs/queries/index.cjs +1 -1
  167. package/cjs/queries/with-schemas/index.cjs +1 -1
  168. package/cjs/store/index.cjs +0 -6
  169. package/cjs/store/with-schemas/index.cjs +0 -6
  170. package/cjs/synchronizers/index.cjs +5 -7
  171. package/cjs/synchronizers/synchronizer-broadcast-channel/index.cjs +5 -7
  172. package/cjs/synchronizers/synchronizer-broadcast-channel/with-schemas/index.cjs +5 -7
  173. package/cjs/synchronizers/synchronizer-local/index.cjs +5 -7
  174. package/cjs/synchronizers/synchronizer-local/with-schemas/index.cjs +5 -7
  175. package/cjs/synchronizers/synchronizer-ws-client/index.cjs +5 -7
  176. package/cjs/synchronizers/synchronizer-ws-client/with-schemas/index.cjs +5 -7
  177. package/cjs/synchronizers/synchronizer-ws-server/index.cjs +5 -7
  178. package/cjs/synchronizers/synchronizer-ws-server/with-schemas/index.cjs +5 -7
  179. package/cjs/synchronizers/with-schemas/index.cjs +5 -7
  180. package/cjs/tools/index.cjs +7 -4
  181. package/cjs/tools/with-schemas/index.cjs +7 -4
  182. package/cjs/ui-react/index.cjs +97 -107
  183. package/cjs/ui-react/with-schemas/index.cjs +97 -107
  184. package/cjs/ui-react-dom/index.cjs +14 -8
  185. package/cjs/ui-react-dom/with-schemas/index.cjs +14 -8
  186. package/cjs/ui-react-inspector/index.cjs +18 -16
  187. package/cjs/ui-react-inspector/with-schemas/index.cjs +18 -16
  188. package/cjs/with-schemas/index.cjs +18 -12
  189. package/common/index.js +5 -7
  190. package/common/with-schemas/index.js +5 -7
  191. package/es6/common/index.js +5 -7
  192. package/es6/common/with-schemas/index.js +5 -7
  193. package/es6/index.js +18 -12
  194. package/es6/indexes/index.js +0 -6
  195. package/es6/indexes/with-schemas/index.js +0 -6
  196. package/es6/mergeable-store/index.js +17 -11
  197. package/es6/mergeable-store/with-schemas/index.js +17 -11
  198. package/es6/metrics/index.js +1 -1
  199. package/es6/metrics/with-schemas/index.js +1 -1
  200. package/es6/min/common/index.js +1 -1
  201. package/es6/min/common/index.js.gz +0 -0
  202. package/es6/min/common/with-schemas/index.js +1 -1
  203. package/es6/min/common/with-schemas/index.js.gz +0 -0
  204. package/es6/min/index.js +1 -1
  205. package/es6/min/index.js.gz +0 -0
  206. package/es6/min/indexes/index.js +1 -1
  207. package/es6/min/indexes/index.js.gz +0 -0
  208. package/es6/min/indexes/with-schemas/index.js +1 -1
  209. package/es6/min/indexes/with-schemas/index.js.gz +0 -0
  210. package/es6/min/mergeable-store/index.js +1 -1
  211. package/es6/min/mergeable-store/index.js.gz +0 -0
  212. package/es6/min/mergeable-store/with-schemas/index.js +1 -1
  213. package/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
  214. package/es6/min/persisters/persister-pglite/index.js +1 -1
  215. package/es6/min/persisters/persister-pglite/index.js.gz +0 -0
  216. package/es6/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  217. package/es6/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  218. package/es6/min/store/index.js +1 -1
  219. package/es6/min/store/index.js.gz +0 -0
  220. package/es6/min/store/with-schemas/index.js +1 -1
  221. package/es6/min/store/with-schemas/index.js.gz +0 -0
  222. package/es6/min/synchronizers/index.js +1 -1
  223. package/es6/min/synchronizers/index.js.gz +0 -0
  224. package/es6/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
  225. package/es6/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
  226. package/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
  227. package/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
  228. package/es6/min/synchronizers/synchronizer-local/index.js +1 -1
  229. package/es6/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  230. package/es6/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  231. package/es6/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  232. package/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  233. package/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  234. package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  235. package/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  236. package/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  237. package/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  238. package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  239. package/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  240. package/es6/min/synchronizers/with-schemas/index.js +1 -1
  241. package/es6/min/synchronizers/with-schemas/index.js.gz +0 -0
  242. package/es6/min/tools/index.js +1 -1
  243. package/es6/min/tools/index.js.gz +0 -0
  244. package/es6/min/tools/with-schemas/index.js +1 -1
  245. package/es6/min/tools/with-schemas/index.js.gz +0 -0
  246. package/es6/min/ui-react/index.js +1 -1
  247. package/es6/min/ui-react/index.js.gz +0 -0
  248. package/es6/min/ui-react/with-schemas/index.js +1 -1
  249. package/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  250. package/es6/min/ui-react-dom/index.js +1 -1
  251. package/es6/min/ui-react-dom/index.js.gz +0 -0
  252. package/es6/min/ui-react-dom/with-schemas/index.js +1 -1
  253. package/es6/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  254. package/es6/min/ui-react-inspector/index.js +1 -1
  255. package/es6/min/ui-react-inspector/index.js.gz +0 -0
  256. package/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  257. package/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  258. package/es6/min/with-schemas/index.js +1 -1
  259. package/es6/min/with-schemas/index.js.gz +0 -0
  260. package/es6/persisters/persister-pglite/index.js +1 -1
  261. package/es6/persisters/persister-pglite/with-schemas/index.js +1 -1
  262. package/es6/queries/index.js +1 -1
  263. package/es6/queries/with-schemas/index.js +1 -1
  264. package/es6/store/index.js +0 -6
  265. package/es6/store/with-schemas/index.js +0 -6
  266. package/es6/synchronizers/index.js +5 -7
  267. package/es6/synchronizers/synchronizer-broadcast-channel/index.js +5 -7
  268. package/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -7
  269. package/es6/synchronizers/synchronizer-local/index.js +5 -7
  270. package/es6/synchronizers/synchronizer-local/with-schemas/index.js +5 -7
  271. package/es6/synchronizers/synchronizer-ws-client/index.js +5 -7
  272. package/es6/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -7
  273. package/es6/synchronizers/synchronizer-ws-server/index.js +5 -7
  274. package/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -7
  275. package/es6/synchronizers/with-schemas/index.js +5 -7
  276. package/es6/tools/index.js +7 -4
  277. package/es6/tools/with-schemas/index.js +7 -4
  278. package/es6/ui-react/index.js +101 -109
  279. package/es6/ui-react/with-schemas/index.js +101 -109
  280. package/es6/ui-react-dom/index.js +14 -8
  281. package/es6/ui-react-dom/with-schemas/index.js +14 -8
  282. package/es6/ui-react-inspector/index.js +18 -16
  283. package/es6/ui-react-inspector/with-schemas/index.js +18 -16
  284. package/es6/with-schemas/index.js +18 -12
  285. package/index.js +18 -12
  286. package/indexes/index.js +0 -6
  287. package/indexes/with-schemas/index.js +0 -6
  288. package/mergeable-store/index.js +17 -11
  289. package/mergeable-store/with-schemas/index.js +17 -11
  290. package/metrics/index.js +1 -1
  291. package/metrics/with-schemas/index.js +1 -1
  292. package/min/common/index.js +1 -1
  293. package/min/common/index.js.gz +0 -0
  294. package/min/common/with-schemas/index.js +1 -1
  295. package/min/common/with-schemas/index.js.gz +0 -0
  296. package/min/index.js +1 -1
  297. package/min/index.js.gz +0 -0
  298. package/min/indexes/index.js +1 -1
  299. package/min/indexes/index.js.gz +0 -0
  300. package/min/indexes/with-schemas/index.js +1 -1
  301. package/min/indexes/with-schemas/index.js.gz +0 -0
  302. package/min/mergeable-store/index.js +1 -1
  303. package/min/mergeable-store/index.js.gz +0 -0
  304. package/min/mergeable-store/with-schemas/index.js +1 -1
  305. package/min/mergeable-store/with-schemas/index.js.gz +0 -0
  306. package/min/persisters/persister-pglite/index.js +1 -1
  307. package/min/persisters/persister-pglite/index.js.gz +0 -0
  308. package/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  309. package/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  310. package/min/store/index.js +1 -1
  311. package/min/store/index.js.gz +0 -0
  312. package/min/store/with-schemas/index.js +1 -1
  313. package/min/store/with-schemas/index.js.gz +0 -0
  314. package/min/synchronizers/index.js +1 -1
  315. package/min/synchronizers/index.js.gz +0 -0
  316. package/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
  317. package/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
  318. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
  319. package/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
  320. package/min/synchronizers/synchronizer-local/index.js +1 -1
  321. package/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  322. package/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  323. package/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  324. package/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  325. package/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  326. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  327. package/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  328. package/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  329. package/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  330. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  331. package/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  332. package/min/synchronizers/with-schemas/index.js +1 -1
  333. package/min/synchronizers/with-schemas/index.js.gz +0 -0
  334. package/min/tools/index.js +1 -1
  335. package/min/tools/index.js.gz +0 -0
  336. package/min/tools/with-schemas/index.js +1 -1
  337. package/min/tools/with-schemas/index.js.gz +0 -0
  338. package/min/ui-react/index.js +1 -1
  339. package/min/ui-react/index.js.gz +0 -0
  340. package/min/ui-react/with-schemas/index.js +1 -1
  341. package/min/ui-react/with-schemas/index.js.gz +0 -0
  342. package/min/ui-react-dom/index.js +1 -1
  343. package/min/ui-react-dom/index.js.gz +0 -0
  344. package/min/ui-react-dom/with-schemas/index.js +1 -1
  345. package/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  346. package/min/ui-react-inspector/index.js +1 -1
  347. package/min/ui-react-inspector/index.js.gz +0 -0
  348. package/min/ui-react-inspector/with-schemas/index.js +1 -1
  349. package/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  350. package/min/with-schemas/index.js +1 -1
  351. package/min/with-schemas/index.js.gz +0 -0
  352. package/package.json +3 -3
  353. package/persisters/persister-pglite/index.js +1 -1
  354. package/persisters/persister-pglite/with-schemas/index.js +1 -1
  355. package/queries/index.js +1 -1
  356. package/queries/with-schemas/index.js +1 -1
  357. package/store/index.js +0 -6
  358. package/store/with-schemas/index.js +0 -6
  359. package/synchronizers/index.js +5 -7
  360. package/synchronizers/synchronizer-broadcast-channel/index.js +5 -7
  361. package/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -7
  362. package/synchronizers/synchronizer-local/index.js +5 -7
  363. package/synchronizers/synchronizer-local/with-schemas/index.js +5 -7
  364. package/synchronizers/synchronizer-ws-client/index.js +5 -7
  365. package/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -7
  366. package/synchronizers/synchronizer-ws-server/index.js +5 -7
  367. package/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -7
  368. package/synchronizers/with-schemas/index.js +5 -7
  369. package/tools/index.js +7 -4
  370. package/tools/with-schemas/index.js +7 -4
  371. package/ui-react/index.js +97 -107
  372. package/ui-react/with-schemas/index.js +97 -107
  373. package/ui-react-dom/index.js +14 -8
  374. package/ui-react-dom/with-schemas/index.js +14 -8
  375. package/ui-react-inspector/index.js +18 -16
  376. package/ui-react-inspector/with-schemas/index.js +18 -16
  377. package/umd/common/index.js +5 -7
  378. package/umd/common/with-schemas/index.js +5 -7
  379. package/umd/es6/common/index.js +5 -7
  380. package/umd/es6/common/with-schemas/index.js +5 -7
  381. package/umd/es6/index.js +18 -12
  382. package/umd/es6/indexes/index.js +0 -6
  383. package/umd/es6/indexes/with-schemas/index.js +0 -6
  384. package/umd/es6/mergeable-store/index.js +17 -11
  385. package/umd/es6/mergeable-store/with-schemas/index.js +17 -11
  386. package/umd/es6/metrics/index.js +1 -1
  387. package/umd/es6/metrics/with-schemas/index.js +1 -1
  388. package/umd/es6/min/common/index.js +1 -1
  389. package/umd/es6/min/common/index.js.gz +0 -0
  390. package/umd/es6/min/common/with-schemas/index.js +1 -1
  391. package/umd/es6/min/common/with-schemas/index.js.gz +0 -0
  392. package/umd/es6/min/index.js +1 -1
  393. package/umd/es6/min/index.js.gz +0 -0
  394. package/umd/es6/min/indexes/index.js +1 -1
  395. package/umd/es6/min/indexes/index.js.gz +0 -0
  396. package/umd/es6/min/indexes/with-schemas/index.js +1 -1
  397. package/umd/es6/min/indexes/with-schemas/index.js.gz +0 -0
  398. package/umd/es6/min/mergeable-store/index.js +1 -1
  399. package/umd/es6/min/mergeable-store/index.js.gz +0 -0
  400. package/umd/es6/min/mergeable-store/with-schemas/index.js +1 -1
  401. package/umd/es6/min/mergeable-store/with-schemas/index.js.gz +0 -0
  402. package/umd/es6/min/persisters/persister-pglite/index.js +1 -1
  403. package/umd/es6/min/persisters/persister-pglite/index.js.gz +0 -0
  404. package/umd/es6/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  405. package/umd/es6/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  406. package/umd/es6/min/store/index.js +1 -1
  407. package/umd/es6/min/store/index.js.gz +0 -0
  408. package/umd/es6/min/store/with-schemas/index.js +1 -1
  409. package/umd/es6/min/store/with-schemas/index.js.gz +0 -0
  410. package/umd/es6/min/synchronizers/index.js +1 -1
  411. package/umd/es6/min/synchronizers/index.js.gz +0 -0
  412. package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
  413. package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
  414. package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
  415. package/umd/es6/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
  416. package/umd/es6/min/synchronizers/synchronizer-local/index.js +1 -1
  417. package/umd/es6/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  418. package/umd/es6/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  419. package/umd/es6/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  420. package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  421. package/umd/es6/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  422. package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  423. package/umd/es6/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  424. package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  425. package/umd/es6/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  426. package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  427. package/umd/es6/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  428. package/umd/es6/min/synchronizers/with-schemas/index.js +1 -1
  429. package/umd/es6/min/synchronizers/with-schemas/index.js.gz +0 -0
  430. package/umd/es6/min/tools/index.js +1 -1
  431. package/umd/es6/min/tools/index.js.gz +0 -0
  432. package/umd/es6/min/tools/with-schemas/index.js +1 -1
  433. package/umd/es6/min/tools/with-schemas/index.js.gz +0 -0
  434. package/umd/es6/min/ui-react/index.js +1 -1
  435. package/umd/es6/min/ui-react/index.js.gz +0 -0
  436. package/umd/es6/min/ui-react/with-schemas/index.js +1 -1
  437. package/umd/es6/min/ui-react/with-schemas/index.js.gz +0 -0
  438. package/umd/es6/min/ui-react-dom/index.js +1 -1
  439. package/umd/es6/min/ui-react-dom/index.js.gz +0 -0
  440. package/umd/es6/min/ui-react-dom/with-schemas/index.js +1 -1
  441. package/umd/es6/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  442. package/umd/es6/min/ui-react-inspector/index.js +1 -1
  443. package/umd/es6/min/ui-react-inspector/index.js.gz +0 -0
  444. package/umd/es6/min/ui-react-inspector/with-schemas/index.js +1 -1
  445. package/umd/es6/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  446. package/umd/es6/min/with-schemas/index.js +1 -1
  447. package/umd/es6/min/with-schemas/index.js.gz +0 -0
  448. package/umd/es6/persisters/persister-pglite/index.js +1 -1
  449. package/umd/es6/persisters/persister-pglite/with-schemas/index.js +1 -1
  450. package/umd/es6/queries/index.js +1 -1
  451. package/umd/es6/queries/with-schemas/index.js +1 -1
  452. package/umd/es6/store/index.js +0 -6
  453. package/umd/es6/store/with-schemas/index.js +0 -6
  454. package/umd/es6/synchronizers/index.js +5 -7
  455. package/umd/es6/synchronizers/synchronizer-broadcast-channel/index.js +5 -7
  456. package/umd/es6/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -7
  457. package/umd/es6/synchronizers/synchronizer-local/index.js +5 -7
  458. package/umd/es6/synchronizers/synchronizer-local/with-schemas/index.js +5 -7
  459. package/umd/es6/synchronizers/synchronizer-ws-client/index.js +5 -7
  460. package/umd/es6/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -7
  461. package/umd/es6/synchronizers/synchronizer-ws-server/index.js +5 -7
  462. package/umd/es6/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -7
  463. package/umd/es6/synchronizers/with-schemas/index.js +5 -7
  464. package/umd/es6/tools/index.js +7 -4
  465. package/umd/es6/tools/with-schemas/index.js +7 -4
  466. package/umd/es6/ui-react/index.js +101 -118
  467. package/umd/es6/ui-react/with-schemas/index.js +101 -118
  468. package/umd/es6/ui-react-dom/index.js +14 -8
  469. package/umd/es6/ui-react-dom/with-schemas/index.js +14 -8
  470. package/umd/es6/ui-react-inspector/index.js +18 -16
  471. package/umd/es6/ui-react-inspector/with-schemas/index.js +18 -16
  472. package/umd/es6/with-schemas/index.js +18 -12
  473. package/umd/index.js +18 -12
  474. package/umd/indexes/index.js +0 -6
  475. package/umd/indexes/with-schemas/index.js +0 -6
  476. package/umd/mergeable-store/index.js +17 -11
  477. package/umd/mergeable-store/with-schemas/index.js +17 -11
  478. package/umd/metrics/index.js +1 -1
  479. package/umd/metrics/with-schemas/index.js +1 -1
  480. package/umd/min/common/index.js +1 -1
  481. package/umd/min/common/index.js.gz +0 -0
  482. package/umd/min/common/with-schemas/index.js +1 -1
  483. package/umd/min/common/with-schemas/index.js.gz +0 -0
  484. package/umd/min/index.js +1 -1
  485. package/umd/min/index.js.gz +0 -0
  486. package/umd/min/indexes/index.js +1 -1
  487. package/umd/min/indexes/index.js.gz +0 -0
  488. package/umd/min/indexes/with-schemas/index.js +1 -1
  489. package/umd/min/indexes/with-schemas/index.js.gz +0 -0
  490. package/umd/min/mergeable-store/index.js +1 -1
  491. package/umd/min/mergeable-store/index.js.gz +0 -0
  492. package/umd/min/mergeable-store/with-schemas/index.js +1 -1
  493. package/umd/min/mergeable-store/with-schemas/index.js.gz +0 -0
  494. package/umd/min/persisters/persister-pglite/index.js +1 -1
  495. package/umd/min/persisters/persister-pglite/index.js.gz +0 -0
  496. package/umd/min/persisters/persister-pglite/with-schemas/index.js +1 -1
  497. package/umd/min/persisters/persister-pglite/with-schemas/index.js.gz +0 -0
  498. package/umd/min/store/index.js +1 -1
  499. package/umd/min/store/index.js.gz +0 -0
  500. package/umd/min/store/with-schemas/index.js +1 -1
  501. package/umd/min/store/with-schemas/index.js.gz +0 -0
  502. package/umd/min/synchronizers/index.js +1 -1
  503. package/umd/min/synchronizers/index.js.gz +0 -0
  504. package/umd/min/synchronizers/synchronizer-broadcast-channel/index.js +1 -1
  505. package/umd/min/synchronizers/synchronizer-broadcast-channel/index.js.gz +0 -0
  506. package/umd/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +1 -1
  507. package/umd/min/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js.gz +0 -0
  508. package/umd/min/synchronizers/synchronizer-local/index.js +1 -1
  509. package/umd/min/synchronizers/synchronizer-local/index.js.gz +0 -0
  510. package/umd/min/synchronizers/synchronizer-local/with-schemas/index.js +1 -1
  511. package/umd/min/synchronizers/synchronizer-local/with-schemas/index.js.gz +0 -0
  512. package/umd/min/synchronizers/synchronizer-ws-client/index.js +1 -1
  513. package/umd/min/synchronizers/synchronizer-ws-client/index.js.gz +0 -0
  514. package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js +1 -1
  515. package/umd/min/synchronizers/synchronizer-ws-client/with-schemas/index.js.gz +0 -0
  516. package/umd/min/synchronizers/synchronizer-ws-server/index.js +1 -1
  517. package/umd/min/synchronizers/synchronizer-ws-server/index.js.gz +0 -0
  518. package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js +1 -1
  519. package/umd/min/synchronizers/synchronizer-ws-server/with-schemas/index.js.gz +0 -0
  520. package/umd/min/synchronizers/with-schemas/index.js +1 -1
  521. package/umd/min/synchronizers/with-schemas/index.js.gz +0 -0
  522. package/umd/min/tools/index.js +1 -1
  523. package/umd/min/tools/index.js.gz +0 -0
  524. package/umd/min/tools/with-schemas/index.js +1 -1
  525. package/umd/min/tools/with-schemas/index.js.gz +0 -0
  526. package/umd/min/ui-react/index.js +1 -1
  527. package/umd/min/ui-react/index.js.gz +0 -0
  528. package/umd/min/ui-react/with-schemas/index.js +1 -1
  529. package/umd/min/ui-react/with-schemas/index.js.gz +0 -0
  530. package/umd/min/ui-react-dom/index.js +1 -1
  531. package/umd/min/ui-react-dom/index.js.gz +0 -0
  532. package/umd/min/ui-react-dom/with-schemas/index.js +1 -1
  533. package/umd/min/ui-react-dom/with-schemas/index.js.gz +0 -0
  534. package/umd/min/ui-react-inspector/index.js +1 -1
  535. package/umd/min/ui-react-inspector/index.js.gz +0 -0
  536. package/umd/min/ui-react-inspector/with-schemas/index.js +1 -1
  537. package/umd/min/ui-react-inspector/with-schemas/index.js.gz +0 -0
  538. package/umd/min/with-schemas/index.js +1 -1
  539. package/umd/min/with-schemas/index.js.gz +0 -0
  540. package/umd/persisters/persister-pglite/index.js +1 -1
  541. package/umd/persisters/persister-pglite/with-schemas/index.js +1 -1
  542. package/umd/queries/index.js +1 -1
  543. package/umd/queries/with-schemas/index.js +1 -1
  544. package/umd/store/index.js +0 -6
  545. package/umd/store/with-schemas/index.js +0 -6
  546. package/umd/synchronizers/index.js +5 -7
  547. package/umd/synchronizers/synchronizer-broadcast-channel/index.js +5 -7
  548. package/umd/synchronizers/synchronizer-broadcast-channel/with-schemas/index.js +5 -7
  549. package/umd/synchronizers/synchronizer-local/index.js +5 -7
  550. package/umd/synchronizers/synchronizer-local/with-schemas/index.js +5 -7
  551. package/umd/synchronizers/synchronizer-ws-client/index.js +5 -7
  552. package/umd/synchronizers/synchronizer-ws-client/with-schemas/index.js +5 -7
  553. package/umd/synchronizers/synchronizer-ws-server/index.js +5 -7
  554. package/umd/synchronizers/synchronizer-ws-server/with-schemas/index.js +5 -7
  555. package/umd/synchronizers/with-schemas/index.js +5 -7
  556. package/umd/tools/index.js +7 -4
  557. package/umd/tools/with-schemas/index.js +7 -4
  558. package/umd/ui-react/index.js +97 -110
  559. package/umd/ui-react/with-schemas/index.js +97 -110
  560. package/umd/ui-react-dom/index.js +14 -8
  561. package/umd/ui-react-dom/with-schemas/index.js +14 -8
  562. package/umd/ui-react-inspector/index.js +18 -16
  563. package/umd/ui-react-inspector/with-schemas/index.js +18 -16
  564. package/umd/with-schemas/index.js +18 -12
  565. package/with-schemas/index.js +18 -12
@@ -1 +1 @@
1
- const e=Promise,t=globalThis,a=Math,n=a.floor,s=e=>null==e,o=(e,t,a)=>s(e)?a?.():t(e),r=e=>Array.isArray(e),i=e=>e.length,l=e=>{throw Error(e)},c=(e,t)=>e.forEach(t),g=(e,t)=>e.map(t),u=(e,...t)=>e.push(...t),d=e=>e.shift(),y=Object,f=e=>y.getPrototypeOf(e),h=y.entries,p=y.keys,w=y.freeze,v=(e,t)=>c(h(e),(([e,a])=>t(a,e))),b=e=>(e=>!s(e)&&o(f(e),(e=>e==y.prototype||s(f(e))),(()=>!0)))(e)&&0==(e=>i(p(e)))(e),C=(e,t,a)=>(((e,t)=>t in e)(e,t)||(e[t]=a()),e[t]),M=e=>s(e)||0==(e=>e?.size??0)(e),S=(e,t)=>e?.forEach(t),A=(e,t)=>e?.delete(t),D=e=>new Map(e),L=(e,t)=>e?.get(t),T=(e,t,a)=>s(a)?(A(e,t),e):e?.set(t,a),H=(e,t,a,n)=>{var s,o;return s=e,o=t,s?.has(o)?n?.(L(e,t)):T(e,t,a()),L(e,t)},m=(e,t,a,n,s=0)=>o((a?H:L)(e,t[s],s>i(t)-2?a:D),(o=>{if(s>i(t)-2)return n?.(o)&&T(e,t[s]),o;const r=m(o,t,a,n,s+1);return M(o)&&T(e,t[s]),r}));new t.TextEncoder;const E=(e,t)=>t?[e,t]:[e],G=(e,t)=>((e??"")>(t??"")?e:t)??"",R=(e="")=>E(((e=[])=>y.fromEntries(e))(),e),V=e=>new Set(r(e)||s(e)?e:[e]),z=/^\d+$/,P=D(),x=D(),O=(e,t,a,n,g,y,f,h={},p=[])=>{let v,C,E,G=0,R=0,O=0;H(P,p,(()=>0)),H(x,p,(()=>[]));const $=D(),[j,k,F,N,U]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!b(e)||!b(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!b(e)||!b(t),t.setContent]:l("Store type not supported by this Persister"))(f,e),[q,B,I]=(()=>{let e;const[t,a]=(()=>{const e=[];let t=0;return[a=>(a?d(e):null)??""+t++,t=>{z.test(t)&&i(e)<1e3&&u(e,t)}]})(),n=D();return[(a,s,o,r=[],i=()=>[])=>{e??=_;const l=t(1);var c,g;return T(n,l,[a,s,o,r,i]),c=m(s,o??[""],V),g=l,c?.add(g),l},(t,a,...s)=>c(((e,t=[""])=>{const a=[],n=(e,s)=>s==i(t)?u(a,e):null===t[s]?S(e,(e=>n(e,s+1))):c([t[s],null],(t=>n(L(e,t),s+1)));return n(e,0),a})(t,a),(t=>S(t,(t=>L(n,t)[0](e,...a??[],...s))))),e=>o(L(n,e),(([,t,s])=>(m(t,s??[""],void 0,(t=>(A(t,e),M(t)?1:0))),T(n,e),a(e),s))),t=>o(L(n,t),(([t,,a=[],n,o])=>{const r=(...l)=>{const g=i(l);g==i(a)?t(e,...l,...o(l)):s(a[g])?c(n[g]?.(...l)??[],(e=>r(...l,e))):r(...l,a[g])};r()}))]})(),J=e=>{e!=G&&(G=e,B($,void 0,G))},K=t=>{(j&&r(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},Q=async e=>(2!=G&&(J(1),R++,await Z((async()=>{try{const e=await t();r(e)?K(e):l("Content is not an array "+e)}catch(t){y?.(t),e&&U(e)}J(0)}))),_),W=()=>(C&&(g(C),C=void 0),_),X=async e=>(1!=G&&(J(2),O++,await Z((async()=>{try{await a(k,e)}catch(e){y?.(e)}J(0)}))),_),Y=()=>(o(E,e.delListener),E=void 0,_),Z=async(...e)=>(u(L(x,p),...e),await(async()=>{if(!L(P,p)){for(T(P,p,1);!s(v=d(L(x,p)));)try{await v()}catch(e){y?.(e)}T(P,p,0)}})(),_),_={load:Q,startAutoLoad:async e=>{await W().load(e);try{C=await n((async(e,t)=>{t||e?2!=G&&(J(1),R++,K(t??e),J(0)):await Q()}))}catch(e){y?.(e)}return _},stopAutoLoad:W,isAutoLoading:()=>!s(C),save:X,startAutoSave:async()=>(await Y().save(),E=e.addDidFinishTransactionListener((()=>{const e=F();N(e)&&X(e)})),_),stopAutoSave:Y,isAutoSaving:()=>!s(E),getStatus:()=>G,addStatusListener:e=>q(e,$),delListener:t=>(I(t),e),schedule:Z,getStore:()=>e,destroy:()=>(L(x,p).splice(0,void 0),W().stopAutoSave()),getStats:()=>({loads:R,saves:O}),...h};return w(_)},$="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split("");D(g($,((e,t)=>[e,t])));const j=t.crypto?e=>t.crypto.getRandomValues(e):e=>g(e,(()=>n(256*a.random()))),k={Response:0,GetContentHashes:1,ContentHashes:2,ContentDiff:3,GetTableDiff:4,GetRowDiff:5,GetCellDiff:6,GetValueDiff:7},F=(t,a,n,r,i,l,c,g,u={})=>{let d,y=0,f=0;const h=D(),p=(e,t,n,s)=>{y++,l?.(e,t,n,s),a(e,t,n,s)},w=async(t,a,n="")=>new e(((e,s)=>{const o=((e=16)=>{return t=(e,t)=>e+$[63&t],j(new Uint8Array(e)).reduce(t,"");var t})(),r=setTimeout((()=>{A(h,o),s(`No response from ${t??"anyone"} to ${o}, `+a)}),1e3*i);T(h,o,[t,(t,a)=>{clearTimeout(r),A(h,o),e([t,a])}]),p(t,o,a,n)})),M=(e,[t,a])=>{v(t,(([t,a],n)=>{const s=C(e[0],n,R);v(t,(([e,t],a)=>{const n=C(s[0],a,R);v(e,(([e,t],a)=>n[0][a]=E(e,t))),n[1]=G(n[1],t)})),s[1]=G(s[1],a)})),e[1]=G(e[1],a)},S=async(e=null,a)=>{s(a)&&([a,e]=await w(e,1));const[n,o]=a,[r,i]=t.getMergeableContentHashes();let l=R();if(r!=n){const[a,n]=(await w(e,4,t.getMergeableTableHashes()))[0];if(l=a,!b(n)){const[a,s]=(await w(e,5,t.getMergeableRowHashes(n)))[0];if(M(l,a),!b(s)){const a=(await w(e,6,t.getMergeableCellHashes(s)))[0];M(l,a)}}}return[l,i==o?R():(await w(e,7,t.getMergeableValueHashes()))[0],1]},H=O(t,(async()=>{const e=await S();return b(e[0][0])&&b(e[1][0])?void 0:e}),(async(e,a)=>a?p(null,null,3,a):p(null,null,2,t.getMergeableContentHashes())),(e=>d=e),(()=>d=void 0),g,2,{startSync:async e=>await(await H.startAutoLoad(e)).startAutoSave(),stopSync:()=>H.stopAutoLoad().stopAutoSave(),destroy:()=>(r(),H.stopSync()),getSynchronizerStats:()=>({sends:y,receives:f}),...u});return n(((e,a,n,r)=>{f++,c?.(e,a,n,r),0==n?o(L(h,a),(([t,a])=>s(t)||t==e?a(r,e):0)):2==n&&H.isAutoLoading()?S(e,r).then((e=>{d?.(void 0,e)})):3==n&&H.isAutoLoading()?d?.(void 0,r):o(1==n&&H.isAutoSaving()?t.getMergeableContentHashes():4==n?t.getMergeableTableDiff(r):5==n?t.getMergeableRowDiff(r):6==n?t.getMergeableCellDiff(r):7==n?t.getMergeableValueDiff(r):void 0,(t=>{p(e,a,0,t)}))})),H};export{k as Message,F as createCustomSynchronizer};
1
+ const e=Promise,t=globalThis,a=Math,n=a.floor,s=e=>null==e,o=(e,t,a)=>s(e)?a?.():t(e),r=e=>Array.isArray(e),i=e=>e.length,l=e=>{throw Error(e)},c=(e,t)=>e.forEach(t),g=(e,...t)=>e.push(...t),u=e=>e.shift(),d=Object,y=e=>d.getPrototypeOf(e),f=d.entries,h=d.keys,p=d.freeze,w=(e,t)=>c(f(e),(([e,a])=>t(a,e))),v=e=>(e=>!s(e)&&o(y(e),(e=>e==d.prototype||s(y(e))),(()=>!0)))(e)&&0==(e=>i(h(e)))(e),b=(e,t,a)=>(((e,t)=>t in e)(e,t)||(e[t]=a()),e[t]),C=e=>s(e)||0==(e=>e?.size??0)(e),M=(e,t)=>e?.forEach(t),S=(e,t)=>e?.delete(t),A=e=>new Map(e),D=(e,t)=>e?.get(t),L=(e,t,a)=>s(a)?(S(e,t),e):e?.set(t,a),H=(e,t,a,n)=>{var s,o;return s=e,o=t,s?.has(o)?n?.(D(e,t)):L(e,t,a()),D(e,t)},T=(e,t,a,n,s=0)=>o((a?H:D)(e,t[s],s>i(t)-2?a:A),(o=>{if(s>i(t)-2)return n?.(o)&&L(e,t[s]),o;const r=T(o,t,a,n,s+1);return C(o)&&L(e,t[s]),r})),m=(e,t)=>t?[e,t]:[e],G=(e,t)=>((e??"")>(t??"")?e:t)??"",R=(e="")=>m(((e=[])=>d.fromEntries(e))(),e),E=e=>new Set(r(e)||s(e)?e:[e]),V=/^\d+$/,z=A(),P=A(),O=(e,t,a,n,d,y,f,h={},w=[])=>{let b,m,G,R=0,O=0,$=0;H(z,w,(()=>0)),H(P,w,(()=>[]));const j=A(),[k,x,F,N,U]=((e=1,t)=>1!=e&&t.isMergeable()?[1,t.getMergeableContent,t.getTransactionMergeableChanges,([[e],[t]])=>!v(e)||!v(t),t.setDefaultContent]:2!=e?[0,t.getContent,t.getTransactionChanges,([e,t])=>!v(e)||!v(t),t.setContent]:l("Store type not supported by this Persister"))(f,e),[q,B,I]=(()=>{let e;const[t,a]=(()=>{const e=[];let t=0;return[a=>(a?u(e):null)??""+t++,t=>{V.test(t)&&i(e)<1e3&&g(e,t)}]})(),n=A();return[(a,s,o,r=[],i=()=>[])=>{e??=_;const l=t(1);var c,g;return L(n,l,[a,s,o,r,i]),c=T(s,o??[""],E),g=l,c?.add(g),l},(t,a,...s)=>c(((e,t=[""])=>{const a=[],n=(e,s)=>s==i(t)?g(a,e):null===t[s]?M(e,(e=>n(e,s+1))):c([t[s],null],(t=>n(D(e,t),s+1)));return n(e,0),a})(t,a),(t=>M(t,(t=>D(n,t)[0](e,...a??[],...s))))),e=>o(D(n,e),(([,t,s])=>(T(t,s??[""],void 0,(t=>(S(t,e),C(t)?1:0))),L(n,e),a(e),s))),t=>o(D(n,t),(([t,,a=[],n,o])=>{const r=(...l)=>{const g=i(l);g==i(a)?t(e,...l,...o(l)):s(a[g])?c(n[g]?.(...l)??[],(e=>r(...l,e))):r(...l,a[g])};r()}))]})(),J=e=>{e!=R&&(R=e,B(j,void 0,R))},K=t=>{(k&&r(t?.[0])?1===t?.[2]?e.applyMergeableChanges:e.setMergeableContent:1===t?.[2]?e.applyChanges:e.setContent)(t)},Q=async e=>(2!=R&&(J(1),O++,await Z((async()=>{try{const e=await t();r(e)?K(e):l("Content is not an array "+e)}catch(t){y?.(t),e&&U(e)}J(0)}))),_),W=()=>(m&&(d(m),m=void 0),_),X=async e=>(1!=R&&(J(2),$++,await Z((async()=>{try{await a(x,e)}catch(e){y?.(e)}J(0)}))),_),Y=()=>(o(G,e.delListener),G=void 0,_),Z=async(...e)=>(g(D(P,w),...e),await(async()=>{if(!D(z,w)){for(L(z,w,1);!s(b=u(D(P,w)));)try{await b()}catch(e){y?.(e)}L(z,w,0)}})(),_),_={load:Q,startAutoLoad:async e=>{await W().load(e);try{m=await n((async(e,t)=>{t||e?2!=R&&(J(1),O++,K(t??e),J(0)):await Q()}))}catch(e){y?.(e)}return _},stopAutoLoad:W,isAutoLoading:()=>!s(m),save:X,startAutoSave:async()=>(await Y().save(),G=e.addDidFinishTransactionListener((()=>{const e=F();N(e)&&X(e)})),_),stopAutoSave:Y,isAutoSaving:()=>!s(G),getStatus:()=>R,addStatusListener:e=>q(e,j),delListener:t=>(I(t),e),schedule:Z,getStore:()=>e,destroy:()=>(D(P,w).splice(0,void 0),W().stopAutoSave()),getStats:()=>({loads:O,saves:$}),...h};return p(_)},$=((e,t="")=>"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz".split(t,void 0))(),j=t.crypto?e=>t.crypto.getRandomValues(e):e=>(e=>e.map((()=>n(256*a.random()))))(e),k={Response:0,GetContentHashes:1,ContentHashes:2,ContentDiff:3,GetTableDiff:4,GetRowDiff:5,GetCellDiff:6,GetValueDiff:7},x=(t,a,n,r,i,l,c,g,u={})=>{let d,y=0,f=0;const h=A(),p=(e,t,n,s)=>{y++,l?.(e,t,n,s),a(e,t,n,s)},C=async(t,a,n="")=>new e(((e,s)=>{const o=((e=16)=>{return t=(e,t)=>e+$[63&t],j(new Uint8Array(e)).reduce(t,"");var t})(),r=setTimeout((()=>{S(h,o),s(`No response from ${t??"anyone"} to ${o}, `+a)}),1e3*i);L(h,o,[t,(t,a)=>{clearTimeout(r),S(h,o),e([t,a])}]),p(t,o,a,n)})),M=(e,[t,a])=>{w(t,(([t,a],n)=>{const s=b(e[0],n,R);w(t,(([e,t],a)=>{const n=b(s[0],a,R);w(e,(([e,t],a)=>n[0][a]=m(e,t))),n[1]=G(n[1],t)})),s[1]=G(s[1],a)})),e[1]=G(e[1],a)},H=async(e=null,a)=>{s(a)&&([a,e]=await C(e,1));const[n,o]=a,[r,i]=t.getMergeableContentHashes();let l=R();if(r!=n){const[a,n]=(await C(e,4,t.getMergeableTableHashes()))[0];if(l=a,!v(n)){const[a,s]=(await C(e,5,t.getMergeableRowHashes(n)))[0];if(M(l,a),!v(s)){const a=(await C(e,6,t.getMergeableCellHashes(s)))[0];M(l,a)}}}return[l,i==o?R():(await C(e,7,t.getMergeableValueHashes()))[0],1]},T=O(t,(async()=>{const e=await H();return v(e[0][0])&&v(e[1][0])?void 0:e}),(async(e,a)=>a?p(null,null,3,a):p(null,null,2,t.getMergeableContentHashes())),(e=>d=e),(()=>d=void 0),g,2,{startSync:async e=>await(await T.startAutoLoad(e)).startAutoSave(),stopSync:()=>T.stopAutoLoad().stopAutoSave(),destroy:()=>(r(),T.stopSync()),getSynchronizerStats:()=>({sends:y,receives:f}),...u});return n(((e,a,n,r)=>{f++,c?.(e,a,n,r),0==n?o(D(h,a),(([t,a])=>s(t)||t==e?a(r,e):0)):2==n&&T.isAutoLoading()?H(e,r).then((e=>{d?.(void 0,e)})):3==n&&T.isAutoLoading()?d?.(void 0,r):o(1==n&&T.isAutoSaving()?t.getMergeableContentHashes():4==n?t.getMergeableTableDiff(r):5==n?t.getMergeableRowDiff(r):6==n?t.getMergeableCellDiff(r):7==n?t.getMergeableValueDiff(r):void 0,(t=>{p(e,a,0,t)}))})),T};export{k as Message,x as createCustomSynchronizer};
@@ -1 +1 @@
1
- const e=e=>typeof e,l="tinybase",t="",a=",",n=e(t),d=e(!0),o=e(0),s="type",r="default",I="Listener",$="get",c="add",u="Has",i="Ids",b="Table",p=b+"s",C=b+i,h="Row",m=h+i,g="Sorted"+h+i,w="Cell",f=w+i,T="Value",y=T+"s",v=T+i,V=Promise,x=isFinite,R=e=>null==e,A=(e,l,t)=>R(e)?t?.():l(e),k=e=>e==n||e==d,S=l=>e(l)==n,P=e=>Array.isArray(e),O=(e,l,t)=>e.slice(l,t),E=e=>e.length,N=async e=>V.all(e),D=l=>{const t=e(l);return k(t)||t==o&&x(l)?t:void 0},L=(e,l)=>e.every(l),G=(e,l)=>e.sort(l),j=(e,l)=>e.forEach(l),H=(e,l=t)=>e.join(l),M=(e,l)=>e.map(l),J=(e,l)=>e.filter(l),z=(e,...l)=>e.push(...l),W=e=>e.pop(),B=(e,...l)=>e.unshift(...l),F=e=>e.shift(),U=Object,_=e=>U.getPrototypeOf(e),Z=U.entries,Q=e=>!R(e)&&A(_(e),(e=>e==U.prototype||R(_(e))),(()=>!0)),q=U.keys,K=U.freeze,X=(e,l)=>M(Z(e),(([e,t])=>l(t,e))),Y=e=>E(q(e)),ee=e=>Q(e)&&0==Y(e),le=(e,l)=>e?.has(l)??!1,te=e=>[...e?.values()??[]],ae=(e,l)=>e?.forEach(l),ne=(e,l)=>e?.delete(l),de=e=>new Map(e),oe=(e,l)=>e?.get(l),se=(e,l)=>ae(e,((e,t)=>l(t,e))),re=(e,l)=>M([...e?.entries()??[]],(([e,t])=>l(t,e))),Ie=(e,l,t)=>R(t)?(ne(e,l),e):e?.set(l,t),$e=(e,l,t,a)=>(le(e,l)||Ie(e,l,t()),oe(e,l)),ce=e=>e.toUpperCase(),ue=e=>e.toLowerCase(),ie="a ",be="A function for",pe=", and registers a listener so that any changes to that result will cause a re-render",Ce="Callback",he="Changes",me="Count",ge="Del",we="Deps",fe=we+"?: React.DependencyList",Te="doRollback?: DoRollback",ye="actions: () => Return, "+Te,ve="export",Ve="Id",xe="Invalid",Re="Json",Ae=ue(I),ke="?: ",Se=" | undefined",Pe="NonNullable",Oe="Partial",Ee="Props",Ne="Provider",De=`Registers a ${Ae} that will be called`,Le="Represents",Ge="rowId: "+Ve,je="Schema",He="Set",Me=", descending?: boolean, offset?: number, limit?: number",Je="[]",ze="the Store",We="Transaction",Be=ue(We),Fe="Execute a "+Be+" to make multiple mutations",Ue="Explicitly starts a "+Be,_e="Explicitly finishes a "+Be,Ze="the end of the "+Be,Qe="void",qe=" => "+Qe,Ke="WhenSet",Xe=" when setting it",Ye=ie+"string serialization of",el=" ",ll="Gets a callback that can ",tl="the ",al=" the schema for",nl=(e=0)=>e?"the existence of ":"",dl=(e=0,l=0,a=0)=>nl(a)+`the ${yl[e]}content of`+(l?el+ze:t),ol=(e=0,l,a=0,n=0)=>wl[l]+el+nl(n)+dl(e,1)+(a?" when setting it":t),sl=(e,l=0)=>Le+` a Row when ${l?"s":"g"}etting ${dl()} the '${e}' `+b,rl=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,Il=(e,l)=>`Calls a function for each ${e} in `+l,$l=e=>"The props passed to a component that renders "+e,cl=e=>"A function that takes "+e,ul=(e,l=0,t=0)=>be+" listening to changes to "+nl(t)+Tl[e]+" in "+Tl[l],il=(e,l,a=0,n=0)=>De+" whenever "+nl(n)+Tl[e]+" in "+Tl[l]+" change"+(a?t:"s"),bl=e=>`the '${e}' `+b,pl=e=>"the specified Row in "+bl(e),Cl=(e,l=0,t=0)=>wl[l]+el+dl(0,0,t)+el+bl(e),hl=(e,l=0,t=0)=>wl[l]+` ${dl(0,0,t)} `+pl(e),ml=(e,l,t=0,a=0)=>wl[t]+el+nl(a)+`the '${l}' Cell for `+pl(e),gl=(e,l=0,t=0)=>wl[l]+el+nl(t)+`the '${e}' Value`,wl=["Gets","Checks existence of","Sets","Deletes","Sets part of",Le,"Gets "+Ye,"Sets "+Ye,De+" whenever",ll+"set",ll+"add",ll+"set part of",ll+"delete","Renders","Gets "+Ye+al,"Sets"+al,"Deletes"+al],fl=[$,"has","set","del","set","forEach",c,t],Tl=[ze,p,tl+b+el+i,ie+b,tl+h+el+i,ie+h,tl+w+el+i,ie+w,"invalid Cell changes",y,tl+T+el+i,ie+T,"invalid Value changes",tl+"sorted "+h+el+i,tl+w+el+i+" anywhere",tl+"number of Rows",ie+w+" anywhere"],yl=[t,"tabular ","keyed value "],vl=e=>new Set(P(e)||R(e)?e:[e]),Vl=(e,l)=>e?.add(l),xl=/[^A-Za-z]+/,Rl=/[^A-Za-z0-9]+/,Al=/^( *)\/\*\* *(.*?) *\*\/$/gm,kl=e=>e.includes(a),Sl=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return le(e,n)?Sl(e,l,t,a+1):(Ie(e,n,t),n)},Pl=e=>e.replace(Al,((e,l,t)=>{const a=77-E(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),Ol=e=>e.flat(1e3),El=(e,l=0)=>H(M(e.split(Rl),((e,t)=>(t>0||l?ce:ue)(O(e,0,1))+O(e,1)))),Nl=e=>ce(H((e&&!xl.test(e[0])?e:" "+e).split(Rl),"_")),Dl=e=>`/** ${e}. */`,Ll=(...e)=>H(J(e,(e=>e)),", "),Gl=(...e)=>"{"+H(e,"; ")+"}",jl=(...e)=>Gl(...M(e,(e=>"readonly "+e))),Hl=()=>{const e=[de(),de(),de(),de()],l=de(),a=de(),n=e=>{const l=e.indexOf(" as ");return-1!=l?O(e,l+4):e};return[(...e)=>H(Ol(e),"\n"),(l,t,...a)=>j(a,(a=>j([0,1],(n=>(l??n)==n?Vl($e(e[n],t,vl),a):0)))),(e,a,n,d=t,o=1)=>Sl(l,e,[a,n,d,o]),(e,l,t)=>Sl(a,e,P(t)?[`(${l}) => {`,t,"}"]:[`(${l}) => ${t}`]),(e,l)=>oe(a,e)===l?e:Sl(a,e,l),(l=0)=>M([...G(re(e[l],((e,l)=>`import {${H(G(te(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>kl(e)!=kl(l)?kl(e)?-1:1:e>l?1:-1)),t],(e=>e.replace("{React}","React"))),()=>re(l,(([e,l,a,n],d)=>[Dl(l),`${n?ve+" ":t}type ${d}${a} = ${e};`,t])),()=>re(a,((e,l)=>(e=P(e)?e:[e],z(e,W(e)+";"),[`const ${l} = ${F(e)}`,e,t])))]},Ml=(e,l)=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Jl=(e,l,t)=>[l=>X(e,((e,a)=>l(a,El(a,1),t(Nl(a),`'${a}'`)))),(l,a)=>X(e[l],((e,l)=>a(l,e[s],e[r],t(Nl(l),`'${l}'`),El(l,1)))),e=>X(l,((l,a)=>e(a,l[s],l[r],t(Nl(a),`'${a}'`),El(a,1))))],zl=(e,l,a,n)=>[(n,d)=>{const o=n+": "+d,s=e(p,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...a(e,((e,l,a)=>`'${e}'${R(a)?"?":t}: ${l}`)))+"}"))),ol(1,5)),r=e(p+Ke,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...a(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),ol(1,5,1)),$=e(b+Ve,"keyof "+s,"A "+b+" Id in "+ze),c=`<TId extends ${$}>`,i=e(b,Pe+`<${s}[TId]>`,"A "+b+" in "+ze,c),T=e(b+Ke,Pe+`<${r}[TId]>`,"A "+b+" in "+ze+Xe,c),y=e(h,i+"<TId>[Id]","A "+h+" in a "+b,c),v=e(h+Ke,T+"<TId>[Id]","A "+h+" in a "+b+Xe,c),V=e(w+Ve,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+h,c),x=e(w,Pe+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+h,`<TId extends ${$}, CId extends ${V}<TId>>`),A=e("CellIdCellArray",`CId extends ${V}<TId> ? [cellId: CId, cell: ${x}<TId, CId>] : never`,w+" Ids and types in a "+h,`<TId extends ${$}, CId = ${V}<TId>>`,0),k=e(w+Ce,`(...[cellId, cell]: ${A}<TId>)`+qe,cl(ie+w+" Id, and "+w),c),S=e(h+Ce,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+qe+") "+qe,cl(ie+h+" Id, and a "+w+" iterator"),c),P=e(b+w+Ce,`(cellId: ${V}<TId>, count: number) `+qe,cl(ie+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${$} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${qe}] : never`,b+" Ids and callback types",`<TId = ${$}>`,0),E=e(b+Ce,`(...[tableId, forEachRow]: ${O})`+qe,cl(ie+b+" Id, and a "+h+" iterator"),t),N=e("TableIdRowIdCellIdArray",`TId extends ${$} ? [tableId: TId, rowId: Id, cellId: ${V}<TId>] : never`,"Ids for GetCellChange",`<TId = ${$}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${N}) => CellChange`,be+" returning information about any Cell's changes during a "+Be),L=e(u+p+I,`(${o}, hasTables: boolean)`+qe,ul(1,0,1)),G=e(p+I,`(${o}, getCellChange: ${D}${Se})`+qe,ul(1)),j=e(C+I,`(${o})`+qe,ul(2)),H=e(u+b+I,`(${o}, tableId: ${$}, hasTable: boolean)`+qe,ul(3,0,1)),M=e(b+I,`(${o}, tableId: ${$}, getCellChange: ${D}${Se})`+qe,ul(3)),J=e(b+f+I,`(${o}, tableId: ${$})`+qe,ul(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${$} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${$}>`,0),B=e(u+b+w+I,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+qe,ul(16,3,1)),F=e(h+"Count"+I,`(${o}, tableId: ${$})`+qe,ul(15,3)),U=e(m+I,`(${o}, tableId: ${$})`+qe,ul(4,3)),_=e(g+I,"("+Ll(o,"tableId: "+$,"cellId: Id"+Se,"descending: boolean","offset: number","limit: number"+Se,"sortedRowIds: Ids")+")"+qe,ul(13,3)),Z=e(u+h+I,"("+Ll(""+o,"tableId: "+$,Ge,"hasRow: boolean")+")"+qe,ul(5,3,1)),Q=e(h+I,"("+Ll(""+o,"tableId: "+$,Ge,`getCellChange: ${D}${Se}`)+")"+qe,ul(5,3)),q=e(f+I,"("+Ll(""+o,"tableId: "+$,Ge)+")"+qe,ul(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${Ge}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${$} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${$}>`,0),Y=e(u+w+I,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+qe,ul(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${Ge}, cellId: CId, newCell: ${x}<TId, CId> ${Se}, oldCell: ${x}<TId, CId> ${Se}, getCellChange: ${D} ${Se}] : never`,"Cell args for CellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${$} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${$}>`,0);return[s,r,$,i,T,y,v,V,x,k,S,P,E,L,G,j,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+qe,ul(7,5)),e(xe+w+I,`(${o}, tableId: Id, ${Ge}, cellId: Id, invalidCells: any[])`+qe,ul(8))]},(l,a)=>{const d=l+": "+a,o=e(y,Gl(...n(((e,l,a)=>`'${e}'${R(a)?"?":t}: ${l}`))),ol(2,5)),s=e(y+Ke,Gl(...n(((e,l)=>`'${e}'?: ${l}`))),ol(2,5,1)),r=e(T+Ve,"keyof "+o,"A "+T+" Id in "+ze),$=e(T,Pe+`<${o}[VId]>`,"A "+T+" Id in "+ze,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${$}<VId>] : never`,T+" Ids and types in "+ze,`<VId = ${r}>`,0),i=e(T+Ce,`(...[valueId, value]: ${c})`+qe,cl(ie+T+" Id, and "+T)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,be+" returning information about any Value's changes during a "+Be),p=e(u+y+I,`(${d}, hasValues: boolean)`+qe,ul(9,0,1)),C=e(y+I,`(${d}, getValueChange: ${b}${Se})`+qe,ul(9)),h=e(v+I,`(${d})`+qe,ul(10)),m=e(u+T+I,`(${d}, valueId: ValueId, hasValue: boolean)`+qe,ul(11,0,1)),g=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${$}<VId> ${Se}, oldValue: ${$}<VId> ${Se}, getValueChange: ${b} ${Se}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,$,i,p,C,h,m,e(T+I,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+g+")"+qe,ul(11)),e(xe+T+I,`(${d}, valueId: Id, invalidValues: any[])`+qe,ul(12))]},(l,t)=>e(We+I,`(${l}: ${t})`+qe,be+" listening to the completion of a "+Be)],Wl=(e,l=t,a=t)=>`store.${e}(${l})`+(a?" as "+a:t),Bl=(e,l=t)=>`fluent(() => ${Wl(e,l)})`,Fl=(e,l=t,a=t)=>`store.${e}(${l?l+", ":t}proxy(listener)${a?", "+a:t})`,Ul=(e,a,n)=>{const[o,$,V,x,A,k,P,O]=Hl(),[E,N,D]=Jl(e,a,A),[L,G,M]=zl(V,E,N,D),J=de(),W=(e=0)=>re(J,(([l,a,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${a} => ${n},`]:[s+o+`(${l}): ${a};`];return e||B(r,Dl(d)),z(r,t),r})),F=(e,l,a,n,d,o=t)=>Sl(J,e,[l,a,n,d,o]),U=(e,l,a,n,d,o=t,s=t,r=t)=>F(fl[e]+l+(4==e?Oe:t)+a,o,n,(n==Q?Bl:Wl)(fl[e]+(4==e?Oe:t)+a,s,e?void 0:n),d,r),_=(e,l,a,n=t,d=t,o=1,s=t)=>F(c+e+I,(n?n+", ":t)+Ae+": "+l+(o?", mutator?: boolean":t),Ve,Fl(c+e+I,d,o?"mutator":t),a,s),Z=`./${El(n)}.d`,Q=El(n,1),q=El(Q),K=[],X=de();let Y=[],le=[];if($(1,Z,Q,`create${Q} as create${Q}Decl`),ee(e))$(null,l,p);else{$(0,l,"CellChange"),$(null,l,i);const[e,a,n,o,I,c,T,y,v,x,k,P,O,D,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ue]=L(q,Q),ie=de();E(((e,l)=>{const t=`<'${e}'>`,a=[V(l+b,o+t,Le+` the '${e}' `+b),V(l+b+Ke,I+t,Le+` the '${e}' `+b+Xe),V(l+h,c+t,sl(e)),V(l+h+Ke,T+t,sl(e,1)),V(l+w+Ve,y+t,`A Cell Id for the '${e}' `+b),V(l+w+Ce,x+t,cl(`a Cell Id and value from a Row in the '${e}' `+b)),V(l+h+Ce,k+t,cl(`a Row Id from the '${e}' Table, and a Cell iterator`)),V(l+b+w+Ce,P+t,cl(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];Ie(ie,e,a),$(1,Z,...a)})),$(1,Z,e,a,n,y,O,D,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ue),Y=[e,a,n,y,D,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ie],j([[e],[d],[Q,"tables: "+a,"tables"],[Q]],(([e,l,a],n)=>U(n,t,p,e,ol(1,n),l,a))),U(0,t,C,n+Je,rl(b,ze)),U(5,t,b,Qe,Il(b,ze),"tableCallback: "+O,"tableCallback as any"),E(((e,l,a)=>{const[n,o,s,r,I,$,c,u]=oe(ie,e);j([[n],[d],[Q,"table: "+o,", table"],[Q]],(([n,d,o=t],s)=>U(s,l,b,n,Cl(e,s),d,a+o))),U(0,l,b+f,i,rl(w,"the whole of "+bl(e)),t,a),U(5,l,b+w,Qe,Il(b+w,"the whole of "+bl(e)),"tableCellCallback: "+u,a+", tableCellCallback as any"),U(0,l,h+me,"number","Gets the number of Rows in the "+bl(e),t,a),U(0,l,m,i,rl(h,bl(e)),t,a),U(0,l,g,i,rl(h,bl(e),1),"cellId?: "+I+Me,a+", cellId, descending, offset, limit"),U(5,l,h,Qe,Il(h,bl(e)),"rowCallback: "+c,a+", rowCallback as any"),j([[s],[d],[Q,", row: "+r,", row"],[Q],[Q,", partialRow: "+r,", partialRow"]],(([n,d=t,o=t],s)=>U(s,l,h,n,hl(e,s),Ge+d,a+", rowId"+o))),U(6,l,h,Ve+Se,"Add a new Row to "+bl(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),U(0,l,f,I+Je,rl(w,pl(e)),Ge,a+", rowId"),U(5,l,w,Qe,Il(w,pl(e)),Ge+", cellCallback: "+$,a+", rowId, cellCallback as any"),N(e,((n,o,s,r,I)=>{const $="Map"+El(o,1);Ie(X,o,$);const c=o+(R(s)?Se:t);j([[c],[d],[Q,`, cell: ${o} | `+$,", cell as any"],[Q]],(([d,o=t,s=t],$)=>U($,l+I,w,d,ml(e,n,$),Ge+o,a+", rowId, "+r+s))),U(1,l+I,b+w,d,wl[1]+` the '${n}' Cell anywhere in `+bl(e),t,a+", "+r)}))})),U(0,t,p+Re,Re,ol(1,6)),U(2,t,p+Re,Q,ol(1,7),"tablesJson: "+Re,"tables"+Re),_(u+p,D,ol(1,8,0,1)+" changes"),_(p,G,ol(1,8)+" changes"),_(C,M,il(2,0,1)),_(u+b,J,il(3,0,0,1),`tableId: ${n} | null`,"tableId"),_(b,W,il(3,0),`tableId: ${n} | null`,"tableId"),_(b+f,B,il(14,3,1),`tableId: ${n} | null`,"tableId"),_(u+b+w,F,il(16,3,0,1),`tableId: ${n} | null, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, cellId"),_(h+me,ee,il(15,3),`tableId: ${n} | null`,"tableId"),_(m,le,il(4,3,1),`tableId: ${n} | null`,"tableId"),_(g,ae,il(13,3,1),Ll("tableId: TId",`cellId: ${y}<TId>`+Se,"descending: boolean","offset: number","limit: number"+Se),Ll("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(u+h,ne,il(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(h,se,il(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,re,il(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(u+w,$e,il(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),_(w,ce,il(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),_(xe+w,ue,De+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),$(1,Z,...te(X)),z(K,".set"+p+je+"({",Ol(E(((e,l,a)=>[`[${a}]: {`,...N(e,((e,l,a,n)=>`[${n}]: {[${A(Nl(s),`'${s}'`)}]: ${A(Nl(l),`'${l}'`)}${R(a)?t:`, [${A(Nl(r),`'${r}'`)}]: `+(S(a)?A(Nl(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(ee(a))$(null,l,y);else{const[e,a,n,o,I,c,i,b,p,C,h]=G(q,Q);$(1,Z,e,a,n,I,c,i,b,p,C,h),le=[e,a,n,c,i,b,p,C],j([[e],[d],[Q,"values: "+a,"values"],[Q],[Q,"partialValues: "+a,"partialValues"]],(([e,l,a],n)=>U(n,t,y,e,ol(2,n),l,a))),U(0,t,v,n+Je,rl(T,ze)),U(5,t,T,"void",Il(T,ze),"valueCallback: "+I,"valueCallback as any"),D(((e,l,a,n,o)=>{const s="Map"+El(l,1);Ie(X,l,s),j([[l],[d],[Q,`value: ${l} | `+s,", value as any"],[Q]],(([l,a,d=t],s)=>U(s,o,T,l,gl(e,s),a,n+d)))})),U(0,t,y+Re,Re,ol(2,6)),U(2,t,y+Re,Q,ol(2,7),"valuesJson: "+Re,"values"+Re),_(u+y,c,ol(2,8,0,1)+" changes"),_(y,i,ol(2,8)+" changes"),_(v,b,il(10,0,1)),_(u+T,p,il(11,0,0,1),`valueId: ${n} | null`,"valueId"),_(T,C,il(11,0),`valueId: ${n} | null`,"valueId"),_(xe+T,h,De+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),$(1,Z,...te(X)),$(0,l,"ValueChange"),z(K,".set"+y+je+"({",D(((e,l,a,n)=>[`[${n}]: {[${A(Nl(s),`'${s}'`)}]: ${A(Nl(l),`'${l}'`)}${R(a)?t:`, [${A(Nl(r),`'${r}'`)}]: `+(S(a)?A(Nl(a),`'${a}'`):a)}},`])),"})")}U(0,t,"Content",`[${p}, ${y}]`,ol(0,0)),U(2,t,"Content",Q,ol(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),U(7,t,"applyChanges",Q,`Applies a set of ${he} to the Store`,"changes: "+he,"changes"),se(X,((e,l)=>V(l,`(cell: ${e}${Se}) => `+e,`Takes a ${e} Cell value and returns another`))),$(null,l,"DoRollback",Ve,"IdOrNull",Re,"Store",he),U(0,t,Re,Re,ol(0,6)),U(2,t,Re,Q,ol(0,7),"tablesAndValuesJson: "+Re,"tablesAndValuesJson"),U(7,t,Be,"Return",Fe,ye,"actions, doRollback","<Return>"),U(7,t,"start"+We,Q,Ue),U(7,t,"finish"+We,Q,_e,Te,"doRollback");const ae=M(q,Q);return _("Start"+We,ae,De+" just before the start of the "+Be,t,t,0),_("WillFinish"+We,ae,De+" just before "+Ze,t,t,0),_("DidFinish"+We,ae,De+" just after "+Ze,t,t,0),U(7,t,"call"+I,Q,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,t,I,Q,"Remove a listener that was previously added to "+ze,"listenerId: Id","listenerId"),F("getStore",t,"Store","store",wl[0]+" the underlying Store object"),$(1,l,"createStore"),$(1,Z,Q,`create${Q} as create${Q}Decl`,ae),A("store",["createStore()",...K]),x("fluent","actions: () => Store",["actions();",`return ${q};`]),x("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),A(q,["{",...W(1),"}"]),[o(...k(0),...P(),ve+" interface "+Q+" {",...W(0),"}",t,Dl(`Creates a ${Q} object`),ve+" function create"+Q+"(): "+Q+";"),o(...k(1),ve+" const create"+Q+": typeof create"+Q+"Decl = () => {",...O(),`return Object.freeze(${q});`,"};"),Y,le]},_l=e=>$+e,Zl=e=>Ll(_l(e),_l(e)+we),Ql="debugIds?: boolean",ql="debugIds={debugIds}",Kl="then"+fe,Xl="Parameter",Yl=": (parameter: "+Xl+", store: Store) => ",et="const contextValue = useContext(Context);",lt=", based on a parameter",tt=": ",at="<"+Xl+",>",nt=Xl+"ized"+Ce+"<"+Xl+">",dt="rowId",ot="rowId={rowId}",st=", separator, debugIds",rt="separator?: ReactElement | string",It="then?: (store: Store",$t=Ll(It+")"+qe,Kl),ct="then, then"+we,ut=dt+tt+Ve,it="View",bt=(e,...l)=>Ll(...l,Ae+": "+e,Ae+fe,"mutator?: boolean"),pt=(...e)=>Ll(...e,Ae,Ae+we,"mutator"),Ct=(e,a,n,s,r)=>{const[$,c,V,x,A,k,S,P]=Hl(),[O,E,N]=Jl(e,a,A),D=`./${El(n)}.d`,L=`./${El(n)}-ui-react.d`,G="tinybase/ui-react",j=El(n,1),M=El(j),J=j+"Or"+j+Ve,W=M+"Or"+j+Ve,F=M+`={${M}}`,U=de(),_=(e,l,a,n,d,o=t)=>(c(1,L,e+" as "+e+"Decl"),Sl(U,e,[l,a,n,d,o])),Z=(e,l,a,n,d,o=t)=>_("use"+e,l,a,n,d,o),Q=(e,l,a,n,d=t,o=t,s=t,r=t,I=t)=>(c(1,G,`use${l} as use${l}Core`),Z(e,Ll(d,le,r),a,ae+`(${W}, use${l}Core, [`+(o||t)+(I?"], ["+I:t)+"]);",n,s)),q=(e,l,t,a)=>_(e,l,1,t,a),K=(e=0)=>re(U,(([l,a,n,d,o],s)=>{const r=e?[ve+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==a?"any":a} =>`,n]:[ve+` function ${s}${o}(${l}): ${1==a?"ComponentReturnType":a};`];return e||B(r,Dl(d)),z(r,t),r}));c(null,l,Ve,"Store",Ce,Xl+"ized"+Ce),c(0,G,"ComponentReturnType"),c(1,G,"useCellIds"),c(null,G,"ExtraProps"),c(0,D,j);const X=V(J,j+" | "+Ve,`Used when you need to refer to a ${j} in a React hook or component`),Y=V(Ne+Ee,jl(M+ke+j,M+`ById?: {[${M}Id: Id]: ${j}}`),`Used with the ${Ne} component, so that a `+j+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,L,X,Y);const le=W+ke+X;A("{createContext, useContext, useMemo}","React"),A("Context",`createContext<[${j}?, {[${M}Id: Id]: ${j}}?]>([])`),Z("Create"+j,`create: () => ${j}, create`+fe,j,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${j} within a React application with convenient memoization`);const te=Z(j,"id?: Id",j+Se,["{",et,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${j} from within a ${Ne} component context`),ae=x("useHook",W+`: ${X} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${te}(${W} as Id);`,`return hook(...preParams, ((${W} == null || typeof ${W} == 'string')`,`? ${M} : ${W})?.getStore(), ...postParams)`]),ne=x("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),se=x("wrap",Ll("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),Ie=x("useCustomOrDefaultCellIds",Ll("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${W}?: ${X} | undefined`),[`const defaultCellIds = ${ae}(${W}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),$e=A("NullComponent","() => null");if(!ee(e)){const[e,a,n,r,$,T,y,v,A,k,S,P,N,G,J,z,W,B,U,_]=s;c(null,D,e,a,n,$,T,y,v,A,k,S,P,N,G,J,z,W,U,B),c(0,D,r),c(1,D,j),c(null,l,i,"IdOrNull");const Z=x("tableView",`{${M}, rowComponent, getRowComponentProps, customCellIds`+st+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${se}(rowIds.map((rowId) => (`,"<Row","{..."+ne+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",ot,"customCellIds={customCellIds}",F,ql,"/>","))",st,", tableId,",");"]),K=x("getDefaultTableComponent","tableId: Id",H(O(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+$e),X=x("getDefaultCellComponent","tableId: Id, cellId: Id",H(O(((e,l,t)=>`tableId == ${t} ? ${H(E(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+$e} : `)))+$e);Q(u+p,u+p,d,ol(1,0,0,1)+pe),Q(p,p,e,ol(1,0)+pe);const Y=Q(C,C,n+Je,rl(b,ze)+pe);Q(He+p+Ce,He+p+Ce,nt,ol(1,9)+lt,Ll(_l(p)+Yl+a,_l(p)+fe),Zl(p),at,Ll(It,`tables: ${a})`+qe,Kl),ct),Q(ge+p+Ce,ge+p+Ce,Ce,ol(1,12),t,t,t,$t,ct);const ee=V(w+Ee,jl("tableId?: TId","rowId: Id","cellId?: CId",M+ke+j,Ql),$l(ie+w),`<TId extends ${n}, CId extends ${r}<TId>>`),le=V(h+Ee,jl("tableId?: TId","rowId: Id",M+ke+j,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${ee}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,rt,Ql),$l(ie+h),`<TId extends ${n}>`),te=V(b+Ee,jl("tableId?: TId",M+ke+j,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",rt,Ql),$l(ie+b),`<TId extends ${n}>`),ae=V("Sorted"+b+Ee,jl("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",M+ke+j,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",rt,Ql),$l(ie+"sorted "+b),`<TId extends ${n}>`),de=V(p+Ee,jl(M+ke+j,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${te}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,rt,Ql),$l(dl(1,1)));c(1,L,de,te,ae,le,ee),q(p+it,"{"+M+", tableComponents, getTableComponentProps"+st+"}: "+de,[se+`(${Y}(${M}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+K+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ne}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",F,ql,"/>;","}), separator)"],ol(1,13)+pe),O(((e,l,a)=>{const[n,s,r,I,$]=oe(_,e);c(null,D,n,s,r,I,$),Q(u+l+b,u+b,d,Cl(e,0,1)+pe,t,a),Q(l+b,b,n,Cl(e)+pe,t,a),Q(l+b+f,b+f,i,rl(w,"the whole of "+bl(e))+pe,t,a),Q(l+h+me,h+me,o,"Gets the number of Rows in "+bl(e)+pe,t,a);const p=Q(l+m,m,i,rl(h,bl(e))+pe,t,a),C=Q(l+g,g,i,rl(h,bl(e),1)+pe,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");Q(u+l+h,u+h,d,hl(e,0,1)+pe,ut,Ll(a,dt)),Q(l+h,h,r,hl(e)+pe,ut,Ll(a,dt)),Q(l+f,f,$+Je,rl(w,pl(e))+pe,ut,Ll(a,dt)),Q(He+l+b+Ce,He+b+Ce,nt,Cl(e,9)+lt,Ll(_l(b)+Yl+s,_l(b)+fe),Ll(a,Zl(b)),at,Ll(It,`table: ${s})`+qe,Kl),ct),Q(ge+l+b+Ce,ge+b+Ce,Ce,Cl(e,12),t,a,t,$t,ct),Q(He+l+h+Ce,He+h+Ce,nt,hl(e,9)+lt,Ll(ut,_l(h)+Yl+I,_l(h)+fe),Ll(a,dt,Zl(h)),at,Ll(It,`row: ${I})`+qe,Kl),ct),Q("Add"+l+h+Ce,"Add"+h+Ce,nt,hl(e,10)+lt,Ll(_l(h)+Yl+I,_l(h)+fe),Ll(a,Zl(h)),at,"then?: ("+Ll(ut+Se,"store: Store","row: "+I+")"+qe,"then"+fe)+", reuseRowIds?: boolean",ct+", reuseRowIds"),Q(He+l+Oe+h+Ce,He+Oe+h+Ce,nt,hl(e,11)+lt,Ll(ut,_l(Oe+h)+Yl+I,_l(Oe+h)+fe),Ll(a,dt,Zl(Oe+h)),at,Ll(It,`partialRow: ${I})`+qe,Kl),ct),Q(ge+l+h+Ce,ge+h+Ce,Ce,hl(e,12),ut,Ll(a,dt),t,$t,ct);const T=q(l+h+it,"{rowId, "+M+", cellComponents, getCellComponentProps, customCellIds"+st+`}: ${le}<'${e}'>`,[se+`(${Ie}(customCellIds, `+a+`, rowId, ${M}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+X+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${ne}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,ot,"cellId={cellId}",F,ql,"/>;","})"+st+", rowId)"],hl(e,13)+pe);q(l+"Sorted"+b+it,"{cellId, descending, offset, limit, ...props}: "+ae+`<'${e}'>`,Z+"(props, "+C+`(cellId, descending, offset, limit, props.${M}), ${a}, ${T});`,Cl(e,13)+", sorted"+pe),q(l+b+it,`props: ${te}<'${e}'>`,Z+"(props, "+p+`(props.${M}), ${a}, ${T});`,Cl(e,13)+pe),E(e,((n,o,s,r,I)=>{const $="Map"+El(o,1);c(0,D,$),c(1,D,$),Q(u+l+I+b+w,u+b+w,d,`Gets ${nl(1)}the '${n}' Cell anywhere in `+bl(e)+pe,t,Ll(a,r)),Q(u+l+I+w,u+w,d,ml(e,n,0,1)+pe,ut,Ll(a,dt,r));const i=Q(l+I+w,w,o+(R(s)?Se:t),ml(e,n)+pe,ut,Ll(a,dt,r));Q(He+l+I+w+Ce,He+w+Ce,nt,ml(e,n,9)+lt,Ll(ut,_l(w)+Yl+o+" | "+$,_l(w)+fe),Ll(a,dt,r,Zl(w)),at,Ll(It,`cell: ${o} | ${$})`+qe,Kl),ct),Q(ge+l+I+w+Ce,ge+w+Ce,Ce,ml(e,n,12),Ll(ut,"forceDel?: boolean"),Ll(a,dt,r,"forceDel"),t,$t,ct),q(l+I+w+it,`{rowId, ${M}, debugIds}: `+ee+`<'${e}', '${n}'>`,[se+`('' + ${i}(rowId, `+M+`) ?? '', undefined, debugIds, ${r})`],ml(e,n,13)+pe)}))}));const re=H(O((e=>oe(_,e)?.[4]??t))," | ");Q(u+p+I,u+p+I,Qe,ol(1,8,0,1)+" changes",bt($),pt()),Q(p+I,p+I,Qe,ol(1,8)+" changes",bt(T),pt()),Q(C+I,C+I,Qe,il(2,0,1),bt(y),pt()),Q(u+b+I,u+b+I,Qe,il(3,0,0,1),bt(v,`tableId: ${n} | null`),pt("tableId")),Q(b+I,b+I,Qe,il(3,0),bt(A,`tableId: ${n} | null`),pt("tableId")),Q(b+f+I,b+f+I,Qe,il(14,3,1),bt(k,`tableId: ${n} | null`),pt("tableId")),Q(u+b+w+I,u+b+w+I,Qe,il(16,3,0,1),bt(S,`tableId: ${n} | null`,`cellId: ${re} | null`),pt("tableId","cellId")),Q(h+me+I,h+me+I,Qe,il(15,3),bt(P,`tableId: ${n} | null`),pt("tableId")),Q(m+I,m+I,Qe,il(4,3,1),bt(N,`tableId: ${n} | null`),pt("tableId")),Q(g+I,g+I,Qe,il(13,3,1),bt(G,`tableId: ${n} | null`,"cellId: "+re+Se,"descending: boolean","offset: number","limit: number"+Se),pt("tableId","cellId","descending","offset","limit")),Q(u+h+I,u+h+I,Qe,il(5,3,0,1),bt(J,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(h+I,h+I,Qe,il(5,3),bt(z,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(f+I,f+I,Qe,il(6,5,1),bt(W,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(u+w+I,u+w+I,Qe,il(7,5,0,1),bt(B,`tableId: ${n} | null`,dt+": IdOrNull",`cellId: ${re} | null`),pt("tableId",dt,"cellId")),Q(w+I,w+I,Qe,il(7,5),bt(U,`tableId: ${n} | null`,dt+": IdOrNull",`cellId: ${re} | null`),pt("tableId",dt,"cellId"))}if(!ee(a)){const[e,l,a,n,o,s,$,i]=r;c(null,D,...r),c(1,D,j);const b=x("getDefaultValueComponent","valueId: Id",H(N(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+$e);Q(u+y,u+y,d,ol(2,0,0,1)+pe),Q(y,y,e,ol(2,0)+pe);const p=Q(v,v,a+Je,rl(T,ze)+pe);Q(He+y+Ce,He+y+Ce,nt,ol(2,9)+lt,Ll(_l(y)+Yl+l,_l(y)+fe),Zl(y),at,Ll(It,`values: ${l})`+qe,Kl),ct),Q(He+Oe+y+Ce,He+Oe+y+Ce,nt,ol(2,11)+lt,Ll(_l(Oe+y)+Yl+l,_l(Oe+y)+fe),Zl(Oe+y),at,Ll(It,`partialValues: ${l})`+qe,Kl),ct),Q(ge+y+Ce,ge+y+Ce,Ce,ol(2,12),t,t,t,$t,ct);const C=V(T+Ee,jl("valueId?: VId",M+ke+j,Ql),$l("a Value"),`<VId extends ${a}>`),h=V(y+Ee,jl(M+ke+j,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${C}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,rt,Ql),$l(dl(2,1)));c(1,L,h,C),q(y+it,"{"+M+", valueComponents, getValueComponentProps"+st+"}: "+h,[se+`(${p}(${M}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+b+"(valueId);","return <Value",`{...${ne}(getValueComponentProps, valueId)}`,"key={valueId}",F,ql,"/>;","}), separator)"],ol(2,13)+pe),N(((e,l,a,n,o)=>{const s="Map"+El(l,1);c(0,D,s),c(1,D,s),Q(u+o+T,u+T,d,gl(e,0,1)+pe,t,n);const r=Q(o+T,T,l,gl(e)+pe,t,n);Q(He+o+T+Ce,He+T+Ce,nt,gl(e,9)+lt,Ll(_l(T)+Yl+l+" | "+s,_l(T)+fe),Ll(n,Zl(T)),at,Ll(It,`value: ${l} | ${s})`+qe,Kl),ct),Q(ge+o+T+Ce,ge+T+Ce,Ce,gl(e,12),t,n,t,$t,ct),q(o+T+it,`{${M}, debugIds}: ${C}<'${e}'>`,[se+`('' + ${r}(`+M+`) ?? '', undefined, debugIds, ${n})`],gl(e,13)+pe)})),Q(u+y+I,u+y+I,Qe,ol(2,8,0,1)+" changes",bt(n),pt()),Q(y+I,y+I,Qe,ol(2,8)+" changes",bt(o),pt()),Q(v+I,v+I,Qe,il(10,0,1),bt(s),pt()),Q(u+T+I,u+T+I,Qe,il(11,0,0,1),bt($,`valueId: ${a} | null`),pt("valueId")),Q(T+I,T+I,Qe,il(11,0),bt(i,`valueId: ${a} | null`),pt("valueId"))}return q(Ne,`{${M}, ${M}ById, children}: `+Y+" & {readonly children: React.ReactNode}",["{",et,"return (","<Context."+Ne,"value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}",`</Context.${Ne}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[$(...k(0),...S(),...K(0)),$(...k(1),...P(),...K(1))]},ht=(e,l,a)=>{if(ee(e)&&ee(l))return[t,t,t,t];const[n,d,o,s]=Ul(e,l,a);return[n,d,...Ct(e,l,a,o,s)]},mt=JSON.parse,gt="prettier/",wt=gt+"plugins/",ft={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Tt=Ml((e=>{const l=()=>{const l=mt(e.getTablesSchemaJson());return!ee(l)||L(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=de();if(L(a,(l=>L(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=$e(n,a,(()=>[D(d),de(),[0],0])),[s,r,[I]]=o,$=$e(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),Ie(r,d,$),o[3]++,s==D(d)})))))return l[t]={},ae(n,(([e,,[,n],d],o)=>{l[t][o]={[s]:e,...d==E(a)?{[r]:n}:{}}})),1}))?l:{}},t=()=>{const l=mt(e.getValuesSchemaJson());return ee(l)&&e.forEachValue(((e,t)=>{l[e]={[s]:D(t)}})),l},a=e=>ht(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(gt+"standalone")).format,z(t,await import(wt+"estree"),await import(wt+"typescript"))}catch{n=async e=>e}return await N(M(a(e),(async(e,a)=>Pl(await n(e,{...ft,plugins:t,filepath:"_."+l[a]})))))};return K({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:E(e.getValueIds()),jsonLength:E(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{Tt as createTools};
1
+ const e=e=>typeof e,l="tinybase",t="",a=",",n=e(t),d=e(!0),o=e(0),s="type",r="default",I="Listener",$="get",c="add",u="Has",i="Ids",b="Table",p=b+"s",C=b+i,h="Row",m=h+i,g="Sorted"+h+i,w="Cell",f=w+i,T="Value",y=T+"s",v=T+i,V="Transaction",x="Partial",R=(e,l=t,a)=>e.split(l,a),A=Promise,k=isFinite,S=e=>null==e,P=(e,l,t)=>S(e)?t?.():l(e),O=e=>e==n||e==d,E=l=>e(l)==n,N=e=>Array.isArray(e),D=(e,l,t)=>e.slice(l,t),L=e=>e.length,G=async e=>A.all(e),j=l=>{const t=e(l);return O(t)||t==o&&k(l)?t:void 0},H=(e,l)=>e.every(l),M=(e,l)=>e.sort(l),J=(e,l)=>e.forEach(l),z=(e,l=t)=>e.join(l),W=(e,l)=>e.map(l),B=(e,l)=>e.filter(l),F=(e,...l)=>e.push(...l),U=e=>e.pop(),_=(e,...l)=>e.unshift(...l),Z=e=>e.shift(),Q=Object,q=e=>Q.getPrototypeOf(e),K=Q.entries,X=e=>!S(e)&&P(q(e),(e=>e==Q.prototype||S(q(e))),(()=>!0)),Y=Q.keys,ee=Q.freeze,le=(e,l)=>W(K(e),(([e,t])=>l(t,e))),te=e=>L(Y(e)),ae=e=>X(e)&&0==te(e),ne=(e,l)=>e?.has(l)??!1,de=e=>[...e?.values()??[]],oe=(e,l)=>e?.forEach(l),se=(e,l)=>e?.delete(l),re=e=>new Map(e),Ie=(e,l)=>e?.get(l),$e=(e,l)=>oe(e,((e,t)=>l(t,e))),ce=(e,l)=>W([...e?.entries()??[]],(([e,t])=>l(t,e))),ue=(e,l,t)=>S(t)?(se(e,l),e):e?.set(l,t),ie=(e,l,t,a)=>(ne(e,l)||ue(e,l,t()),Ie(e,l)),be=e=>e.toUpperCase(),pe=e=>e.toLowerCase(),Ce="a ",he="A function for",me=", and registers a listener so that any changes to that result will cause a re-render",ge="Callback",we="Changes",fe="Count",Te="Del",ye="Deps",ve=ye+"?: React.DependencyList",Ve="doRollback?: DoRollback",xe="actions: () => Return, "+Ve,Re="export",Ae="Id",ke="Invalid",Se="Json",Pe=pe(I),Oe="?: ",Ee=" | undefined",Ne="NonNullable",De="Props",Le="Provider",Ge=`Registers a ${Pe} that will be called`,je="Represents",He="rowId: "+Ae,Me="Schema",Je="Set",ze=", descending?: boolean, offset?: number, limit?: number",We="[]",Be="the Store",Fe=pe(V),Ue="Execute a "+Fe+" to make multiple mutations",_e="Explicitly starts a "+Fe,Ze="Explicitly finishes a "+Fe,Qe="the end of the "+Fe,qe="void",Ke=" => "+qe,Xe="WhenSet",Ye=" when setting it",el=Ce+"string serialization of",ll=" ",tl="Gets a callback that can ",al="the ",nl=" the schema for",dl=(e=0)=>e?"the existence of ":"",ol=(e=0,l=0,a=0)=>dl(a)+`the ${vl[e]}content of`+(l?ll+Be:t),sl=(e=0,l,a=0,n=0)=>fl[l]+ll+dl(n)+ol(e,1)+(a?" when setting it":t),rl=(e,l=0)=>je+` a Row when ${l?"s":"g"}etting ${ol()} the '${e}' `+b,Il=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,$l=(e,l)=>`Calls a function for each ${e} in `+l,cl=e=>"The props passed to a component that renders "+e,ul=e=>"A function that takes "+e,il=(e,l=0,t=0)=>he+" listening to changes to "+dl(t)+yl[e]+" in "+yl[l],bl=(e,l,a=0,n=0)=>Ge+" whenever "+dl(n)+yl[e]+" in "+yl[l]+" change"+(a?t:"s"),pl=e=>`the '${e}' `+b,Cl=e=>"the specified Row in "+pl(e),hl=(e,l=0,t=0)=>fl[l]+ll+ol(0,0,t)+ll+pl(e),ml=(e,l=0,t=0)=>fl[l]+` ${ol(0,0,t)} `+Cl(e),gl=(e,l,t=0,a=0)=>fl[t]+ll+dl(a)+`the '${l}' Cell for `+Cl(e),wl=(e,l=0,t=0)=>fl[l]+ll+dl(t)+`the '${e}' Value`,fl=["Gets","Checks existence of","Sets","Deletes","Sets part of",je,"Gets "+el,"Sets "+el,Ge+" whenever",tl+"set",tl+"add",tl+"set part of",tl+"delete","Renders","Gets "+el+nl,"Sets"+nl,"Deletes"+nl],Tl=[$,"has","set","del","set","forEach",c,t],yl=[Be,p,al+b+ll+i,Ce+b,al+h+ll+i,Ce+h,al+w+ll+i,Ce+w,"invalid Cell changes",y,al+T+ll+i,Ce+T,"invalid Value changes",al+"sorted "+h+ll+i,al+w+ll+i+" anywhere",al+"number of Rows",Ce+w+" anywhere"],vl=[t,"tabular ","keyed value "],Vl=e=>new Set(N(e)||S(e)?e:[e]),xl=(e,l)=>e?.add(l),Rl=/[^A-Za-z]+/,Al=/[^A-Za-z0-9]+/,kl=/^( *)\/\*\* *(.*?) *\*\/$/gm,Sl=e=>e.includes(a),Pl=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return ne(e,n)?Pl(e,l,t,a+1):(ue(e,n,t),n)},Ol=e=>e.replace(kl,((e,l,t)=>{const a=77-L(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),El=e=>e.flat(1e3),Nl=(e,l=0)=>z(W(R(e,Al),((e,t)=>(t>0||l?be:pe)(D(e,0,1))+D(e,1)))),Dl=e=>be(z(R(e&&!Rl.test(e[0])?e:" "+e,Al),"_")),Ll=e=>`/** ${e}. */`,Gl=(...e)=>z(B(e,(e=>e)),", "),jl=(...e)=>"{"+z(e,"; ")+"}",Hl=(...e)=>jl(...W(e,(e=>"readonly "+e))),Ml=()=>{const e=[re(),re(),re(),re()],l=re(),a=re(),n=e=>{const l=e.indexOf(" as ");return-1!=l?D(e,l+4):e};return[(...e)=>z(El(e),"\n"),(l,t,...a)=>J(a,(a=>J([0,1],(n=>(l??n)==n?xl(ie(e[n],t,Vl),a):0)))),(e,a,n,d=t,o=1)=>Pl(l,e,[a,n,d,o]),(e,l,t)=>Pl(a,e,N(t)?[`(${l}) => {`,t,"}"]:[`(${l}) => ${t}`]),(e,l)=>Ie(a,e)===l?e:Pl(a,e,l),(l=0)=>W([...M(ce(e[l],((e,l)=>`import {${z(M(de(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>Sl(e)!=Sl(l)?Sl(e)?-1:1:e>l?1:-1)),t],(e=>e.replace("{React}","React"))),()=>ce(l,(([e,l,a,n],d)=>[Ll(l),`${n?Re+" ":t}type ${d}${a} = ${e};`,t])),()=>ce(a,((e,l)=>(e=N(e)?e:[e],F(e,U(e)+";"),[`const ${l} = ${Z(e)}`,e,t])))]},Jl=(e,l)=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},zl=(e,l,t)=>[l=>le(e,((e,a)=>l(a,Nl(a,1),t(Dl(a),`'${a}'`)))),(l,a)=>le(e[l],((e,l)=>a(l,e[s],e[r],t(Dl(l),`'${l}'`),Nl(l,1)))),e=>le(l,((l,a)=>e(a,l[s],l[r],t(Dl(a),`'${a}'`),Nl(a,1))))],Wl=(e,l,a,n)=>[(n,d)=>{const o=n+": "+d,s=e(p,jl(...l((e=>`'${e}'?: {[rowId: Id]: `+jl(...a(e,((e,l,a)=>`'${e}'${S(a)?"?":t}: ${l}`)))+"}"))),sl(1,5)),r=e(p+Xe,jl(...l((e=>`'${e}'?: {[rowId: Id]: `+jl(...a(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),sl(1,5,1)),$=e(b+Ae,"keyof "+s,"A "+b+" Id in "+Be),c=`<TId extends ${$}>`,i=e(b,Ne+`<${s}[TId]>`,"A "+b+" in "+Be,c),T=e(b+Xe,Ne+`<${r}[TId]>`,"A "+b+" in "+Be+Ye,c),y=e(h,i+"<TId>[Id]","A "+h+" in a "+b,c),v=e(h+Xe,T+"<TId>[Id]","A "+h+" in a "+b+Ye,c),V=e(w+Ae,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+h,c),x=e(w,Ne+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+h,`<TId extends ${$}, CId extends ${V}<TId>>`),R=e("CellIdCellArray",`CId extends ${V}<TId> ? [cellId: CId, cell: ${x}<TId, CId>] : never`,w+" Ids and types in a "+h,`<TId extends ${$}, CId = ${V}<TId>>`,0),A=e(w+ge,`(...[cellId, cell]: ${R}<TId>)`+Ke,ul(Ce+w+" Id, and "+w),c),k=e(h+ge,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Ke+") "+Ke,ul(Ce+h+" Id, and a "+w+" iterator"),c),P=e(b+w+ge,`(cellId: ${V}<TId>, count: number) `+Ke,ul(Ce+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${$} ? [tableId: TId, forEachRow: (rowCallback: ${k}<TId>)${Ke}] : never`,b+" Ids and callback types",`<TId = ${$}>`,0),E=e(b+ge,`(...[tableId, forEachRow]: ${O})`+Ke,ul(Ce+b+" Id, and a "+h+" iterator"),t),N=e("TableIdRowIdCellIdArray",`TId extends ${$} ? [tableId: TId, rowId: Id, cellId: ${V}<TId>] : never`,"Ids for GetCellChange",`<TId = ${$}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${N}) => CellChange`,he+" returning information about any Cell's changes during a "+Fe),L=e(u+p+I,`(${o}, hasTables: boolean)`+Ke,il(1,0,1)),G=e(p+I,`(${o}, getCellChange: ${D}${Ee})`+Ke,il(1)),j=e(C+I,`(${o})`+Ke,il(2)),H=e(u+b+I,`(${o}, tableId: ${$}, hasTable: boolean)`+Ke,il(3,0,1)),M=e(b+I,`(${o}, tableId: ${$}, getCellChange: ${D}${Ee})`+Ke,il(3)),J=e(b+f+I,`(${o}, tableId: ${$})`+Ke,il(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${$} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${$}>`,0),B=e(u+b+w+I,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+Ke,il(16,3,1)),F=e(h+"Count"+I,`(${o}, tableId: ${$})`+Ke,il(15,3)),U=e(m+I,`(${o}, tableId: ${$})`+Ke,il(4,3)),_=e(g+I,"("+Gl(o,"tableId: "+$,"cellId: Id"+Ee,"descending: boolean","offset: number","limit: number"+Ee,"sortedRowIds: Ids")+")"+Ke,il(13,3)),Z=e(u+h+I,"("+Gl(""+o,"tableId: "+$,He,"hasRow: boolean")+")"+Ke,il(5,3,1)),Q=e(h+I,"("+Gl(""+o,"tableId: "+$,He,`getCellChange: ${D}${Ee}`)+")"+Ke,il(5,3)),q=e(f+I,"("+Gl(""+o,"tableId: "+$,He)+")"+Ke,il(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${He}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${$} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${$}>`,0),Y=e(u+w+I,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+Ke,il(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${He}, cellId: CId, newCell: ${x}<TId, CId> ${Ee}, oldCell: ${x}<TId, CId> ${Ee}, getCellChange: ${D} ${Ee}] : never`,"Cell args for CellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${$} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${$}>`,0);return[s,r,$,i,T,y,v,V,x,A,k,P,E,L,G,j,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+Ke,il(7,5)),e(ke+w+I,`(${o}, tableId: Id, ${He}, cellId: Id, invalidCells: any[])`+Ke,il(8))]},(l,a)=>{const d=l+": "+a,o=e(y,jl(...n(((e,l,a)=>`'${e}'${S(a)?"?":t}: ${l}`))),sl(2,5)),s=e(y+Xe,jl(...n(((e,l)=>`'${e}'?: ${l}`))),sl(2,5,1)),r=e(T+Ae,"keyof "+o,"A "+T+" Id in "+Be),$=e(T,Ne+`<${o}[VId]>`,"A "+T+" Id in "+Be,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${$}<VId>] : never`,T+" Ids and types in "+Be,`<VId = ${r}>`,0),i=e(T+ge,`(...[valueId, value]: ${c})`+Ke,ul(Ce+T+" Id, and "+T)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,he+" returning information about any Value's changes during a "+Fe),p=e(u+y+I,`(${d}, hasValues: boolean)`+Ke,il(9,0,1)),C=e(y+I,`(${d}, getValueChange: ${b}${Ee})`+Ke,il(9)),h=e(v+I,`(${d})`+Ke,il(10)),m=e(u+T+I,`(${d}, valueId: ValueId, hasValue: boolean)`+Ke,il(11,0,1)),g=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${$}<VId> ${Ee}, oldValue: ${$}<VId> ${Ee}, getValueChange: ${b} ${Ee}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,$,i,p,C,h,m,e(T+I,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+g+")"+Ke,il(11)),e(ke+T+I,`(${d}, valueId: Id, invalidValues: any[])`+Ke,il(12))]},(l,t)=>e(V+I,`(${l}: ${t})`+Ke,he+" listening to the completion of a "+Fe)],Bl=(e,l=t,a=t)=>`store.${e}(${l})`+(a?" as "+a:t),Fl=(e,l=t)=>`fluent(() => ${Bl(e,l)})`,Ul=(e,l=t,a=t)=>`store.${e}(${l?l+", ":t}proxy(listener)${a?", "+a:t})`,_l=(e,a,n)=>{const[o,$,R,A,k,P,O,N]=Ml(),[D,L,G]=zl(e,a,k),[j,H,M]=Wl(R,D,L,G),W=re(),B=(e=0)=>ce(W,(([l,a,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${a} => ${n},`]:[s+o+`(${l}): ${a};`];return e||_(r,Ll(d)),F(r,t),r})),U=(e,l,a,n,d,o=t)=>Pl(W,e,[l,a,n,d,o]),Z=(e,l,a,n,d,o=t,s=t,r=t)=>U(Tl[e]+l+(4==e?x:t)+a,o,n,(n==K?Fl:Bl)(Tl[e]+(4==e?x:t)+a,s,e?void 0:n),d,r),Q=(e,l,a,n=t,d=t,o=1,s=t)=>U(c+e+I,(n?n+", ":t)+Pe+": "+l+(o?", mutator?: boolean":t),Ae,Ul(c+e+I,d,o?"mutator":t),a,s),q=`./${Nl(n)}.d`,K=Nl(n,1),X=Nl(K),Y=[],ee=re();let le=[],te=[];if($(1,q,K,`create${K} as create${K}Decl`),ae(e))$(null,l,p);else{$(0,l,"CellChange"),$(null,l,i);const[e,a,n,o,I,c,T,y,v,V,x,A,P,O,N,G,H,M,W,B,U,_,te,ae,ne,oe,se,$e,ce]=j(X,K),ie=re();D(((e,l)=>{const t=`<'${e}'>`,a=[R(l+b,o+t,je+` the '${e}' `+b),R(l+b+Xe,I+t,je+` the '${e}' `+b+Ye),R(l+h,c+t,rl(e)),R(l+h+Xe,T+t,rl(e,1)),R(l+w+Ae,y+t,`A Cell Id for the '${e}' `+b),R(l+w+ge,V+t,ul(`a Cell Id and value from a Row in the '${e}' `+b)),R(l+h+ge,x+t,ul(`a Row Id from the '${e}' Table, and a Cell iterator`)),R(l+b+w+ge,A+t,ul(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];ue(ie,e,a),$(1,q,...a)})),$(1,q,e,a,n,y,P,O,N,G,H,M,W,B,U,_,te,ae,ne,oe,se,$e,ce),le=[e,a,n,y,O,N,G,H,M,W,B,U,_,te,ae,ne,oe,se,$e,ie],J([[e],[d],[K,"tables: "+a,"tables"],[K]],(([e,l,a],n)=>Z(n,t,p,e,sl(1,n),l,a))),Z(0,t,C,n+We,Il(b,Be)),Z(5,t,b,qe,$l(b,Be),"tableCallback: "+P,"tableCallback as any"),D(((e,l,a)=>{const[n,o,s,r,I,$,c,u]=Ie(ie,e);J([[n],[d],[K,"table: "+o,", table"],[K]],(([n,d,o=t],s)=>Z(s,l,b,n,hl(e,s),d,a+o))),Z(0,l,b+f,i,Il(w,"the whole of "+pl(e)),t,a),Z(5,l,b+w,qe,$l(b+w,"the whole of "+pl(e)),"tableCellCallback: "+u,a+", tableCellCallback as any"),Z(0,l,h+fe,"number","Gets the number of Rows in the "+pl(e),t,a),Z(0,l,m,i,Il(h,pl(e)),t,a),Z(0,l,g,i,Il(h,pl(e),1),"cellId?: "+I+ze,a+", cellId, descending, offset, limit"),Z(5,l,h,qe,$l(h,pl(e)),"rowCallback: "+c,a+", rowCallback as any"),J([[s],[d],[K,", row: "+r,", row"],[K],[K,", partialRow: "+r,", partialRow"]],(([n,d=t,o=t],s)=>Z(s,l,h,n,ml(e,s),He+d,a+", rowId"+o))),Z(6,l,h,Ae+Ee,"Add a new Row to "+pl(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),Z(0,l,f,I+We,Il(w,Cl(e)),He,a+", rowId"),Z(5,l,w,qe,$l(w,Cl(e)),He+", cellCallback: "+$,a+", rowId, cellCallback as any"),L(e,((n,o,s,r,I)=>{const $="Map"+Nl(o,1);ue(ee,o,$);const c=o+(S(s)?Ee:t);J([[c],[d],[K,`, cell: ${o} | `+$,", cell as any"],[K]],(([d,o=t,s=t],$)=>Z($,l+I,w,d,gl(e,n,$),He+o,a+", rowId, "+r+s))),Z(1,l+I,b+w,d,fl[1]+` the '${n}' Cell anywhere in `+pl(e),t,a+", "+r)}))})),Z(0,t,p+Se,Se,sl(1,6)),Z(2,t,p+Se,K,sl(1,7),"tablesJson: "+Se,"tables"+Se),Q(u+p,O,sl(1,8,0,1)+" changes"),Q(p,N,sl(1,8)+" changes"),Q(C,G,bl(2,0,1)),Q(u+b,H,bl(3,0,0,1),`tableId: ${n} | null`,"tableId"),Q(b,M,bl(3,0),`tableId: ${n} | null`,"tableId"),Q(b+f,W,bl(14,3,1),`tableId: ${n} | null`,"tableId"),Q(u+b+w,B,bl(16,3,0,1),`tableId: ${n} | null, cellId: ${z(D((e=>Ie(ie,e)?.[4]??t))," | ")} | null`,"tableId, cellId"),Q(h+fe,U,bl(15,3),`tableId: ${n} | null`,"tableId"),Q(m,_,bl(4,3,1),`tableId: ${n} | null`,"tableId"),Q(g,te,bl(13,3,1),Gl("tableId: TId",`cellId: ${y}<TId>`+Ee,"descending: boolean","offset: number","limit: number"+Ee),Gl("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),Q(u+h,ae,bl(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(h,ne,bl(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(f,oe,bl(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(u+w,se,bl(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${z(D((e=>Ie(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),Q(w,$e,bl(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${z(D((e=>Ie(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),Q(ke+w,ce,Ge+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),$(1,q,...de(ee)),F(Y,".set"+p+Me+"({",El(D(((e,l,a)=>[`[${a}]: {`,...L(e,((e,l,a,n)=>`[${n}]: {[${k(Dl(s),`'${s}'`)}]: ${k(Dl(l),`'${l}'`)}${S(a)?t:`, [${k(Dl(r),`'${r}'`)}]: `+(E(a)?k(Dl(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(ae(a))$(null,l,y);else{const[e,a,n,o,I,c,i,b,p,C,h]=H(X,K);$(1,q,e,a,n,I,c,i,b,p,C,h),te=[e,a,n,c,i,b,p,C],J([[e],[d],[K,"values: "+a,"values"],[K],[K,"partialValues: "+a,"partialValues"]],(([e,l,a],n)=>Z(n,t,y,e,sl(2,n),l,a))),Z(0,t,v,n+We,Il(T,Be)),Z(5,t,T,"void",$l(T,Be),"valueCallback: "+I,"valueCallback as any"),G(((e,l,a,n,o)=>{const s="Map"+Nl(l,1);ue(ee,l,s),J([[l],[d],[K,`value: ${l} | `+s,", value as any"],[K]],(([l,a,d=t],s)=>Z(s,o,T,l,wl(e,s),a,n+d)))})),Z(0,t,y+Se,Se,sl(2,6)),Z(2,t,y+Se,K,sl(2,7),"valuesJson: "+Se,"values"+Se),Q(u+y,c,sl(2,8,0,1)+" changes"),Q(y,i,sl(2,8)+" changes"),Q(v,b,bl(10,0,1)),Q(u+T,p,bl(11,0,0,1),`valueId: ${n} | null`,"valueId"),Q(T,C,bl(11,0),`valueId: ${n} | null`,"valueId"),Q(ke+T,h,Ge+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),$(1,q,...de(ee)),$(0,l,"ValueChange"),F(Y,".set"+y+Me+"({",G(((e,l,a,n)=>[`[${n}]: {[${k(Dl(s),`'${s}'`)}]: ${k(Dl(l),`'${l}'`)}${S(a)?t:`, [${k(Dl(r),`'${r}'`)}]: `+(E(a)?k(Dl(a),`'${a}'`):a)}},`])),"})")}Z(0,t,"Content",`[${p}, ${y}]`,sl(0,0)),Z(2,t,"Content",K,sl(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),Z(7,t,"applyChanges",K,`Applies a set of ${we} to the Store`,"changes: "+we,"changes"),$e(ee,((e,l)=>R(l,`(cell: ${e}${Ee}) => `+e,`Takes a ${e} Cell value and returns another`))),$(null,l,"DoRollback",Ae,"IdOrNull",Se,"Store",we),Z(0,t,Se,Se,sl(0,6)),Z(2,t,Se,K,sl(0,7),"tablesAndValuesJson: "+Se,"tablesAndValuesJson"),Z(7,t,Fe,"Return",Ue,xe,"actions, doRollback","<Return>"),Z(7,t,"start"+V,K,_e),Z(7,t,"finish"+V,K,Ze,Ve,"doRollback");const ne=M(X,K);return Q("Start"+V,ne,Ge+" just before the start of the "+Fe,t,t,0),Q("WillFinish"+V,ne,Ge+" just before "+Qe,t,t,0),Q("DidFinish"+V,ne,Ge+" just after "+Qe,t,t,0),Z(7,t,"call"+I,K,"Manually provoke a listener to be called","listenerId: Id","listenerId"),Z(3,t,I,K,"Remove a listener that was previously added to "+Be,"listenerId: Id","listenerId"),U("getStore",t,"Store","store",fl[0]+" the underlying Store object"),$(1,l,"createStore"),$(1,q,K,`create${K} as create${K}Decl`,ne),k("store",["createStore()",...Y]),A("fluent","actions: () => Store",["actions();",`return ${X};`]),A("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${X}, ...params)`),k(X,["{",...B(1),"}"]),[o(...P(0),...O(),Re+" interface "+K+" {",...B(0),"}",t,Ll(`Creates a ${K} object`),Re+" function create"+K+"(): "+K+";"),o(...P(1),Re+" const create"+K+": typeof create"+K+"Decl = () => {",...N(),`return Object.freeze(${X});`,"};"),le,te]},Zl=e=>$+e,Ql=e=>Gl(Zl(e),Zl(e)+ye),ql="debugIds?: boolean",Kl="debugIds={debugIds}",Xl="then"+ve,Yl="Parameter",et=": (parameter: "+Yl+", store: Store) => ",lt="const contextValue = useContext(Context);",tt=", based on a parameter",at=": ",nt="<"+Yl+",>",dt=Yl+"ized"+ge+"<"+Yl+">",ot="rowId",st="rowId={rowId}",rt=", separator, debugIds",It="separator?: ReactElement | string",$t="then?: (store: Store",ct=Gl($t+")"+Ke,Xl),ut="then, then"+ye,it=ot+at+Ae,bt="View",pt=(e,...l)=>Gl(...l,Pe+": "+e,Pe+ve,"mutator?: boolean"),Ct=(...e)=>Gl(...e,Pe,Pe+ye,"mutator"),ht=(e,a,n,s,r)=>{const[$,c,V,R,A,k,P,O]=Ml(),[E,N,D]=zl(e,a,A),L=`./${Nl(n)}.d`,G=`./${Nl(n)}-ui-react.d`,j="tinybase/ui-react",H=Nl(n,1),M=Nl(H),J=H+"Or"+H+Ae,W=M+"Or"+H+Ae,B=M+`={${M}}`,U=re(),Z=(e,l,a,n,d,o=t)=>(c(1,G,e+" as "+e+"Decl"),Pl(U,e,[l,a,n,d,o])),Q=(e,l,a,n,d,o=t)=>Z("use"+e,l,a,n,d,o),q=(e,l,a,n,d=t,o=t,s=t,r=t,I=t)=>(c(1,j,`use${l} as use${l}Core`),Q(e,Gl(d,le,r),a,ne+`(${W}, use${l}Core, [`+(o||t)+(I?"], ["+I:t)+"]);",n,s)),K=(e,l,t,a)=>Z(e,l,1,t,a),X=(e=0)=>ce(U,(([l,a,n,d,o],s)=>{const r=e?[Re+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==a?"any":a} =>`,n]:[Re+` function ${s}${o}(${l}): ${1==a?"ComponentReturnType":a};`];return e||_(r,Ll(d)),F(r,t),r}));c(null,l,Ae,"Store",ge,Yl+"ized"+ge),c(0,j,"ComponentReturnType"),c(1,j,"useCellIds"),c(null,j,"ExtraProps"),c(0,L,H);const Y=V(J,H+" | "+Ae,`Used when you need to refer to a ${H} in a React hook or component`),ee=V(Le+De,Hl(M+Oe+H,M+`ById?: {[${M}Id: Id]: ${H}}`),`Used with the ${Le} component, so that a `+H+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,G,Y,ee);const le=W+Oe+Y;A("{createContext, useContext, useMemo}","React"),A("Context",`createContext<[${H}?, {[${M}Id: Id]: ${H}}?]>([])`),Q("Create"+H,`create: () => ${H}, create`+ve,H,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${H} within a React application with convenient memoization`);const te=Q(H,"id?: Id",H+Ee,["{",lt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${H} from within a ${Le} component context`),ne=R("useHook",W+`: ${Y} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${te}(${W} as Id);`,`return hook(...preParams, ((${W} == null || typeof ${W} == 'string')`,`? ${M} : ${W})?.getStore(), ...postParams)`]),de=R("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=R("wrap",Gl("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),se=R("useCustomOrDefaultCellIds",Gl("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${W}?: ${Y} | undefined`),[`const defaultCellIds = ${ne}(${W}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),$e=A("NullComponent","() => null");if(!ae(e)){const[e,a,n,r,$,T,y,v,A,k,P,O,D,j,J,W,F,U,_,Z]=s;c(null,L,e,a,n,$,T,y,v,A,k,P,O,D,j,J,W,F,_,U),c(0,L,r),c(1,L,H),c(null,l,i,"IdOrNull");const Q=R("tableView",`{${M}, rowComponent, getRowComponentProps, customCellIds`+rt+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+de+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",st,"customCellIds={customCellIds}",B,Kl,"/>","))",rt,", tableId,",");"]),X=R("getDefaultTableComponent","tableId: Id",z(E(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+$e),Y=R("getDefaultCellComponent","tableId: Id, cellId: Id",z(E(((e,l,t)=>`tableId == ${t} ? ${z(N(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+$e} : `)))+$e);q(u+p,u+p,d,sl(1,0,0,1)+me),q(p,p,e,sl(1,0)+me);const ee=q(C,C,n+We,Il(b,Be)+me);q(Je+p+ge,Je+p+ge,dt,sl(1,9)+tt,Gl(Zl(p)+et+a,Zl(p)+ve),Ql(p),nt,Gl($t,`tables: ${a})`+Ke,Xl),ut),q(Te+p+ge,Te+p+ge,ge,sl(1,12),t,t,t,ct,ut);const le=V(w+De,Hl("tableId?: TId","rowId: Id","cellId?: CId",M+Oe+H,ql),cl(Ce+w),`<TId extends ${n}, CId extends ${r}<TId>>`),te=V(h+De,Hl("tableId?: TId","rowId: Id",M+Oe+H,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${le}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,It,ql),cl(Ce+h),`<TId extends ${n}>`),ae=V(b+De,Hl("tableId?: TId",M+Oe+H,`rowComponent?: ComponentType<${te}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",It,ql),cl(Ce+b),`<TId extends ${n}>`),ne=V("Sorted"+b+De,Hl("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",M+Oe+H,`rowComponent?: ComponentType<${te}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",It,ql),cl(Ce+"sorted "+b),`<TId extends ${n}>`),re=V(p+De,Hl(M+Oe+H,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${ae}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,It,ql),cl(ol(1,1)));c(1,G,re,ae,ne,te,le),K(p+bt,"{"+M+", tableComponents, getTableComponentProps"+rt+"}: "+re,[oe+`(${ee}(${M}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+X+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${de}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",B,Kl,"/>;","}), separator)"],sl(1,13)+me),E(((e,l,a)=>{const[n,s,r,I,$]=Ie(Z,e);c(null,L,n,s,r,I,$),q(u+l+b,u+b,d,hl(e,0,1)+me,t,a),q(l+b,b,n,hl(e)+me,t,a),q(l+b+f,b+f,i,Il(w,"the whole of "+pl(e))+me,t,a),q(l+h+fe,h+fe,o,"Gets the number of Rows in "+pl(e)+me,t,a);const p=q(l+m,m,i,Il(h,pl(e))+me,t,a),C=q(l+g,g,i,Il(h,pl(e),1)+me,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");q(u+l+h,u+h,d,ml(e,0,1)+me,it,Gl(a,ot)),q(l+h,h,r,ml(e)+me,it,Gl(a,ot)),q(l+f,f,$+We,Il(w,Cl(e))+me,it,Gl(a,ot)),q(Je+l+b+ge,Je+b+ge,dt,hl(e,9)+tt,Gl(Zl(b)+et+s,Zl(b)+ve),Gl(a,Ql(b)),nt,Gl($t,`table: ${s})`+Ke,Xl),ut),q(Te+l+b+ge,Te+b+ge,ge,hl(e,12),t,a,t,ct,ut),q(Je+l+h+ge,Je+h+ge,dt,ml(e,9)+tt,Gl(it,Zl(h)+et+I,Zl(h)+ve),Gl(a,ot,Ql(h)),nt,Gl($t,`row: ${I})`+Ke,Xl),ut),q("Add"+l+h+ge,"Add"+h+ge,dt,ml(e,10)+tt,Gl(Zl(h)+et+I,Zl(h)+ve),Gl(a,Ql(h)),nt,"then?: ("+Gl(it+Ee,"store: Store","row: "+I+")"+Ke,"then"+ve)+", reuseRowIds?: boolean",ut+", reuseRowIds"),q(Je+l+x+h+ge,Je+x+h+ge,dt,ml(e,11)+tt,Gl(it,Zl(x+h)+et+I,Zl(x+h)+ve),Gl(a,ot,Ql(x+h)),nt,Gl($t,`partialRow: ${I})`+Ke,Xl),ut),q(Te+l+h+ge,Te+h+ge,ge,ml(e,12),it,Gl(a,ot),t,ct,ut);const T=K(l+h+bt,"{rowId, "+M+", cellComponents, getCellComponentProps, customCellIds"+rt+`}: ${te}<'${e}'>`,[oe+`(${se}(customCellIds, `+a+`, rowId, ${M}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+Y+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${de}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,st,"cellId={cellId}",B,Kl,"/>;","})"+rt+", rowId)"],ml(e,13)+me);K(l+"Sorted"+b+bt,"{cellId, descending, offset, limit, ...props}: "+ne+`<'${e}'>`,Q+"(props, "+C+`(cellId, descending, offset, limit, props.${M}), ${a}, ${T});`,hl(e,13)+", sorted"+me),K(l+b+bt,`props: ${ae}<'${e}'>`,Q+"(props, "+p+`(props.${M}), ${a}, ${T});`,hl(e,13)+me),N(e,((n,o,s,r,I)=>{const $="Map"+Nl(o,1);c(0,L,$),c(1,L,$),q(u+l+I+b+w,u+b+w,d,`Gets ${dl(1)}the '${n}' Cell anywhere in `+pl(e)+me,t,Gl(a,r)),q(u+l+I+w,u+w,d,gl(e,n,0,1)+me,it,Gl(a,ot,r));const i=q(l+I+w,w,o+(S(s)?Ee:t),gl(e,n)+me,it,Gl(a,ot,r));q(Je+l+I+w+ge,Je+w+ge,dt,gl(e,n,9)+tt,Gl(it,Zl(w)+et+o+" | "+$,Zl(w)+ve),Gl(a,ot,r,Ql(w)),nt,Gl($t,`cell: ${o} | ${$})`+Ke,Xl),ut),q(Te+l+I+w+ge,Te+w+ge,ge,gl(e,n,12),Gl(it,"forceDel?: boolean"),Gl(a,ot,r,"forceDel"),t,ct,ut),K(l+I+w+bt,`{rowId, ${M}, debugIds}: `+le+`<'${e}', '${n}'>`,[oe+`('' + ${i}(rowId, `+M+`) ?? '', undefined, debugIds, ${r})`],gl(e,n,13)+me)}))}));const ce=z(E((e=>Ie(Z,e)?.[4]??t))," | ");q(u+p+I,u+p+I,qe,sl(1,8,0,1)+" changes",pt($),Ct()),q(p+I,p+I,qe,sl(1,8)+" changes",pt(T),Ct()),q(C+I,C+I,qe,bl(2,0,1),pt(y),Ct()),q(u+b+I,u+b+I,qe,bl(3,0,0,1),pt(v,`tableId: ${n} | null`),Ct("tableId")),q(b+I,b+I,qe,bl(3,0),pt(A,`tableId: ${n} | null`),Ct("tableId")),q(b+f+I,b+f+I,qe,bl(14,3,1),pt(k,`tableId: ${n} | null`),Ct("tableId")),q(u+b+w+I,u+b+w+I,qe,bl(16,3,0,1),pt(P,`tableId: ${n} | null`,`cellId: ${ce} | null`),Ct("tableId","cellId")),q(h+fe+I,h+fe+I,qe,bl(15,3),pt(O,`tableId: ${n} | null`),Ct("tableId")),q(m+I,m+I,qe,bl(4,3,1),pt(D,`tableId: ${n} | null`),Ct("tableId")),q(g+I,g+I,qe,bl(13,3,1),pt(j,`tableId: ${n} | null`,"cellId: "+ce+Ee,"descending: boolean","offset: number","limit: number"+Ee),Ct("tableId","cellId","descending","offset","limit")),q(u+h+I,u+h+I,qe,bl(5,3,0,1),pt(J,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),q(h+I,h+I,qe,bl(5,3),pt(W,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),q(f+I,f+I,qe,bl(6,5,1),pt(F,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),q(u+w+I,u+w+I,qe,bl(7,5,0,1),pt(U,`tableId: ${n} | null`,ot+": IdOrNull",`cellId: ${ce} | null`),Ct("tableId",ot,"cellId")),q(w+I,w+I,qe,bl(7,5),pt(_,`tableId: ${n} | null`,ot+": IdOrNull",`cellId: ${ce} | null`),Ct("tableId",ot,"cellId"))}if(!ae(a)){const[e,l,a,n,o,s,$,i]=r;c(null,L,...r),c(1,L,H);const b=R("getDefaultValueComponent","valueId: Id",z(D(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+$e);q(u+y,u+y,d,sl(2,0,0,1)+me),q(y,y,e,sl(2,0)+me);const p=q(v,v,a+We,Il(T,Be)+me);q(Je+y+ge,Je+y+ge,dt,sl(2,9)+tt,Gl(Zl(y)+et+l,Zl(y)+ve),Ql(y),nt,Gl($t,`values: ${l})`+Ke,Xl),ut),q(Je+x+y+ge,Je+x+y+ge,dt,sl(2,11)+tt,Gl(Zl(x+y)+et+l,Zl(x+y)+ve),Ql(x+y),nt,Gl($t,`partialValues: ${l})`+Ke,Xl),ut),q(Te+y+ge,Te+y+ge,ge,sl(2,12),t,t,t,ct,ut);const C=V(T+De,Hl("valueId?: VId",M+Oe+H,ql),cl("a Value"),`<VId extends ${a}>`),h=V(y+De,Hl(M+Oe+H,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${C}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,It,ql),cl(ol(2,1)));c(1,G,h,C),K(y+bt,"{"+M+", valueComponents, getValueComponentProps"+rt+"}: "+h,[oe+`(${p}(${M}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+b+"(valueId);","return <Value",`{...${de}(getValueComponentProps, valueId)}`,"key={valueId}",B,Kl,"/>;","}), separator)"],sl(2,13)+me),D(((e,l,a,n,o)=>{const s="Map"+Nl(l,1);c(0,L,s),c(1,L,s),q(u+o+T,u+T,d,wl(e,0,1)+me,t,n);const r=q(o+T,T,l,wl(e)+me,t,n);q(Je+o+T+ge,Je+T+ge,dt,wl(e,9)+tt,Gl(Zl(T)+et+l+" | "+s,Zl(T)+ve),Gl(n,Ql(T)),nt,Gl($t,`value: ${l} | ${s})`+Ke,Xl),ut),q(Te+o+T+ge,Te+T+ge,ge,wl(e,12),t,n,t,ct,ut),K(o+T+bt,`{${M}, debugIds}: ${C}<'${e}'>`,[oe+`('' + ${r}(`+M+`) ?? '', undefined, debugIds, ${n})`],wl(e,13)+me)})),q(u+y+I,u+y+I,qe,sl(2,8,0,1)+" changes",pt(n),Ct()),q(y+I,y+I,qe,sl(2,8)+" changes",pt(o),Ct()),q(v+I,v+I,qe,bl(10,0,1),pt(s),Ct()),q(u+T+I,u+T+I,qe,bl(11,0,0,1),pt($,`valueId: ${a} | null`),Ct("valueId")),q(T+I,T+I,qe,bl(11,0),pt(i,`valueId: ${a} | null`),Ct("valueId"))}return K(Le,`{${M}, ${M}ById, children}: `+ee+" & {readonly children: React.ReactNode}",["{",lt,"return (","<Context."+Le,"value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}",`</Context.${Le}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[$(...k(0),...P(),...X(0)),$(...k(1),...O(),...X(1))]},mt=(e,l,a)=>{if(ae(e)&&ae(l))return[t,t,t,t];const[n,d,o,s]=_l(e,l,a);return[n,d,...ht(e,l,a,o,s)]},gt=JSON.parse,wt="prettier/",ft=wt+"plugins/",Tt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},yt=Jl((e=>{const l=()=>{const l=gt(e.getTablesSchemaJson());return!ae(l)||H(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=re();if(H(a,(l=>H(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=ie(n,a,(()=>[j(d),re(),[0],0])),[s,r,[I]]=o,$=ie(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),ue(r,d,$),o[3]++,s==j(d)})))))return l[t]={},oe(n,(([e,,[,n],d],o)=>{l[t][o]={[s]:e,...d==L(a)?{[r]:n}:{}}})),1}))?l:{}},t=()=>{const l=gt(e.getValuesSchemaJson());return ae(l)&&e.forEachValue(((e,t)=>{l[e]={[s]:j(t)}})),l},a=e=>mt(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(wt+"standalone")).format,F(t,await import(ft+"estree"),await import(ft+"typescript"))}catch{n=async e=>e}return await G(W(a(e),(async(e,a)=>Ol(await n(e,{...Tt,plugins:t,filepath:"_."+l[a]})))))};return ee({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:L(e.getValueIds()),jsonLength:L(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{yt as createTools};
Binary file
@@ -1 +1 @@
1
- const e=e=>typeof e,l="tinybase",t="",a=",",n=e(t),d=e(!0),o=e(0),s="type",r="default",I="Listener",$="get",c="add",u="Has",i="Ids",b="Table",p=b+"s",C=b+i,h="Row",m=h+i,g="Sorted"+h+i,w="Cell",f=w+i,T="Value",y=T+"s",v=T+i,V=Promise,x=isFinite,R=e=>null==e,A=(e,l,t)=>R(e)?t?.():l(e),k=e=>e==n||e==d,S=l=>e(l)==n,P=e=>Array.isArray(e),O=(e,l,t)=>e.slice(l,t),E=e=>e.length,N=async e=>V.all(e),D=l=>{const t=e(l);return k(t)||t==o&&x(l)?t:void 0},L=(e,l)=>e.every(l),G=(e,l)=>e.sort(l),j=(e,l)=>e.forEach(l),H=(e,l=t)=>e.join(l),M=(e,l)=>e.map(l),J=(e,l)=>e.filter(l),z=(e,...l)=>e.push(...l),W=e=>e.pop(),B=(e,...l)=>e.unshift(...l),F=e=>e.shift(),U=Object,_=e=>U.getPrototypeOf(e),Z=U.entries,Q=e=>!R(e)&&A(_(e),(e=>e==U.prototype||R(_(e))),(()=>!0)),q=U.keys,K=U.freeze,X=(e,l)=>M(Z(e),(([e,t])=>l(t,e))),Y=e=>E(q(e)),ee=e=>Q(e)&&0==Y(e),le=(e,l)=>e?.has(l)??!1,te=e=>[...e?.values()??[]],ae=(e,l)=>e?.forEach(l),ne=(e,l)=>e?.delete(l),de=e=>new Map(e),oe=(e,l)=>e?.get(l),se=(e,l)=>ae(e,((e,t)=>l(t,e))),re=(e,l)=>M([...e?.entries()??[]],(([e,t])=>l(t,e))),Ie=(e,l,t)=>R(t)?(ne(e,l),e):e?.set(l,t),$e=(e,l,t,a)=>(le(e,l)||Ie(e,l,t()),oe(e,l)),ce=e=>e.toUpperCase(),ue=e=>e.toLowerCase(),ie="a ",be="A function for",pe=", and registers a listener so that any changes to that result will cause a re-render",Ce="Callback",he="Changes",me="Count",ge="Del",we="Deps",fe=we+"?: React.DependencyList",Te="doRollback?: DoRollback",ye="actions: () => Return, "+Te,ve="export",Ve="Id",xe="Invalid",Re="Json",Ae=ue(I),ke="?: ",Se=" | undefined",Pe="NonNullable",Oe="Partial",Ee="Props",Ne="Provider",De=`Registers a ${Ae} that will be called`,Le="Represents",Ge="rowId: "+Ve,je="Schema",He="Set",Me=", descending?: boolean, offset?: number, limit?: number",Je="[]",ze="the Store",We="Transaction",Be=ue(We),Fe="Execute a "+Be+" to make multiple mutations",Ue="Explicitly starts a "+Be,_e="Explicitly finishes a "+Be,Ze="the end of the "+Be,Qe="void",qe=" => "+Qe,Ke="WhenSet",Xe=" when setting it",Ye=ie+"string serialization of",el=" ",ll="Gets a callback that can ",tl="the ",al=" the schema for",nl=(e=0)=>e?"the existence of ":"",dl=(e=0,l=0,a=0)=>nl(a)+`the ${yl[e]}content of`+(l?el+ze:t),ol=(e=0,l,a=0,n=0)=>wl[l]+el+nl(n)+dl(e,1)+(a?" when setting it":t),sl=(e,l=0)=>Le+` a Row when ${l?"s":"g"}etting ${dl()} the '${e}' `+b,rl=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,Il=(e,l)=>`Calls a function for each ${e} in `+l,$l=e=>"The props passed to a component that renders "+e,cl=e=>"A function that takes "+e,ul=(e,l=0,t=0)=>be+" listening to changes to "+nl(t)+Tl[e]+" in "+Tl[l],il=(e,l,a=0,n=0)=>De+" whenever "+nl(n)+Tl[e]+" in "+Tl[l]+" change"+(a?t:"s"),bl=e=>`the '${e}' `+b,pl=e=>"the specified Row in "+bl(e),Cl=(e,l=0,t=0)=>wl[l]+el+dl(0,0,t)+el+bl(e),hl=(e,l=0,t=0)=>wl[l]+` ${dl(0,0,t)} `+pl(e),ml=(e,l,t=0,a=0)=>wl[t]+el+nl(a)+`the '${l}' Cell for `+pl(e),gl=(e,l=0,t=0)=>wl[l]+el+nl(t)+`the '${e}' Value`,wl=["Gets","Checks existence of","Sets","Deletes","Sets part of",Le,"Gets "+Ye,"Sets "+Ye,De+" whenever",ll+"set",ll+"add",ll+"set part of",ll+"delete","Renders","Gets "+Ye+al,"Sets"+al,"Deletes"+al],fl=[$,"has","set","del","set","forEach",c,t],Tl=[ze,p,tl+b+el+i,ie+b,tl+h+el+i,ie+h,tl+w+el+i,ie+w,"invalid Cell changes",y,tl+T+el+i,ie+T,"invalid Value changes",tl+"sorted "+h+el+i,tl+w+el+i+" anywhere",tl+"number of Rows",ie+w+" anywhere"],yl=[t,"tabular ","keyed value "],vl=e=>new Set(P(e)||R(e)?e:[e]),Vl=(e,l)=>e?.add(l),xl=/[^A-Za-z]+/,Rl=/[^A-Za-z0-9]+/,Al=/^( *)\/\*\* *(.*?) *\*\/$/gm,kl=e=>e.includes(a),Sl=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return le(e,n)?Sl(e,l,t,a+1):(Ie(e,n,t),n)},Pl=e=>e.replace(Al,((e,l,t)=>{const a=77-E(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),Ol=e=>e.flat(1e3),El=(e,l=0)=>H(M(e.split(Rl),((e,t)=>(t>0||l?ce:ue)(O(e,0,1))+O(e,1)))),Nl=e=>ce(H((e&&!xl.test(e[0])?e:" "+e).split(Rl),"_")),Dl=e=>`/** ${e}. */`,Ll=(...e)=>H(J(e,(e=>e)),", "),Gl=(...e)=>"{"+H(e,"; ")+"}",jl=(...e)=>Gl(...M(e,(e=>"readonly "+e))),Hl=()=>{const e=[de(),de(),de(),de()],l=de(),a=de(),n=e=>{const l=e.indexOf(" as ");return-1!=l?O(e,l+4):e};return[(...e)=>H(Ol(e),"\n"),(l,t,...a)=>j(a,(a=>j([0,1],(n=>(l??n)==n?Vl($e(e[n],t,vl),a):0)))),(e,a,n,d=t,o=1)=>Sl(l,e,[a,n,d,o]),(e,l,t)=>Sl(a,e,P(t)?[`(${l}) => {`,t,"}"]:[`(${l}) => ${t}`]),(e,l)=>oe(a,e)===l?e:Sl(a,e,l),(l=0)=>M([...G(re(e[l],((e,l)=>`import {${H(G(te(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>kl(e)!=kl(l)?kl(e)?-1:1:e>l?1:-1)),t],(e=>e.replace("{React}","React"))),()=>re(l,(([e,l,a,n],d)=>[Dl(l),`${n?ve+" ":t}type ${d}${a} = ${e};`,t])),()=>re(a,((e,l)=>(e=P(e)?e:[e],z(e,W(e)+";"),[`const ${l} = ${F(e)}`,e,t])))]},Ml=(e,l)=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},Jl=(e,l,t)=>[l=>X(e,((e,a)=>l(a,El(a,1),t(Nl(a),`'${a}'`)))),(l,a)=>X(e[l],((e,l)=>a(l,e[s],e[r],t(Nl(l),`'${l}'`),El(l,1)))),e=>X(l,((l,a)=>e(a,l[s],l[r],t(Nl(a),`'${a}'`),El(a,1))))],zl=(e,l,a,n)=>[(n,d)=>{const o=n+": "+d,s=e(p,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...a(e,((e,l,a)=>`'${e}'${R(a)?"?":t}: ${l}`)))+"}"))),ol(1,5)),r=e(p+Ke,Gl(...l((e=>`'${e}'?: {[rowId: Id]: `+Gl(...a(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),ol(1,5,1)),$=e(b+Ve,"keyof "+s,"A "+b+" Id in "+ze),c=`<TId extends ${$}>`,i=e(b,Pe+`<${s}[TId]>`,"A "+b+" in "+ze,c),T=e(b+Ke,Pe+`<${r}[TId]>`,"A "+b+" in "+ze+Xe,c),y=e(h,i+"<TId>[Id]","A "+h+" in a "+b,c),v=e(h+Ke,T+"<TId>[Id]","A "+h+" in a "+b+Xe,c),V=e(w+Ve,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+h,c),x=e(w,Pe+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+h,`<TId extends ${$}, CId extends ${V}<TId>>`),A=e("CellIdCellArray",`CId extends ${V}<TId> ? [cellId: CId, cell: ${x}<TId, CId>] : never`,w+" Ids and types in a "+h,`<TId extends ${$}, CId = ${V}<TId>>`,0),k=e(w+Ce,`(...[cellId, cell]: ${A}<TId>)`+qe,cl(ie+w+" Id, and "+w),c),S=e(h+Ce,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+qe+") "+qe,cl(ie+h+" Id, and a "+w+" iterator"),c),P=e(b+w+Ce,`(cellId: ${V}<TId>, count: number) `+qe,cl(ie+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${$} ? [tableId: TId, forEachRow: (rowCallback: ${S}<TId>)${qe}] : never`,b+" Ids and callback types",`<TId = ${$}>`,0),E=e(b+Ce,`(...[tableId, forEachRow]: ${O})`+qe,cl(ie+b+" Id, and a "+h+" iterator"),t),N=e("TableIdRowIdCellIdArray",`TId extends ${$} ? [tableId: TId, rowId: Id, cellId: ${V}<TId>] : never`,"Ids for GetCellChange",`<TId = ${$}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${N}) => CellChange`,be+" returning information about any Cell's changes during a "+Be),L=e(u+p+I,`(${o}, hasTables: boolean)`+qe,ul(1,0,1)),G=e(p+I,`(${o}, getCellChange: ${D}${Se})`+qe,ul(1)),j=e(C+I,`(${o})`+qe,ul(2)),H=e(u+b+I,`(${o}, tableId: ${$}, hasTable: boolean)`+qe,ul(3,0,1)),M=e(b+I,`(${o}, tableId: ${$}, getCellChange: ${D}${Se})`+qe,ul(3)),J=e(b+f+I,`(${o}, tableId: ${$})`+qe,ul(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${$} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${$}>`,0),B=e(u+b+w+I,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+qe,ul(16,3,1)),F=e(h+"Count"+I,`(${o}, tableId: ${$})`+qe,ul(15,3)),U=e(m+I,`(${o}, tableId: ${$})`+qe,ul(4,3)),_=e(g+I,"("+Ll(o,"tableId: "+$,"cellId: Id"+Se,"descending: boolean","offset: number","limit: number"+Se,"sortedRowIds: Ids")+")"+qe,ul(13,3)),Z=e(u+h+I,"("+Ll(""+o,"tableId: "+$,Ge,"hasRow: boolean")+")"+qe,ul(5,3,1)),Q=e(h+I,"("+Ll(""+o,"tableId: "+$,Ge,`getCellChange: ${D}${Se}`)+")"+qe,ul(5,3)),q=e(f+I,"("+Ll(""+o,"tableId: "+$,Ge)+")"+qe,ul(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${Ge}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${$} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${$}>`,0),Y=e(u+w+I,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+qe,ul(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${Ge}, cellId: CId, newCell: ${x}<TId, CId> ${Se}, oldCell: ${x}<TId, CId> ${Se}, getCellChange: ${D} ${Se}] : never`,"Cell args for CellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${$} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${$}>`,0);return[s,r,$,i,T,y,v,V,x,k,S,P,E,L,G,j,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+qe,ul(7,5)),e(xe+w+I,`(${o}, tableId: Id, ${Ge}, cellId: Id, invalidCells: any[])`+qe,ul(8))]},(l,a)=>{const d=l+": "+a,o=e(y,Gl(...n(((e,l,a)=>`'${e}'${R(a)?"?":t}: ${l}`))),ol(2,5)),s=e(y+Ke,Gl(...n(((e,l)=>`'${e}'?: ${l}`))),ol(2,5,1)),r=e(T+Ve,"keyof "+o,"A "+T+" Id in "+ze),$=e(T,Pe+`<${o}[VId]>`,"A "+T+" Id in "+ze,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${$}<VId>] : never`,T+" Ids and types in "+ze,`<VId = ${r}>`,0),i=e(T+Ce,`(...[valueId, value]: ${c})`+qe,cl(ie+T+" Id, and "+T)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,be+" returning information about any Value's changes during a "+Be),p=e(u+y+I,`(${d}, hasValues: boolean)`+qe,ul(9,0,1)),C=e(y+I,`(${d}, getValueChange: ${b}${Se})`+qe,ul(9)),h=e(v+I,`(${d})`+qe,ul(10)),m=e(u+T+I,`(${d}, valueId: ValueId, hasValue: boolean)`+qe,ul(11,0,1)),g=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${$}<VId> ${Se}, oldValue: ${$}<VId> ${Se}, getValueChange: ${b} ${Se}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,$,i,p,C,h,m,e(T+I,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+g+")"+qe,ul(11)),e(xe+T+I,`(${d}, valueId: Id, invalidValues: any[])`+qe,ul(12))]},(l,t)=>e(We+I,`(${l}: ${t})`+qe,be+" listening to the completion of a "+Be)],Wl=(e,l=t,a=t)=>`store.${e}(${l})`+(a?" as "+a:t),Bl=(e,l=t)=>`fluent(() => ${Wl(e,l)})`,Fl=(e,l=t,a=t)=>`store.${e}(${l?l+", ":t}proxy(listener)${a?", "+a:t})`,Ul=(e,a,n)=>{const[o,$,V,x,A,k,P,O]=Hl(),[E,N,D]=Jl(e,a,A),[L,G,M]=zl(V,E,N,D),J=de(),W=(e=0)=>re(J,(([l,a,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${a} => ${n},`]:[s+o+`(${l}): ${a};`];return e||B(r,Dl(d)),z(r,t),r})),F=(e,l,a,n,d,o=t)=>Sl(J,e,[l,a,n,d,o]),U=(e,l,a,n,d,o=t,s=t,r=t)=>F(fl[e]+l+(4==e?Oe:t)+a,o,n,(n==Q?Bl:Wl)(fl[e]+(4==e?Oe:t)+a,s,e?void 0:n),d,r),_=(e,l,a,n=t,d=t,o=1,s=t)=>F(c+e+I,(n?n+", ":t)+Ae+": "+l+(o?", mutator?: boolean":t),Ve,Fl(c+e+I,d,o?"mutator":t),a,s),Z=`./${El(n)}.d`,Q=El(n,1),q=El(Q),K=[],X=de();let Y=[],le=[];if($(1,Z,Q,`create${Q} as create${Q}Decl`),ee(e))$(null,l,p);else{$(0,l,"CellChange"),$(null,l,i);const[e,a,n,o,I,c,T,y,v,x,k,P,O,D,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ue]=L(q,Q),ie=de();E(((e,l)=>{const t=`<'${e}'>`,a=[V(l+b,o+t,Le+` the '${e}' `+b),V(l+b+Ke,I+t,Le+` the '${e}' `+b+Xe),V(l+h,c+t,sl(e)),V(l+h+Ke,T+t,sl(e,1)),V(l+w+Ve,y+t,`A Cell Id for the '${e}' `+b),V(l+w+Ce,x+t,cl(`a Cell Id and value from a Row in the '${e}' `+b)),V(l+h+Ce,k+t,cl(`a Row Id from the '${e}' Table, and a Cell iterator`)),V(l+b+w+Ce,P+t,cl(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];Ie(ie,e,a),$(1,Z,...a)})),$(1,Z,e,a,n,y,O,D,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ue),Y=[e,a,n,y,D,G,M,J,W,B,F,ee,le,ae,ne,se,re,$e,ce,ie],j([[e],[d],[Q,"tables: "+a,"tables"],[Q]],(([e,l,a],n)=>U(n,t,p,e,ol(1,n),l,a))),U(0,t,C,n+Je,rl(b,ze)),U(5,t,b,Qe,Il(b,ze),"tableCallback: "+O,"tableCallback as any"),E(((e,l,a)=>{const[n,o,s,r,I,$,c,u]=oe(ie,e);j([[n],[d],[Q,"table: "+o,", table"],[Q]],(([n,d,o=t],s)=>U(s,l,b,n,Cl(e,s),d,a+o))),U(0,l,b+f,i,rl(w,"the whole of "+bl(e)),t,a),U(5,l,b+w,Qe,Il(b+w,"the whole of "+bl(e)),"tableCellCallback: "+u,a+", tableCellCallback as any"),U(0,l,h+me,"number","Gets the number of Rows in the "+bl(e),t,a),U(0,l,m,i,rl(h,bl(e)),t,a),U(0,l,g,i,rl(h,bl(e),1),"cellId?: "+I+Me,a+", cellId, descending, offset, limit"),U(5,l,h,Qe,Il(h,bl(e)),"rowCallback: "+c,a+", rowCallback as any"),j([[s],[d],[Q,", row: "+r,", row"],[Q],[Q,", partialRow: "+r,", partialRow"]],(([n,d=t,o=t],s)=>U(s,l,h,n,hl(e,s),Ge+d,a+", rowId"+o))),U(6,l,h,Ve+Se,"Add a new Row to "+bl(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),U(0,l,f,I+Je,rl(w,pl(e)),Ge,a+", rowId"),U(5,l,w,Qe,Il(w,pl(e)),Ge+", cellCallback: "+$,a+", rowId, cellCallback as any"),N(e,((n,o,s,r,I)=>{const $="Map"+El(o,1);Ie(X,o,$);const c=o+(R(s)?Se:t);j([[c],[d],[Q,`, cell: ${o} | `+$,", cell as any"],[Q]],(([d,o=t,s=t],$)=>U($,l+I,w,d,ml(e,n,$),Ge+o,a+", rowId, "+r+s))),U(1,l+I,b+w,d,wl[1]+` the '${n}' Cell anywhere in `+bl(e),t,a+", "+r)}))})),U(0,t,p+Re,Re,ol(1,6)),U(2,t,p+Re,Q,ol(1,7),"tablesJson: "+Re,"tables"+Re),_(u+p,D,ol(1,8,0,1)+" changes"),_(p,G,ol(1,8)+" changes"),_(C,M,il(2,0,1)),_(u+b,J,il(3,0,0,1),`tableId: ${n} | null`,"tableId"),_(b,W,il(3,0),`tableId: ${n} | null`,"tableId"),_(b+f,B,il(14,3,1),`tableId: ${n} | null`,"tableId"),_(u+b+w,F,il(16,3,0,1),`tableId: ${n} | null, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, cellId"),_(h+me,ee,il(15,3),`tableId: ${n} | null`,"tableId"),_(m,le,il(4,3,1),`tableId: ${n} | null`,"tableId"),_(g,ae,il(13,3,1),Ll("tableId: TId",`cellId: ${y}<TId>`+Se,"descending: boolean","offset: number","limit: number"+Se),Ll("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),_(u+h,ne,il(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(h,se,il(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(f,re,il(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),_(u+w,$e,il(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),_(w,ce,il(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${H(E((e=>oe(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),_(xe+w,ue,De+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),$(1,Z,...te(X)),z(K,".set"+p+je+"({",Ol(E(((e,l,a)=>[`[${a}]: {`,...N(e,((e,l,a,n)=>`[${n}]: {[${A(Nl(s),`'${s}'`)}]: ${A(Nl(l),`'${l}'`)}${R(a)?t:`, [${A(Nl(r),`'${r}'`)}]: `+(S(a)?A(Nl(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(ee(a))$(null,l,y);else{const[e,a,n,o,I,c,i,b,p,C,h]=G(q,Q);$(1,Z,e,a,n,I,c,i,b,p,C,h),le=[e,a,n,c,i,b,p,C],j([[e],[d],[Q,"values: "+a,"values"],[Q],[Q,"partialValues: "+a,"partialValues"]],(([e,l,a],n)=>U(n,t,y,e,ol(2,n),l,a))),U(0,t,v,n+Je,rl(T,ze)),U(5,t,T,"void",Il(T,ze),"valueCallback: "+I,"valueCallback as any"),D(((e,l,a,n,o)=>{const s="Map"+El(l,1);Ie(X,l,s),j([[l],[d],[Q,`value: ${l} | `+s,", value as any"],[Q]],(([l,a,d=t],s)=>U(s,o,T,l,gl(e,s),a,n+d)))})),U(0,t,y+Re,Re,ol(2,6)),U(2,t,y+Re,Q,ol(2,7),"valuesJson: "+Re,"values"+Re),_(u+y,c,ol(2,8,0,1)+" changes"),_(y,i,ol(2,8)+" changes"),_(v,b,il(10,0,1)),_(u+T,p,il(11,0,0,1),`valueId: ${n} | null`,"valueId"),_(T,C,il(11,0),`valueId: ${n} | null`,"valueId"),_(xe+T,h,De+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),$(1,Z,...te(X)),$(0,l,"ValueChange"),z(K,".set"+y+je+"({",D(((e,l,a,n)=>[`[${n}]: {[${A(Nl(s),`'${s}'`)}]: ${A(Nl(l),`'${l}'`)}${R(a)?t:`, [${A(Nl(r),`'${r}'`)}]: `+(S(a)?A(Nl(a),`'${a}'`):a)}},`])),"})")}U(0,t,"Content",`[${p}, ${y}]`,ol(0,0)),U(2,t,"Content",Q,ol(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),U(7,t,"applyChanges",Q,`Applies a set of ${he} to the Store`,"changes: "+he,"changes"),se(X,((e,l)=>V(l,`(cell: ${e}${Se}) => `+e,`Takes a ${e} Cell value and returns another`))),$(null,l,"DoRollback",Ve,"IdOrNull",Re,"Store",he),U(0,t,Re,Re,ol(0,6)),U(2,t,Re,Q,ol(0,7),"tablesAndValuesJson: "+Re,"tablesAndValuesJson"),U(7,t,Be,"Return",Fe,ye,"actions, doRollback","<Return>"),U(7,t,"start"+We,Q,Ue),U(7,t,"finish"+We,Q,_e,Te,"doRollback");const ae=M(q,Q);return _("Start"+We,ae,De+" just before the start of the "+Be,t,t,0),_("WillFinish"+We,ae,De+" just before "+Ze,t,t,0),_("DidFinish"+We,ae,De+" just after "+Ze,t,t,0),U(7,t,"call"+I,Q,"Manually provoke a listener to be called","listenerId: Id","listenerId"),U(3,t,I,Q,"Remove a listener that was previously added to "+ze,"listenerId: Id","listenerId"),F("getStore",t,"Store","store",wl[0]+" the underlying Store object"),$(1,l,"createStore"),$(1,Z,Q,`create${Q} as create${Q}Decl`,ae),A("store",["createStore()",...K]),x("fluent","actions: () => Store",["actions();",`return ${q};`]),x("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${q}, ...params)`),A(q,["{",...W(1),"}"]),[o(...k(0),...P(),ve+" interface "+Q+" {",...W(0),"}",t,Dl(`Creates a ${Q} object`),ve+" function create"+Q+"(): "+Q+";"),o(...k(1),ve+" const create"+Q+": typeof create"+Q+"Decl = () => {",...O(),`return Object.freeze(${q});`,"};"),Y,le]},_l=e=>$+e,Zl=e=>Ll(_l(e),_l(e)+we),Ql="debugIds?: boolean",ql="debugIds={debugIds}",Kl="then"+fe,Xl="Parameter",Yl=": (parameter: "+Xl+", store: Store) => ",et="const contextValue = useContext(Context);",lt=", based on a parameter",tt=": ",at="<"+Xl+",>",nt=Xl+"ized"+Ce+"<"+Xl+">",dt="rowId",ot="rowId={rowId}",st=", separator, debugIds",rt="separator?: ReactElement | string",It="then?: (store: Store",$t=Ll(It+")"+qe,Kl),ct="then, then"+we,ut=dt+tt+Ve,it="View",bt=(e,...l)=>Ll(...l,Ae+": "+e,Ae+fe,"mutator?: boolean"),pt=(...e)=>Ll(...e,Ae,Ae+we,"mutator"),Ct=(e,a,n,s,r)=>{const[$,c,V,x,A,k,S,P]=Hl(),[O,E,N]=Jl(e,a,A),D=`./${El(n)}.d`,L=`./${El(n)}-ui-react.d`,G="tinybase/ui-react",j=El(n,1),M=El(j),J=j+"Or"+j+Ve,W=M+"Or"+j+Ve,F=M+`={${M}}`,U=de(),_=(e,l,a,n,d,o=t)=>(c(1,L,e+" as "+e+"Decl"),Sl(U,e,[l,a,n,d,o])),Z=(e,l,a,n,d,o=t)=>_("use"+e,l,a,n,d,o),Q=(e,l,a,n,d=t,o=t,s=t,r=t,I=t)=>(c(1,G,`use${l} as use${l}Core`),Z(e,Ll(d,le,r),a,ae+`(${W}, use${l}Core, [`+(o||t)+(I?"], ["+I:t)+"]);",n,s)),q=(e,l,t,a)=>_(e,l,1,t,a),K=(e=0)=>re(U,(([l,a,n,d,o],s)=>{const r=e?[ve+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==a?"any":a} =>`,n]:[ve+` function ${s}${o}(${l}): ${1==a?"ComponentReturnType":a};`];return e||B(r,Dl(d)),z(r,t),r}));c(null,l,Ve,"Store",Ce,Xl+"ized"+Ce),c(0,G,"ComponentReturnType"),c(1,G,"useCellIds"),c(null,G,"ExtraProps"),c(0,D,j);const X=V(J,j+" | "+Ve,`Used when you need to refer to a ${j} in a React hook or component`),Y=V(Ne+Ee,jl(M+ke+j,M+`ById?: {[${M}Id: Id]: ${j}}`),`Used with the ${Ne} component, so that a `+j+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,L,X,Y);const le=W+ke+X;A("{createContext, useContext, useMemo}","React"),A("Context",`createContext<[${j}?, {[${M}Id: Id]: ${j}}?]>([])`),Z("Create"+j,`create: () => ${j}, create`+fe,j,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${j} within a React application with convenient memoization`);const te=Z(j,"id?: Id",j+Se,["{",et,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${j} from within a ${Ne} component context`),ae=x("useHook",W+`: ${X} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${te}(${W} as Id);`,`return hook(...preParams, ((${W} == null || typeof ${W} == 'string')`,`? ${M} : ${W})?.getStore(), ...postParams)`]),ne=x("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),se=x("wrap",Ll("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),Ie=x("useCustomOrDefaultCellIds",Ll("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${W}?: ${X} | undefined`),[`const defaultCellIds = ${ae}(${W}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),$e=A("NullComponent","() => null");if(!ee(e)){const[e,a,n,r,$,T,y,v,A,k,S,P,N,G,J,z,W,B,U,_]=s;c(null,D,e,a,n,$,T,y,v,A,k,S,P,N,G,J,z,W,U,B),c(0,D,r),c(1,D,j),c(null,l,i,"IdOrNull");const Z=x("tableView",`{${M}, rowComponent, getRowComponentProps, customCellIds`+st+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${se}(rowIds.map((rowId) => (`,"<Row","{..."+ne+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",ot,"customCellIds={customCellIds}",F,ql,"/>","))",st,", tableId,",");"]),K=x("getDefaultTableComponent","tableId: Id",H(O(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+$e),X=x("getDefaultCellComponent","tableId: Id, cellId: Id",H(O(((e,l,t)=>`tableId == ${t} ? ${H(E(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+$e} : `)))+$e);Q(u+p,u+p,d,ol(1,0,0,1)+pe),Q(p,p,e,ol(1,0)+pe);const Y=Q(C,C,n+Je,rl(b,ze)+pe);Q(He+p+Ce,He+p+Ce,nt,ol(1,9)+lt,Ll(_l(p)+Yl+a,_l(p)+fe),Zl(p),at,Ll(It,`tables: ${a})`+qe,Kl),ct),Q(ge+p+Ce,ge+p+Ce,Ce,ol(1,12),t,t,t,$t,ct);const ee=V(w+Ee,jl("tableId?: TId","rowId: Id","cellId?: CId",M+ke+j,Ql),$l(ie+w),`<TId extends ${n}, CId extends ${r}<TId>>`),le=V(h+Ee,jl("tableId?: TId","rowId: Id",M+ke+j,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${ee}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,rt,Ql),$l(ie+h),`<TId extends ${n}>`),te=V(b+Ee,jl("tableId?: TId",M+ke+j,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",rt,Ql),$l(ie+b),`<TId extends ${n}>`),ae=V("Sorted"+b+Ee,jl("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",M+ke+j,`rowComponent?: ComponentType<${le}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",rt,Ql),$l(ie+"sorted "+b),`<TId extends ${n}>`),de=V(p+Ee,jl(M+ke+j,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${te}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,rt,Ql),$l(dl(1,1)));c(1,L,de,te,ae,le,ee),q(p+it,"{"+M+", tableComponents, getTableComponentProps"+st+"}: "+de,[se+`(${Y}(${M}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+K+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${ne}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",F,ql,"/>;","}), separator)"],ol(1,13)+pe),O(((e,l,a)=>{const[n,s,r,I,$]=oe(_,e);c(null,D,n,s,r,I,$),Q(u+l+b,u+b,d,Cl(e,0,1)+pe,t,a),Q(l+b,b,n,Cl(e)+pe,t,a),Q(l+b+f,b+f,i,rl(w,"the whole of "+bl(e))+pe,t,a),Q(l+h+me,h+me,o,"Gets the number of Rows in "+bl(e)+pe,t,a);const p=Q(l+m,m,i,rl(h,bl(e))+pe,t,a),C=Q(l+g,g,i,rl(h,bl(e),1)+pe,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");Q(u+l+h,u+h,d,hl(e,0,1)+pe,ut,Ll(a,dt)),Q(l+h,h,r,hl(e)+pe,ut,Ll(a,dt)),Q(l+f,f,$+Je,rl(w,pl(e))+pe,ut,Ll(a,dt)),Q(He+l+b+Ce,He+b+Ce,nt,Cl(e,9)+lt,Ll(_l(b)+Yl+s,_l(b)+fe),Ll(a,Zl(b)),at,Ll(It,`table: ${s})`+qe,Kl),ct),Q(ge+l+b+Ce,ge+b+Ce,Ce,Cl(e,12),t,a,t,$t,ct),Q(He+l+h+Ce,He+h+Ce,nt,hl(e,9)+lt,Ll(ut,_l(h)+Yl+I,_l(h)+fe),Ll(a,dt,Zl(h)),at,Ll(It,`row: ${I})`+qe,Kl),ct),Q("Add"+l+h+Ce,"Add"+h+Ce,nt,hl(e,10)+lt,Ll(_l(h)+Yl+I,_l(h)+fe),Ll(a,Zl(h)),at,"then?: ("+Ll(ut+Se,"store: Store","row: "+I+")"+qe,"then"+fe)+", reuseRowIds?: boolean",ct+", reuseRowIds"),Q(He+l+Oe+h+Ce,He+Oe+h+Ce,nt,hl(e,11)+lt,Ll(ut,_l(Oe+h)+Yl+I,_l(Oe+h)+fe),Ll(a,dt,Zl(Oe+h)),at,Ll(It,`partialRow: ${I})`+qe,Kl),ct),Q(ge+l+h+Ce,ge+h+Ce,Ce,hl(e,12),ut,Ll(a,dt),t,$t,ct);const T=q(l+h+it,"{rowId, "+M+", cellComponents, getCellComponentProps, customCellIds"+st+`}: ${le}<'${e}'>`,[se+`(${Ie}(customCellIds, `+a+`, rowId, ${M}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+X+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${ne}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,ot,"cellId={cellId}",F,ql,"/>;","})"+st+", rowId)"],hl(e,13)+pe);q(l+"Sorted"+b+it,"{cellId, descending, offset, limit, ...props}: "+ae+`<'${e}'>`,Z+"(props, "+C+`(cellId, descending, offset, limit, props.${M}), ${a}, ${T});`,Cl(e,13)+", sorted"+pe),q(l+b+it,`props: ${te}<'${e}'>`,Z+"(props, "+p+`(props.${M}), ${a}, ${T});`,Cl(e,13)+pe),E(e,((n,o,s,r,I)=>{const $="Map"+El(o,1);c(0,D,$),c(1,D,$),Q(u+l+I+b+w,u+b+w,d,`Gets ${nl(1)}the '${n}' Cell anywhere in `+bl(e)+pe,t,Ll(a,r)),Q(u+l+I+w,u+w,d,ml(e,n,0,1)+pe,ut,Ll(a,dt,r));const i=Q(l+I+w,w,o+(R(s)?Se:t),ml(e,n)+pe,ut,Ll(a,dt,r));Q(He+l+I+w+Ce,He+w+Ce,nt,ml(e,n,9)+lt,Ll(ut,_l(w)+Yl+o+" | "+$,_l(w)+fe),Ll(a,dt,r,Zl(w)),at,Ll(It,`cell: ${o} | ${$})`+qe,Kl),ct),Q(ge+l+I+w+Ce,ge+w+Ce,Ce,ml(e,n,12),Ll(ut,"forceDel?: boolean"),Ll(a,dt,r,"forceDel"),t,$t,ct),q(l+I+w+it,`{rowId, ${M}, debugIds}: `+ee+`<'${e}', '${n}'>`,[se+`('' + ${i}(rowId, `+M+`) ?? '', undefined, debugIds, ${r})`],ml(e,n,13)+pe)}))}));const re=H(O((e=>oe(_,e)?.[4]??t))," | ");Q(u+p+I,u+p+I,Qe,ol(1,8,0,1)+" changes",bt($),pt()),Q(p+I,p+I,Qe,ol(1,8)+" changes",bt(T),pt()),Q(C+I,C+I,Qe,il(2,0,1),bt(y),pt()),Q(u+b+I,u+b+I,Qe,il(3,0,0,1),bt(v,`tableId: ${n} | null`),pt("tableId")),Q(b+I,b+I,Qe,il(3,0),bt(A,`tableId: ${n} | null`),pt("tableId")),Q(b+f+I,b+f+I,Qe,il(14,3,1),bt(k,`tableId: ${n} | null`),pt("tableId")),Q(u+b+w+I,u+b+w+I,Qe,il(16,3,0,1),bt(S,`tableId: ${n} | null`,`cellId: ${re} | null`),pt("tableId","cellId")),Q(h+me+I,h+me+I,Qe,il(15,3),bt(P,`tableId: ${n} | null`),pt("tableId")),Q(m+I,m+I,Qe,il(4,3,1),bt(N,`tableId: ${n} | null`),pt("tableId")),Q(g+I,g+I,Qe,il(13,3,1),bt(G,`tableId: ${n} | null`,"cellId: "+re+Se,"descending: boolean","offset: number","limit: number"+Se),pt("tableId","cellId","descending","offset","limit")),Q(u+h+I,u+h+I,Qe,il(5,3,0,1),bt(J,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(h+I,h+I,Qe,il(5,3),bt(z,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(f+I,f+I,Qe,il(6,5,1),bt(W,`tableId: ${n} | null`,dt+": IdOrNull"),pt("tableId",dt)),Q(u+w+I,u+w+I,Qe,il(7,5,0,1),bt(B,`tableId: ${n} | null`,dt+": IdOrNull",`cellId: ${re} | null`),pt("tableId",dt,"cellId")),Q(w+I,w+I,Qe,il(7,5),bt(U,`tableId: ${n} | null`,dt+": IdOrNull",`cellId: ${re} | null`),pt("tableId",dt,"cellId"))}if(!ee(a)){const[e,l,a,n,o,s,$,i]=r;c(null,D,...r),c(1,D,j);const b=x("getDefaultValueComponent","valueId: Id",H(N(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+$e);Q(u+y,u+y,d,ol(2,0,0,1)+pe),Q(y,y,e,ol(2,0)+pe);const p=Q(v,v,a+Je,rl(T,ze)+pe);Q(He+y+Ce,He+y+Ce,nt,ol(2,9)+lt,Ll(_l(y)+Yl+l,_l(y)+fe),Zl(y),at,Ll(It,`values: ${l})`+qe,Kl),ct),Q(He+Oe+y+Ce,He+Oe+y+Ce,nt,ol(2,11)+lt,Ll(_l(Oe+y)+Yl+l,_l(Oe+y)+fe),Zl(Oe+y),at,Ll(It,`partialValues: ${l})`+qe,Kl),ct),Q(ge+y+Ce,ge+y+Ce,Ce,ol(2,12),t,t,t,$t,ct);const C=V(T+Ee,jl("valueId?: VId",M+ke+j,Ql),$l("a Value"),`<VId extends ${a}>`),h=V(y+Ee,jl(M+ke+j,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${C}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,rt,Ql),$l(dl(2,1)));c(1,L,h,C),q(y+it,"{"+M+", valueComponents, getValueComponentProps"+st+"}: "+h,[se+`(${p}(${M}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+b+"(valueId);","return <Value",`{...${ne}(getValueComponentProps, valueId)}`,"key={valueId}",F,ql,"/>;","}), separator)"],ol(2,13)+pe),N(((e,l,a,n,o)=>{const s="Map"+El(l,1);c(0,D,s),c(1,D,s),Q(u+o+T,u+T,d,gl(e,0,1)+pe,t,n);const r=Q(o+T,T,l,gl(e)+pe,t,n);Q(He+o+T+Ce,He+T+Ce,nt,gl(e,9)+lt,Ll(_l(T)+Yl+l+" | "+s,_l(T)+fe),Ll(n,Zl(T)),at,Ll(It,`value: ${l} | ${s})`+qe,Kl),ct),Q(ge+o+T+Ce,ge+T+Ce,Ce,gl(e,12),t,n,t,$t,ct),q(o+T+it,`{${M}, debugIds}: ${C}<'${e}'>`,[se+`('' + ${r}(`+M+`) ?? '', undefined, debugIds, ${n})`],gl(e,13)+pe)})),Q(u+y+I,u+y+I,Qe,ol(2,8,0,1)+" changes",bt(n),pt()),Q(y+I,y+I,Qe,ol(2,8)+" changes",bt(o),pt()),Q(v+I,v+I,Qe,il(10,0,1),bt(s),pt()),Q(u+T+I,u+T+I,Qe,il(11,0,0,1),bt($,`valueId: ${a} | null`),pt("valueId")),Q(T+I,T+I,Qe,il(11,0),bt(i,`valueId: ${a} | null`),pt("valueId"))}return q(Ne,`{${M}, ${M}ById, children}: `+Y+" & {readonly children: React.ReactNode}",["{",et,"return (","<Context."+Ne,"value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}",`</Context.${Ne}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[$(...k(0),...S(),...K(0)),$(...k(1),...P(),...K(1))]},ht=(e,l,a)=>{if(ee(e)&&ee(l))return[t,t,t,t];const[n,d,o,s]=Ul(e,l,a);return[n,d,...Ct(e,l,a,o,s)]},mt=JSON.parse,gt="prettier/",wt=gt+"plugins/",ft={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},Tt=Ml((e=>{const l=()=>{const l=mt(e.getTablesSchemaJson());return!ee(l)||L(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=de();if(L(a,(l=>L(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=$e(n,a,(()=>[D(d),de(),[0],0])),[s,r,[I]]=o,$=$e(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),Ie(r,d,$),o[3]++,s==D(d)})))))return l[t]={},ae(n,(([e,,[,n],d],o)=>{l[t][o]={[s]:e,...d==E(a)?{[r]:n}:{}}})),1}))?l:{}},t=()=>{const l=mt(e.getValuesSchemaJson());return ee(l)&&e.forEachValue(((e,t)=>{l[e]={[s]:D(t)}})),l},a=e=>ht(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(gt+"standalone")).format,z(t,await import(wt+"estree"),await import(wt+"typescript"))}catch{n=async e=>e}return await N(M(a(e),(async(e,a)=>Pl(await n(e,{...ft,plugins:t,filepath:"_."+l[a]})))))};return K({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:E(e.getValueIds()),jsonLength:E(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{Tt as createTools};
1
+ const e=e=>typeof e,l="tinybase",t="",a=",",n=e(t),d=e(!0),o=e(0),s="type",r="default",I="Listener",$="get",c="add",u="Has",i="Ids",b="Table",p=b+"s",C=b+i,h="Row",m=h+i,g="Sorted"+h+i,w="Cell",f=w+i,T="Value",y=T+"s",v=T+i,V="Transaction",x="Partial",R=(e,l=t,a)=>e.split(l,a),A=Promise,k=isFinite,S=e=>null==e,P=(e,l,t)=>S(e)?t?.():l(e),O=e=>e==n||e==d,E=l=>e(l)==n,N=e=>Array.isArray(e),D=(e,l,t)=>e.slice(l,t),L=e=>e.length,G=async e=>A.all(e),j=l=>{const t=e(l);return O(t)||t==o&&k(l)?t:void 0},H=(e,l)=>e.every(l),M=(e,l)=>e.sort(l),J=(e,l)=>e.forEach(l),z=(e,l=t)=>e.join(l),W=(e,l)=>e.map(l),B=(e,l)=>e.filter(l),F=(e,...l)=>e.push(...l),U=e=>e.pop(),_=(e,...l)=>e.unshift(...l),Z=e=>e.shift(),Q=Object,q=e=>Q.getPrototypeOf(e),K=Q.entries,X=e=>!S(e)&&P(q(e),(e=>e==Q.prototype||S(q(e))),(()=>!0)),Y=Q.keys,ee=Q.freeze,le=(e,l)=>W(K(e),(([e,t])=>l(t,e))),te=e=>L(Y(e)),ae=e=>X(e)&&0==te(e),ne=(e,l)=>e?.has(l)??!1,de=e=>[...e?.values()??[]],oe=(e,l)=>e?.forEach(l),se=(e,l)=>e?.delete(l),re=e=>new Map(e),Ie=(e,l)=>e?.get(l),$e=(e,l)=>oe(e,((e,t)=>l(t,e))),ce=(e,l)=>W([...e?.entries()??[]],(([e,t])=>l(t,e))),ue=(e,l,t)=>S(t)?(se(e,l),e):e?.set(l,t),ie=(e,l,t,a)=>(ne(e,l)||ue(e,l,t()),Ie(e,l)),be=e=>e.toUpperCase(),pe=e=>e.toLowerCase(),Ce="a ",he="A function for",me=", and registers a listener so that any changes to that result will cause a re-render",ge="Callback",we="Changes",fe="Count",Te="Del",ye="Deps",ve=ye+"?: React.DependencyList",Ve="doRollback?: DoRollback",xe="actions: () => Return, "+Ve,Re="export",Ae="Id",ke="Invalid",Se="Json",Pe=pe(I),Oe="?: ",Ee=" | undefined",Ne="NonNullable",De="Props",Le="Provider",Ge=`Registers a ${Pe} that will be called`,je="Represents",He="rowId: "+Ae,Me="Schema",Je="Set",ze=", descending?: boolean, offset?: number, limit?: number",We="[]",Be="the Store",Fe=pe(V),Ue="Execute a "+Fe+" to make multiple mutations",_e="Explicitly starts a "+Fe,Ze="Explicitly finishes a "+Fe,Qe="the end of the "+Fe,qe="void",Ke=" => "+qe,Xe="WhenSet",Ye=" when setting it",el=Ce+"string serialization of",ll=" ",tl="Gets a callback that can ",al="the ",nl=" the schema for",dl=(e=0)=>e?"the existence of ":"",ol=(e=0,l=0,a=0)=>dl(a)+`the ${vl[e]}content of`+(l?ll+Be:t),sl=(e=0,l,a=0,n=0)=>fl[l]+ll+dl(n)+ol(e,1)+(a?" when setting it":t),rl=(e,l=0)=>je+` a Row when ${l?"s":"g"}etting ${ol()} the '${e}' `+b,Il=(e,l,t=0)=>`Gets ${t?"sorted, paginated":"the"} Ids of the ${e}s in `+l,$l=(e,l)=>`Calls a function for each ${e} in `+l,cl=e=>"The props passed to a component that renders "+e,ul=e=>"A function that takes "+e,il=(e,l=0,t=0)=>he+" listening to changes to "+dl(t)+yl[e]+" in "+yl[l],bl=(e,l,a=0,n=0)=>Ge+" whenever "+dl(n)+yl[e]+" in "+yl[l]+" change"+(a?t:"s"),pl=e=>`the '${e}' `+b,Cl=e=>"the specified Row in "+pl(e),hl=(e,l=0,t=0)=>fl[l]+ll+ol(0,0,t)+ll+pl(e),ml=(e,l=0,t=0)=>fl[l]+` ${ol(0,0,t)} `+Cl(e),gl=(e,l,t=0,a=0)=>fl[t]+ll+dl(a)+`the '${l}' Cell for `+Cl(e),wl=(e,l=0,t=0)=>fl[l]+ll+dl(t)+`the '${e}' Value`,fl=["Gets","Checks existence of","Sets","Deletes","Sets part of",je,"Gets "+el,"Sets "+el,Ge+" whenever",tl+"set",tl+"add",tl+"set part of",tl+"delete","Renders","Gets "+el+nl,"Sets"+nl,"Deletes"+nl],Tl=[$,"has","set","del","set","forEach",c,t],yl=[Be,p,al+b+ll+i,Ce+b,al+h+ll+i,Ce+h,al+w+ll+i,Ce+w,"invalid Cell changes",y,al+T+ll+i,Ce+T,"invalid Value changes",al+"sorted "+h+ll+i,al+w+ll+i+" anywhere",al+"number of Rows",Ce+w+" anywhere"],vl=[t,"tabular ","keyed value "],Vl=e=>new Set(N(e)||S(e)?e:[e]),xl=(e,l)=>e?.add(l),Rl=/[^A-Za-z]+/,Al=/[^A-Za-z0-9]+/,kl=/^( *)\/\*\* *(.*?) *\*\/$/gm,Sl=e=>e.includes(a),Pl=(e,l,t,a=1)=>{const n=`${l}${1==a?"":a}`;return ne(e,n)?Pl(e,l,t,a+1):(ue(e,n,t),n)},Ol=e=>e.replace(kl,((e,l,t)=>{const a=77-L(l);return`${l}/**\n${t.replace(RegExp(`([^\\n]{1,${a}})(\\s|$)`,"g"),l+" * $1\n")}${l} */`})),El=e=>e.flat(1e3),Nl=(e,l=0)=>z(W(R(e,Al),((e,t)=>(t>0||l?be:pe)(D(e,0,1))+D(e,1)))),Dl=e=>be(z(R(e&&!Rl.test(e[0])?e:" "+e,Al),"_")),Ll=e=>`/** ${e}. */`,Gl=(...e)=>z(B(e,(e=>e)),", "),jl=(...e)=>"{"+z(e,"; ")+"}",Hl=(...e)=>jl(...W(e,(e=>"readonly "+e))),Ml=()=>{const e=[re(),re(),re(),re()],l=re(),a=re(),n=e=>{const l=e.indexOf(" as ");return-1!=l?D(e,l+4):e};return[(...e)=>z(El(e),"\n"),(l,t,...a)=>J(a,(a=>J([0,1],(n=>(l??n)==n?xl(ie(e[n],t,Vl),a):0)))),(e,a,n,d=t,o=1)=>Pl(l,e,[a,n,d,o]),(e,l,t)=>Pl(a,e,N(t)?[`(${l}) => {`,t,"}"]:[`(${l}) => ${t}`]),(e,l)=>Ie(a,e)===l?e:Pl(a,e,l),(l=0)=>W([...M(ce(e[l],((e,l)=>`import {${z(M(de(e),((e,l)=>n(e)>n(l)?1:-1)),", ")}} from '${l}';`)),((e,l)=>Sl(e)!=Sl(l)?Sl(e)?-1:1:e>l?1:-1)),t],(e=>e.replace("{React}","React"))),()=>ce(l,(([e,l,a,n],d)=>[Ll(l),`${n?Re+" ":t}type ${d}${a} = ${e};`,t])),()=>ce(a,((e,l)=>(e=N(e)?e:[e],F(e,U(e)+";"),[`const ${l} = ${Z(e)}`,e,t])))]},Jl=(e,l)=>{const t=new WeakMap;return l=>(t.has(l)||t.set(l,e(l)),t.get(l))},zl=(e,l,t)=>[l=>le(e,((e,a)=>l(a,Nl(a,1),t(Dl(a),`'${a}'`)))),(l,a)=>le(e[l],((e,l)=>a(l,e[s],e[r],t(Dl(l),`'${l}'`),Nl(l,1)))),e=>le(l,((l,a)=>e(a,l[s],l[r],t(Dl(a),`'${a}'`),Nl(a,1))))],Wl=(e,l,a,n)=>[(n,d)=>{const o=n+": "+d,s=e(p,jl(...l((e=>`'${e}'?: {[rowId: Id]: `+jl(...a(e,((e,l,a)=>`'${e}'${S(a)?"?":t}: ${l}`)))+"}"))),sl(1,5)),r=e(p+Xe,jl(...l((e=>`'${e}'?: {[rowId: Id]: `+jl(...a(e,((e,l)=>`'${e}'?: ${l}`)))+"}"))),sl(1,5,1)),$=e(b+Ae,"keyof "+s,"A "+b+" Id in "+Be),c=`<TId extends ${$}>`,i=e(b,Ne+`<${s}[TId]>`,"A "+b+" in "+Be,c),T=e(b+Xe,Ne+`<${r}[TId]>`,"A "+b+" in "+Be+Ye,c),y=e(h,i+"<TId>[Id]","A "+h+" in a "+b,c),v=e(h+Xe,T+"<TId>[Id]","A "+h+" in a "+b+Ye,c),V=e(w+Ae,`Extract<keyof ${y}<TId>, Id>`,"A "+w+" Id in a "+h,c),x=e(w,Ne+`<${s}[TId]>[Id][CId]`,"A "+w+" in a "+h,`<TId extends ${$}, CId extends ${V}<TId>>`),R=e("CellIdCellArray",`CId extends ${V}<TId> ? [cellId: CId, cell: ${x}<TId, CId>] : never`,w+" Ids and types in a "+h,`<TId extends ${$}, CId = ${V}<TId>>`,0),A=e(w+ge,`(...[cellId, cell]: ${R}<TId>)`+Ke,ul(Ce+w+" Id, and "+w),c),k=e(h+ge,"(rowId: Id, forEachCell: (cellCallback: CellCallback<TId>) "+Ke+") "+Ke,ul(Ce+h+" Id, and a "+w+" iterator"),c),P=e(b+w+ge,`(cellId: ${V}<TId>, count: number) `+Ke,ul(Ce+w+" Id, and count of how many times it appears"),c),O=e("TableIdForEachRowArray",`TId extends ${$} ? [tableId: TId, forEachRow: (rowCallback: ${k}<TId>)${Ke}] : never`,b+" Ids and callback types",`<TId = ${$}>`,0),E=e(b+ge,`(...[tableId, forEachRow]: ${O})`+Ke,ul(Ce+b+" Id, and a "+h+" iterator"),t),N=e("TableIdRowIdCellIdArray",`TId extends ${$} ? [tableId: TId, rowId: Id, cellId: ${V}<TId>] : never`,"Ids for GetCellChange",`<TId = ${$}>`,0),D=e("GetCellChange",`(...[tableId, rowId, cellId]: ${N}) => CellChange`,he+" returning information about any Cell's changes during a "+Fe),L=e(u+p+I,`(${o}, hasTables: boolean)`+Ke,il(1,0,1)),G=e(p+I,`(${o}, getCellChange: ${D}${Ee})`+Ke,il(1)),j=e(C+I,`(${o})`+Ke,il(2)),H=e(u+b+I,`(${o}, tableId: ${$}, hasTable: boolean)`+Ke,il(3,0,1)),M=e(b+I,`(${o}, tableId: ${$}, getCellChange: ${D}${Ee})`+Ke,il(3)),J=e(b+f+I,`(${o}, tableId: ${$})`+Ke,il(14,3)),z=e("HasTableCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, cellId: CId, hasTableCell: boolean] : never`,"Cell args for HasTableCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),W=e("HasTableCellListenerArgsArrayOuter",`TId extends ${$} ? `+z+"<TId> : never","Table args for HasTableCellListener",`<TId = ${$}>`,0),B=e(u+b+w+I,`(...[${n}, tableId, cellId, hasTableCell]: `+W+")"+Ke,il(16,3,1)),F=e(h+"Count"+I,`(${o}, tableId: ${$})`+Ke,il(15,3)),U=e(m+I,`(${o}, tableId: ${$})`+Ke,il(4,3)),_=e(g+I,"("+Gl(o,"tableId: "+$,"cellId: Id"+Ee,"descending: boolean","offset: number","limit: number"+Ee,"sortedRowIds: Ids")+")"+Ke,il(13,3)),Z=e(u+h+I,"("+Gl(""+o,"tableId: "+$,He,"hasRow: boolean")+")"+Ke,il(5,3,1)),Q=e(h+I,"("+Gl(""+o,"tableId: "+$,He,`getCellChange: ${D}${Ee}`)+")"+Ke,il(5,3)),q=e(f+I,"("+Gl(""+o,"tableId: "+$,He)+")"+Ke,il(6,5)),K=e("HasCellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${He}, cellId: CId, hasCell: boolean] : never`,"Cell args for HasCellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),X=e("HasCellListenerArgsArrayOuter",`TId extends ${$} ? `+K+"<TId> : never","Table args for HasCellListener",`<TId = ${$}>`,0),Y=e(u+w+I,`(...[${n}, tableId, rowId, cellId, hasCell]: `+X+")"+Ke,il(7,5,1)),ee=e("CellListenerArgsArrayInner",`CId extends ${V}<TId> ? [${o}, tableId: TId, ${He}, cellId: CId, newCell: ${x}<TId, CId> ${Ee}, oldCell: ${x}<TId, CId> ${Ee}, getCellChange: ${D} ${Ee}] : never`,"Cell args for CellListener",`<TId extends ${$}, CId = ${V}<TId>>`,0),le=e("CellListenerArgsArrayOuter",`TId extends ${$} ? `+ee+"<TId> : never","Table args for CellListener",`<TId = ${$}>`,0);return[s,r,$,i,T,y,v,V,x,A,k,P,E,L,G,j,H,M,J,B,F,U,_,Z,Q,q,Y,e(w+I,`(...[${n}, tableId, rowId, cellId, newCell, oldCell, getCellChange]: ${le})`+Ke,il(7,5)),e(ke+w+I,`(${o}, tableId: Id, ${He}, cellId: Id, invalidCells: any[])`+Ke,il(8))]},(l,a)=>{const d=l+": "+a,o=e(y,jl(...n(((e,l,a)=>`'${e}'${S(a)?"?":t}: ${l}`))),sl(2,5)),s=e(y+Xe,jl(...n(((e,l)=>`'${e}'?: ${l}`))),sl(2,5,1)),r=e(T+Ae,"keyof "+o,"A "+T+" Id in "+Be),$=e(T,Ne+`<${o}[VId]>`,"A "+T+" Id in "+Be,`<VId extends ${r}>`),c=e("ValueIdValueArray",`VId extends ${r} ? [valueId: VId, value: ${$}<VId>] : never`,T+" Ids and types in "+Be,`<VId = ${r}>`,0),i=e(T+ge,`(...[valueId, value]: ${c})`+Ke,ul(Ce+T+" Id, and "+T)),b=e("GetValueChange",`(valueId: ${r}) => ValueChange`,he+" returning information about any Value's changes during a "+Fe),p=e(u+y+I,`(${d}, hasValues: boolean)`+Ke,il(9,0,1)),C=e(y+I,`(${d}, getValueChange: ${b}${Ee})`+Ke,il(9)),h=e(v+I,`(${d})`+Ke,il(10)),m=e(u+T+I,`(${d}, valueId: ValueId, hasValue: boolean)`+Ke,il(11,0,1)),g=e("ValueListenerArgsArray",`VId extends ${r} ? [${d}, valueId: VId, newValue: ${$}<VId> ${Ee}, oldValue: ${$}<VId> ${Ee}, getValueChange: ${b} ${Ee}] : never`,"Value args for ValueListener",`<VId = ${r}>`,0);return[o,s,r,$,i,p,C,h,m,e(T+I,`(...[${l}, valueId, newValue, oldValue, getValueChange]: `+g+")"+Ke,il(11)),e(ke+T+I,`(${d}, valueId: Id, invalidValues: any[])`+Ke,il(12))]},(l,t)=>e(V+I,`(${l}: ${t})`+Ke,he+" listening to the completion of a "+Fe)],Bl=(e,l=t,a=t)=>`store.${e}(${l})`+(a?" as "+a:t),Fl=(e,l=t)=>`fluent(() => ${Bl(e,l)})`,Ul=(e,l=t,a=t)=>`store.${e}(${l?l+", ":t}proxy(listener)${a?", "+a:t})`,_l=(e,a,n)=>{const[o,$,R,A,k,P,O,N]=Ml(),[D,L,G]=zl(e,a,k),[j,H,M]=Wl(R,D,L,G),W=re(),B=(e=0)=>ce(W,(([l,a,n,d,o],s)=>{const r=e?[s+`: ${o}(${l}): ${a} => ${n},`]:[s+o+`(${l}): ${a};`];return e||_(r,Ll(d)),F(r,t),r})),U=(e,l,a,n,d,o=t)=>Pl(W,e,[l,a,n,d,o]),Z=(e,l,a,n,d,o=t,s=t,r=t)=>U(Tl[e]+l+(4==e?x:t)+a,o,n,(n==K?Fl:Bl)(Tl[e]+(4==e?x:t)+a,s,e?void 0:n),d,r),Q=(e,l,a,n=t,d=t,o=1,s=t)=>U(c+e+I,(n?n+", ":t)+Pe+": "+l+(o?", mutator?: boolean":t),Ae,Ul(c+e+I,d,o?"mutator":t),a,s),q=`./${Nl(n)}.d`,K=Nl(n,1),X=Nl(K),Y=[],ee=re();let le=[],te=[];if($(1,q,K,`create${K} as create${K}Decl`),ae(e))$(null,l,p);else{$(0,l,"CellChange"),$(null,l,i);const[e,a,n,o,I,c,T,y,v,V,x,A,P,O,N,G,H,M,W,B,U,_,te,ae,ne,oe,se,$e,ce]=j(X,K),ie=re();D(((e,l)=>{const t=`<'${e}'>`,a=[R(l+b,o+t,je+` the '${e}' `+b),R(l+b+Xe,I+t,je+` the '${e}' `+b+Ye),R(l+h,c+t,rl(e)),R(l+h+Xe,T+t,rl(e,1)),R(l+w+Ae,y+t,`A Cell Id for the '${e}' `+b),R(l+w+ge,V+t,ul(`a Cell Id and value from a Row in the '${e}' `+b)),R(l+h+ge,x+t,ul(`a Row Id from the '${e}' Table, and a Cell iterator`)),R(l+b+w+ge,A+t,ul(`a Cell Id from anywhere in the '${e}' Table, and a count of how many times it appears`))];ue(ie,e,a),$(1,q,...a)})),$(1,q,e,a,n,y,P,O,N,G,H,M,W,B,U,_,te,ae,ne,oe,se,$e,ce),le=[e,a,n,y,O,N,G,H,M,W,B,U,_,te,ae,ne,oe,se,$e,ie],J([[e],[d],[K,"tables: "+a,"tables"],[K]],(([e,l,a],n)=>Z(n,t,p,e,sl(1,n),l,a))),Z(0,t,C,n+We,Il(b,Be)),Z(5,t,b,qe,$l(b,Be),"tableCallback: "+P,"tableCallback as any"),D(((e,l,a)=>{const[n,o,s,r,I,$,c,u]=Ie(ie,e);J([[n],[d],[K,"table: "+o,", table"],[K]],(([n,d,o=t],s)=>Z(s,l,b,n,hl(e,s),d,a+o))),Z(0,l,b+f,i,Il(w,"the whole of "+pl(e)),t,a),Z(5,l,b+w,qe,$l(b+w,"the whole of "+pl(e)),"tableCellCallback: "+u,a+", tableCellCallback as any"),Z(0,l,h+fe,"number","Gets the number of Rows in the "+pl(e),t,a),Z(0,l,m,i,Il(h,pl(e)),t,a),Z(0,l,g,i,Il(h,pl(e),1),"cellId?: "+I+ze,a+", cellId, descending, offset, limit"),Z(5,l,h,qe,$l(h,pl(e)),"rowCallback: "+c,a+", rowCallback as any"),J([[s],[d],[K,", row: "+r,", row"],[K],[K,", partialRow: "+r,", partialRow"]],(([n,d=t,o=t],s)=>Z(s,l,h,n,ml(e,s),He+d,a+", rowId"+o))),Z(6,l,h,Ae+Ee,"Add a new Row to "+pl(e),"row: "+r+", reuseIds?: boolean",a+", row, reuseIds"),Z(0,l,f,I+We,Il(w,Cl(e)),He,a+", rowId"),Z(5,l,w,qe,$l(w,Cl(e)),He+", cellCallback: "+$,a+", rowId, cellCallback as any"),L(e,((n,o,s,r,I)=>{const $="Map"+Nl(o,1);ue(ee,o,$);const c=o+(S(s)?Ee:t);J([[c],[d],[K,`, cell: ${o} | `+$,", cell as any"],[K]],(([d,o=t,s=t],$)=>Z($,l+I,w,d,gl(e,n,$),He+o,a+", rowId, "+r+s))),Z(1,l+I,b+w,d,fl[1]+` the '${n}' Cell anywhere in `+pl(e),t,a+", "+r)}))})),Z(0,t,p+Se,Se,sl(1,6)),Z(2,t,p+Se,K,sl(1,7),"tablesJson: "+Se,"tables"+Se),Q(u+p,O,sl(1,8,0,1)+" changes"),Q(p,N,sl(1,8)+" changes"),Q(C,G,bl(2,0,1)),Q(u+b,H,bl(3,0,0,1),`tableId: ${n} | null`,"tableId"),Q(b,M,bl(3,0),`tableId: ${n} | null`,"tableId"),Q(b+f,W,bl(14,3,1),`tableId: ${n} | null`,"tableId"),Q(u+b+w,B,bl(16,3,0,1),`tableId: ${n} | null, cellId: ${z(D((e=>Ie(ie,e)?.[4]??t))," | ")} | null`,"tableId, cellId"),Q(h+fe,U,bl(15,3),`tableId: ${n} | null`,"tableId"),Q(m,_,bl(4,3,1),`tableId: ${n} | null`,"tableId"),Q(g,te,bl(13,3,1),Gl("tableId: TId",`cellId: ${y}<TId>`+Ee,"descending: boolean","offset: number","limit: number"+Ee),Gl("tableId","cellId","descending","offset","limit"),1,"<TId extends TableId>"),Q(u+h,ae,bl(5,3,0,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(h,ne,bl(5,3),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(f,oe,bl(6,5,1),`tableId: ${n} | null, rowId: IdOrNull`,"tableId, rowId"),Q(u+w,se,bl(7,5,0,1),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${z(D((e=>Ie(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),Q(w,$e,bl(7,5),`tableId: ${n} | null, rowId: IdOrNull, cellId: ${z(D((e=>Ie(ie,e)?.[4]??t))," | ")} | null`,"tableId, rowId, cellId"),Q(ke+w,ce,Ge+" whenever an invalid Cell change was attempted","tableId: IdOrNull, rowId: IdOrNull, cellId: IdOrNull","tableId, rowId, cellId"),$(1,q,...de(ee)),F(Y,".set"+p+Me+"({",El(D(((e,l,a)=>[`[${a}]: {`,...L(e,((e,l,a,n)=>`[${n}]: {[${k(Dl(s),`'${s}'`)}]: ${k(Dl(l),`'${l}'`)}${S(a)?t:`, [${k(Dl(r),`'${r}'`)}]: `+(E(a)?k(Dl(a),`'${a}'`):a)}},`)),"},"]))),"})")}if(ae(a))$(null,l,y);else{const[e,a,n,o,I,c,i,b,p,C,h]=H(X,K);$(1,q,e,a,n,I,c,i,b,p,C,h),te=[e,a,n,c,i,b,p,C],J([[e],[d],[K,"values: "+a,"values"],[K],[K,"partialValues: "+a,"partialValues"]],(([e,l,a],n)=>Z(n,t,y,e,sl(2,n),l,a))),Z(0,t,v,n+We,Il(T,Be)),Z(5,t,T,"void",$l(T,Be),"valueCallback: "+I,"valueCallback as any"),G(((e,l,a,n,o)=>{const s="Map"+Nl(l,1);ue(ee,l,s),J([[l],[d],[K,`value: ${l} | `+s,", value as any"],[K]],(([l,a,d=t],s)=>Z(s,o,T,l,wl(e,s),a,n+d)))})),Z(0,t,y+Se,Se,sl(2,6)),Z(2,t,y+Se,K,sl(2,7),"valuesJson: "+Se,"values"+Se),Q(u+y,c,sl(2,8,0,1)+" changes"),Q(y,i,sl(2,8)+" changes"),Q(v,b,bl(10,0,1)),Q(u+T,p,bl(11,0,0,1),`valueId: ${n} | null`,"valueId"),Q(T,C,bl(11,0),`valueId: ${n} | null`,"valueId"),Q(ke+T,h,Ge+" whenever an invalid Value change was attempted","valueId: IdOrNull","valueId"),$(1,q,...de(ee)),$(0,l,"ValueChange"),F(Y,".set"+y+Me+"({",G(((e,l,a,n)=>[`[${n}]: {[${k(Dl(s),`'${s}'`)}]: ${k(Dl(l),`'${l}'`)}${S(a)?t:`, [${k(Dl(r),`'${r}'`)}]: `+(E(a)?k(Dl(a),`'${a}'`):a)}},`])),"})")}Z(0,t,"Content",`[${p}, ${y}]`,sl(0,0)),Z(2,t,"Content",K,sl(0,2),`[tables, values]: [${p}, ${y}]`,"[tables, values]"),Z(7,t,"applyChanges",K,`Applies a set of ${we} to the Store`,"changes: "+we,"changes"),$e(ee,((e,l)=>R(l,`(cell: ${e}${Ee}) => `+e,`Takes a ${e} Cell value and returns another`))),$(null,l,"DoRollback",Ae,"IdOrNull",Se,"Store",we),Z(0,t,Se,Se,sl(0,6)),Z(2,t,Se,K,sl(0,7),"tablesAndValuesJson: "+Se,"tablesAndValuesJson"),Z(7,t,Fe,"Return",Ue,xe,"actions, doRollback","<Return>"),Z(7,t,"start"+V,K,_e),Z(7,t,"finish"+V,K,Ze,Ve,"doRollback");const ne=M(X,K);return Q("Start"+V,ne,Ge+" just before the start of the "+Fe,t,t,0),Q("WillFinish"+V,ne,Ge+" just before "+Qe,t,t,0),Q("DidFinish"+V,ne,Ge+" just after "+Qe,t,t,0),Z(7,t,"call"+I,K,"Manually provoke a listener to be called","listenerId: Id","listenerId"),Z(3,t,I,K,"Remove a listener that was previously added to "+Be,"listenerId: Id","listenerId"),U("getStore",t,"Store","store",fl[0]+" the underlying Store object"),$(1,l,"createStore"),$(1,q,K,`create${K} as create${K}Decl`,ne),k("store",["createStore()",...Y]),A("fluent","actions: () => Store",["actions();",`return ${X};`]),A("proxy","listener: any",`(_: Store, ...params: any[]) => listener(${X}, ...params)`),k(X,["{",...B(1),"}"]),[o(...P(0),...O(),Re+" interface "+K+" {",...B(0),"}",t,Ll(`Creates a ${K} object`),Re+" function create"+K+"(): "+K+";"),o(...P(1),Re+" const create"+K+": typeof create"+K+"Decl = () => {",...N(),`return Object.freeze(${X});`,"};"),le,te]},Zl=e=>$+e,Ql=e=>Gl(Zl(e),Zl(e)+ye),ql="debugIds?: boolean",Kl="debugIds={debugIds}",Xl="then"+ve,Yl="Parameter",et=": (parameter: "+Yl+", store: Store) => ",lt="const contextValue = useContext(Context);",tt=", based on a parameter",at=": ",nt="<"+Yl+",>",dt=Yl+"ized"+ge+"<"+Yl+">",ot="rowId",st="rowId={rowId}",rt=", separator, debugIds",It="separator?: ReactElement | string",$t="then?: (store: Store",ct=Gl($t+")"+Ke,Xl),ut="then, then"+ye,it=ot+at+Ae,bt="View",pt=(e,...l)=>Gl(...l,Pe+": "+e,Pe+ve,"mutator?: boolean"),Ct=(...e)=>Gl(...e,Pe,Pe+ye,"mutator"),ht=(e,a,n,s,r)=>{const[$,c,V,R,A,k,P,O]=Ml(),[E,N,D]=zl(e,a,A),L=`./${Nl(n)}.d`,G=`./${Nl(n)}-ui-react.d`,j="tinybase/ui-react",H=Nl(n,1),M=Nl(H),J=H+"Or"+H+Ae,W=M+"Or"+H+Ae,B=M+`={${M}}`,U=re(),Z=(e,l,a,n,d,o=t)=>(c(1,G,e+" as "+e+"Decl"),Pl(U,e,[l,a,n,d,o])),Q=(e,l,a,n,d,o=t)=>Z("use"+e,l,a,n,d,o),q=(e,l,a,n,d=t,o=t,s=t,r=t,I=t)=>(c(1,j,`use${l} as use${l}Core`),Q(e,Gl(d,le,r),a,ne+`(${W}, use${l}Core, [`+(o||t)+(I?"], ["+I:t)+"]);",n,s)),K=(e,l,t,a)=>Z(e,l,1,t,a),X=(e=0)=>ce(U,(([l,a,n,d,o],s)=>{const r=e?[Re+` const ${s}: typeof ${s}Decl = ${o}(${l}): ${1==a?"any":a} =>`,n]:[Re+` function ${s}${o}(${l}): ${1==a?"ComponentReturnType":a};`];return e||_(r,Ll(d)),F(r,t),r}));c(null,l,Ae,"Store",ge,Yl+"ized"+ge),c(0,j,"ComponentReturnType"),c(1,j,"useCellIds"),c(null,j,"ExtraProps"),c(0,L,H);const Y=V(J,H+" | "+Ae,`Used when you need to refer to a ${H} in a React hook or component`),ee=V(Le+De,Hl(M+Oe+H,M+`ById?: {[${M}Id: Id]: ${H}}`),`Used with the ${Le} component, so that a `+H+" can be passed into the context of an application");c(0,"react","ReactElement","ComponentType"),c(1,"react","React"),c(1,G,Y,ee);const le=W+Oe+Y;A("{createContext, useContext, useMemo}","React"),A("Context",`createContext<[${H}?, {[${M}Id: Id]: ${H}}?]>([])`),Q("Create"+H,`create: () => ${H}, create`+ve,H,"\n// eslint-disable-next-line react-hooks/exhaustive-deps\nuseMemo(create, createDeps)",`Create a ${H} within a React application with convenient memoization`);const te=Q(H,"id?: Id",H+Ee,["{",lt,"return id == null ? contextValue[0] : contextValue[1]?.[id];","}"],`Get a reference to a ${H} from within a ${Le} component context`),ne=R("useHook",W+`: ${Y} | undefined, hook: (...params: any[]) => any, preParams: any[], postParams: any[] = []`,[`const ${M} = ${te}(${W} as Id);`,`return hook(...preParams, ((${W} == null || typeof ${W} == 'string')`,`? ${M} : ${W})?.getStore(), ...postParams)`]),de=R("getProps","getProps: ((id: any) => ExtraProps) | undefined, id: Id","(getProps == null) ? ({} as ExtraProps) : getProps(id)"),oe=R("wrap",Gl("children: any","separator?: any","encloseWithId?: boolean","id?: Id"),["const separated = separator==null || !Array.isArray(children)"," ? children"," : children.map((child, c) => (c > 0 ? [separator, child] : child));","return encloseWithId ? [id, ':{', separated, '}'] : separated;"]),se=R("useCustomOrDefaultCellIds",Gl("customCellIds: Ids | undefined","tableId: Id","rowId: Id",`${W}?: ${Y} | undefined`),[`const defaultCellIds = ${ne}(${W}, useCellIds, [tableId, rowId]);`,"return customCellIds ?? defaultCellIds;"]),$e=A("NullComponent","() => null");if(!ae(e)){const[e,a,n,r,$,T,y,v,A,k,P,O,D,j,J,W,F,U,_,Z]=s;c(null,L,e,a,n,$,T,y,v,A,k,P,O,D,j,J,W,F,_,U),c(0,L,r),c(1,L,H),c(null,l,i,"IdOrNull");const Q=R("tableView",`{${M}, rowComponent, getRowComponentProps, customCellIds`+rt+"}: any, rowIds: Ids, tableId: Id, defaultRowComponent: React.ComponentType<any>",["const Row = rowComponent ?? defaultRowComponent;",`return ${oe}(rowIds.map((rowId) => (`,"<Row","{..."+de+"(getRowComponentProps, rowId)}","key={rowId}","tableId={tableId}",st,"customCellIds={customCellIds}",B,Kl,"/>","))",rt,", tableId,",");"]),X=R("getDefaultTableComponent","tableId: Id",z(E(((e,l,t)=>`tableId == ${t} ? ${l}TableView : `)))+$e),Y=R("getDefaultCellComponent","tableId: Id, cellId: Id",z(E(((e,l,t)=>`tableId == ${t} ? ${z(N(e,((e,t,a,n,d)=>`cellId == ${n} ? `+l+d+"CellView : ")))+$e} : `)))+$e);q(u+p,u+p,d,sl(1,0,0,1)+me),q(p,p,e,sl(1,0)+me);const ee=q(C,C,n+We,Il(b,Be)+me);q(Je+p+ge,Je+p+ge,dt,sl(1,9)+tt,Gl(Zl(p)+et+a,Zl(p)+ve),Ql(p),nt,Gl($t,`tables: ${a})`+Ke,Xl),ut),q(Te+p+ge,Te+p+ge,ge,sl(1,12),t,t,t,ct,ut);const le=V(w+De,Hl("tableId?: TId","rowId: Id","cellId?: CId",M+Oe+H,ql),cl(Ce+w),`<TId extends ${n}, CId extends ${r}<TId>>`),te=V(h+De,Hl("tableId?: TId","rowId: Id",M+Oe+H,"cellComponents?: {readonly [CId in "+r+`<TId>]?: ComponentType<${le}<TId, CId>>;}`,`getCellComponentProps?: (cellId: ${r}<TId>) => ExtraProps`,`customCellIds?: ${r}<TId>[]`,It,ql),cl(Ce+h),`<TId extends ${n}>`),ae=V(b+De,Hl("tableId?: TId",M+Oe+H,`rowComponent?: ComponentType<${te}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",It,ql),cl(Ce+b),`<TId extends ${n}>`),ne=V("Sorted"+b+De,Hl("tableId?: TId","cellId?: "+r+"<TId>","descending?: boolean","offset?: number","limit?: number",M+Oe+H,`rowComponent?: ComponentType<${te}<TId>>`,"getRowComponentProps?: (rowId: Id) => ExtraProps","customCellIds?: CellId<TId>[]",It,ql),cl(Ce+"sorted "+b),`<TId extends ${n}>`),re=V(p+De,Hl(M+Oe+H,"tableComponents?: {readonly [TId in "+n+`]?: ComponentType<${ae}<TId>>;}`,`getTableComponentProps?: (tableId: ${n}) => ExtraProps`,It,ql),cl(ol(1,1)));c(1,G,re,ae,ne,te,le),K(p+bt,"{"+M+", tableComponents, getTableComponentProps"+rt+"}: "+re,[oe+`(${ee}(${M}).map((tableId) => {`,"const Table = (tableComponents?.[tableId] ?? "+X+"(tableId)) as React.ComponentType<TableProps<typeof tableId>>;","return <Table",`{...${de}(getTableComponentProps, tableId)}`,"tableId={tableId}","key={tableId}",B,Kl,"/>;","}), separator)"],sl(1,13)+me),E(((e,l,a)=>{const[n,s,r,I,$]=Ie(Z,e);c(null,L,n,s,r,I,$),q(u+l+b,u+b,d,hl(e,0,1)+me,t,a),q(l+b,b,n,hl(e)+me,t,a),q(l+b+f,b+f,i,Il(w,"the whole of "+pl(e))+me,t,a),q(l+h+fe,h+fe,o,"Gets the number of Rows in "+pl(e)+me,t,a);const p=q(l+m,m,i,Il(h,pl(e))+me,t,a),C=q(l+g,g,i,Il(h,pl(e),1)+me,"cellId?: "+$+", descending?: boolean, offset?: number, limit?: number",a+", cellId, descending, offset, limit");q(u+l+h,u+h,d,ml(e,0,1)+me,it,Gl(a,ot)),q(l+h,h,r,ml(e)+me,it,Gl(a,ot)),q(l+f,f,$+We,Il(w,Cl(e))+me,it,Gl(a,ot)),q(Je+l+b+ge,Je+b+ge,dt,hl(e,9)+tt,Gl(Zl(b)+et+s,Zl(b)+ve),Gl(a,Ql(b)),nt,Gl($t,`table: ${s})`+Ke,Xl),ut),q(Te+l+b+ge,Te+b+ge,ge,hl(e,12),t,a,t,ct,ut),q(Je+l+h+ge,Je+h+ge,dt,ml(e,9)+tt,Gl(it,Zl(h)+et+I,Zl(h)+ve),Gl(a,ot,Ql(h)),nt,Gl($t,`row: ${I})`+Ke,Xl),ut),q("Add"+l+h+ge,"Add"+h+ge,dt,ml(e,10)+tt,Gl(Zl(h)+et+I,Zl(h)+ve),Gl(a,Ql(h)),nt,"then?: ("+Gl(it+Ee,"store: Store","row: "+I+")"+Ke,"then"+ve)+", reuseRowIds?: boolean",ut+", reuseRowIds"),q(Je+l+x+h+ge,Je+x+h+ge,dt,ml(e,11)+tt,Gl(it,Zl(x+h)+et+I,Zl(x+h)+ve),Gl(a,ot,Ql(x+h)),nt,Gl($t,`partialRow: ${I})`+Ke,Xl),ut),q(Te+l+h+ge,Te+h+ge,ge,ml(e,12),it,Gl(a,ot),t,ct,ut);const T=K(l+h+bt,"{rowId, "+M+", cellComponents, getCellComponentProps, customCellIds"+rt+`}: ${te}<'${e}'>`,[oe+`(${se}(customCellIds, `+a+`, rowId, ${M}).map((cellId: ${$}) => {`,"const Cell = (cellComponents?.[cellId] ?? "+Y+`(${a}, cellId)) as React.ComponentType<CellProps<typeof `+a+", typeof cellId>>;","return <Cell",`{...${de}(getCellComponentProps, cellId)} `,"key={cellId}",`tableId={${a}}`,st,"cellId={cellId}",B,Kl,"/>;","})"+rt+", rowId)"],ml(e,13)+me);K(l+"Sorted"+b+bt,"{cellId, descending, offset, limit, ...props}: "+ne+`<'${e}'>`,Q+"(props, "+C+`(cellId, descending, offset, limit, props.${M}), ${a}, ${T});`,hl(e,13)+", sorted"+me),K(l+b+bt,`props: ${ae}<'${e}'>`,Q+"(props, "+p+`(props.${M}), ${a}, ${T});`,hl(e,13)+me),N(e,((n,o,s,r,I)=>{const $="Map"+Nl(o,1);c(0,L,$),c(1,L,$),q(u+l+I+b+w,u+b+w,d,`Gets ${dl(1)}the '${n}' Cell anywhere in `+pl(e)+me,t,Gl(a,r)),q(u+l+I+w,u+w,d,gl(e,n,0,1)+me,it,Gl(a,ot,r));const i=q(l+I+w,w,o+(S(s)?Ee:t),gl(e,n)+me,it,Gl(a,ot,r));q(Je+l+I+w+ge,Je+w+ge,dt,gl(e,n,9)+tt,Gl(it,Zl(w)+et+o+" | "+$,Zl(w)+ve),Gl(a,ot,r,Ql(w)),nt,Gl($t,`cell: ${o} | ${$})`+Ke,Xl),ut),q(Te+l+I+w+ge,Te+w+ge,ge,gl(e,n,12),Gl(it,"forceDel?: boolean"),Gl(a,ot,r,"forceDel"),t,ct,ut),K(l+I+w+bt,`{rowId, ${M}, debugIds}: `+le+`<'${e}', '${n}'>`,[oe+`('' + ${i}(rowId, `+M+`) ?? '', undefined, debugIds, ${r})`],gl(e,n,13)+me)}))}));const ce=z(E((e=>Ie(Z,e)?.[4]??t))," | ");q(u+p+I,u+p+I,qe,sl(1,8,0,1)+" changes",pt($),Ct()),q(p+I,p+I,qe,sl(1,8)+" changes",pt(T),Ct()),q(C+I,C+I,qe,bl(2,0,1),pt(y),Ct()),q(u+b+I,u+b+I,qe,bl(3,0,0,1),pt(v,`tableId: ${n} | null`),Ct("tableId")),q(b+I,b+I,qe,bl(3,0),pt(A,`tableId: ${n} | null`),Ct("tableId")),q(b+f+I,b+f+I,qe,bl(14,3,1),pt(k,`tableId: ${n} | null`),Ct("tableId")),q(u+b+w+I,u+b+w+I,qe,bl(16,3,0,1),pt(P,`tableId: ${n} | null`,`cellId: ${ce} | null`),Ct("tableId","cellId")),q(h+fe+I,h+fe+I,qe,bl(15,3),pt(O,`tableId: ${n} | null`),Ct("tableId")),q(m+I,m+I,qe,bl(4,3,1),pt(D,`tableId: ${n} | null`),Ct("tableId")),q(g+I,g+I,qe,bl(13,3,1),pt(j,`tableId: ${n} | null`,"cellId: "+ce+Ee,"descending: boolean","offset: number","limit: number"+Ee),Ct("tableId","cellId","descending","offset","limit")),q(u+h+I,u+h+I,qe,bl(5,3,0,1),pt(J,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),q(h+I,h+I,qe,bl(5,3),pt(W,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),q(f+I,f+I,qe,bl(6,5,1),pt(F,`tableId: ${n} | null`,ot+": IdOrNull"),Ct("tableId",ot)),q(u+w+I,u+w+I,qe,bl(7,5,0,1),pt(U,`tableId: ${n} | null`,ot+": IdOrNull",`cellId: ${ce} | null`),Ct("tableId",ot,"cellId")),q(w+I,w+I,qe,bl(7,5),pt(_,`tableId: ${n} | null`,ot+": IdOrNull",`cellId: ${ce} | null`),Ct("tableId",ot,"cellId"))}if(!ae(a)){const[e,l,a,n,o,s,$,i]=r;c(null,L,...r),c(1,L,H);const b=R("getDefaultValueComponent","valueId: Id",z(D(((e,l,t,a,n)=>`valueId == ${a} ? `+n+"ValueView : ")))+$e);q(u+y,u+y,d,sl(2,0,0,1)+me),q(y,y,e,sl(2,0)+me);const p=q(v,v,a+We,Il(T,Be)+me);q(Je+y+ge,Je+y+ge,dt,sl(2,9)+tt,Gl(Zl(y)+et+l,Zl(y)+ve),Ql(y),nt,Gl($t,`values: ${l})`+Ke,Xl),ut),q(Je+x+y+ge,Je+x+y+ge,dt,sl(2,11)+tt,Gl(Zl(x+y)+et+l,Zl(x+y)+ve),Ql(x+y),nt,Gl($t,`partialValues: ${l})`+Ke,Xl),ut),q(Te+y+ge,Te+y+ge,ge,sl(2,12),t,t,t,ct,ut);const C=V(T+De,Hl("valueId?: VId",M+Oe+H,ql),cl("a Value"),`<VId extends ${a}>`),h=V(y+De,Hl(M+Oe+H,"valueComponents?: {readonly [VId in "+a+`]?: ComponentType<${C}<VId>>;}`,`getValueComponentProps?: (valueId: ${a}) => ExtraProps`,It,ql),cl(ol(2,1)));c(1,G,h,C),K(y+bt,"{"+M+", valueComponents, getValueComponentProps"+rt+"}: "+h,[oe+`(${p}(${M}).map((valueId) => {`,"const Value = valueComponents?.[valueId] ?? "+b+"(valueId);","return <Value",`{...${de}(getValueComponentProps, valueId)}`,"key={valueId}",B,Kl,"/>;","}), separator)"],sl(2,13)+me),D(((e,l,a,n,o)=>{const s="Map"+Nl(l,1);c(0,L,s),c(1,L,s),q(u+o+T,u+T,d,wl(e,0,1)+me,t,n);const r=q(o+T,T,l,wl(e)+me,t,n);q(Je+o+T+ge,Je+T+ge,dt,wl(e,9)+tt,Gl(Zl(T)+et+l+" | "+s,Zl(T)+ve),Gl(n,Ql(T)),nt,Gl($t,`value: ${l} | ${s})`+Ke,Xl),ut),q(Te+o+T+ge,Te+T+ge,ge,wl(e,12),t,n,t,ct,ut),K(o+T+bt,`{${M}, debugIds}: ${C}<'${e}'>`,[oe+`('' + ${r}(`+M+`) ?? '', undefined, debugIds, ${n})`],wl(e,13)+me)})),q(u+y+I,u+y+I,qe,sl(2,8,0,1)+" changes",pt(n),Ct()),q(y+I,y+I,qe,sl(2,8)+" changes",pt(o),Ct()),q(v+I,v+I,qe,bl(10,0,1),pt(s),Ct()),q(u+T+I,u+T+I,qe,bl(11,0,0,1),pt($,`valueId: ${a} | null`),Ct("valueId")),q(T+I,T+I,qe,bl(11,0),pt(i,`valueId: ${a} | null`),Ct("valueId"))}return K(Le,`{${M}, ${M}ById, children}: `+ee+" & {readonly children: React.ReactNode}",["{",lt,"return (","<Context."+Le,"value={useMemo(",`() => [${M} ?? contextValue[0], {...contextValue[1], ...${M}ById}],`,`[${M}, ${M}ById, contextValue],`,")}>","{children}",`</Context.${Le}>`,");","}"],"Wraps part of an application in a context that provides default objects to be used by hooks and components within"),[$(...k(0),...P(),...X(0)),$(...k(1),...O(),...X(1))]},mt=(e,l,a)=>{if(ae(e)&&ae(l))return[t,t,t,t];const[n,d,o,s]=_l(e,l,a);return[n,d,...ht(e,l,a,o,s)]},gt=JSON.parse,wt="prettier/",ft=wt+"plugins/",Tt={parser:"typescript",singleQuote:!0,trailingComma:"all",bracketSpacing:!1,jsdocSingleLineComment:!1},yt=Jl((e=>{const l=()=>{const l=gt(e.getTablesSchemaJson());return!ae(l)||H(e.getTableIds(),(t=>{const a=e.getRowIds(t),n=re();if(H(a,(l=>H(e.getCellIds(t,l),(a=>{const d=e.getCell(t,l,a),o=ie(n,a,(()=>[j(d),re(),[0],0])),[s,r,[I]]=o,$=ie(r,d,(()=>0))+1;return $>I&&(o[2]=[$,d]),ue(r,d,$),o[3]++,s==j(d)})))))return l[t]={},oe(n,(([e,,[,n],d],o)=>{l[t][o]={[s]:e,...d==L(a)?{[r]:n}:{}}})),1}))?l:{}},t=()=>{const l=gt(e.getValuesSchemaJson());return ae(l)&&e.forEachValue(((e,t)=>{l[e]={[s]:j(t)}})),l},a=e=>mt(l(),t(),e),n=async e=>{const l=["d.ts","ts","d.ts","tsx"],t=[];let n;try{n=(await import(wt+"standalone")).format,F(t,await import(ft+"estree"),await import(ft+"typescript"))}catch{n=async e=>e}return await G(W(a(e),(async(e,a)=>Ol(await n(e,{...Tt,plugins:t,filepath:"_."+l[a]})))))};return ee({getStoreStats:l=>{let t=0,a=0,n=0;const d={};return e.forEachTable(((e,o)=>{t++;let s=0,r=0;const I={};o(((e,t)=>{s++;let a=0;t((()=>a++)),r+=a,l&&(I[e]={rowCells:a})})),a+=s,n+=r,l&&(d[e]={tableRows:s,tableCells:r,rows:I})})),{totalTables:t,totalRows:a,totalCells:n,totalValues:L(e.getValueIds()),jsonLength:L(e.getJson()),...l?{detail:{tables:d}}:{}}},getStoreTablesSchema:l,getStoreValuesSchema:t,getStoreApi:a,getPrettyStoreApi:n,getStore:()=>e})}));export{yt as createTools};
Binary file
@@ -1 +1 @@
1
- import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),n="Listener",d="Result",i="Has",c="Ids",u="Table",a=u+"s",l=u+c,I="Row",p=I+"Count",g=I+c,b="Sorted"+I+c,y="Cell",C=y+c,m="Value",h=m+"s",k=m+c,w="Status",R=globalThis,v=e=>null==e,S=(e,t,o)=>v(e)?o?.():t(e),f=e=>t(e)==s,P=e=>t(e)==r,x=e=>e.length,q=()=>{},L=(e,t)=>e.every(t),B=(e,t)=>x(e)===x(t)&&L(e,((e,o)=>t[o]===e)),M=(e,t)=>e.map(t),T=(e,t,o)=>e.with(t,o),E=Object,z=e=>E.getPrototypeOf(e),F=E.entries,Q=e=>!v(e)&&S(z(e),(e=>e==E.prototype||v(z(e))),(()=>!0)),V=E.keys,A=(e,t)=>S(e,(e=>e[t])),O=(e,t)=>t in e,j=(e,t)=>{const o=F(e);return x(o)===x(V(t))&&L(o,(([e,o])=>Q(o)?!!Q(t[e])&&j(t[e],o):t[e]===o))},{createContext:D,useContext:H,useEffect:W}=e;var _=(e=>(e[e.Store=0]="Store",e[e.Metrics=1]="Metrics",e[e.Indexes=2]="Indexes",e[e.Relationships=3]="Relationships",e[e.Queries=4]="Queries",e[e.Checkpoints=5]="Checkpoints",e[e.Persister=6]="Persister",e[e.Synchronizer=7]="Synchronizer",e))(_||{});const G=(N=()=>D([]),O(J=R,K="tinybase_uirc")||(J[K]=N()),J[K]);var J,K,N;const U=(e,t)=>{const o=H(G);return v(e)?o[2*t]:f(e)?A(o[2*t+1]??{},e):e},X=(e,t)=>{const o=U(e,t);return v(e)||f(e)?o:e},Y=(e,t,o)=>{const{16:s,17:r}=H(G);W((()=>(s?.(o,e,t),()=>r?.(o,e))),[s,e,t,o,r])},Z=e=>V(H(G)[2*e+1]??{}),$=()=>Z(0),ee=e=>U(e,0),te=e=>X(e,0),oe=(e,t)=>Y(e,t,0),se=()=>Z(1),re=e=>U(e,1),ne=e=>X(e,1),de=(e,t)=>Y(e,t,1),ie=()=>Z(2),ce=e=>U(e,2),ue=e=>X(e,2),ae=(e,t)=>Y(e,t,2),le=()=>Z(3),Ie=e=>U(e,3),pe=e=>X(e,3),ge=(e,t)=>Y(e,t,3),be=()=>Z(4),ye=e=>U(e,4),Ce=e=>X(e,4),me=(e,t)=>Y(e,t,4),he=()=>Z(5),ke=e=>U(e,5),we=e=>X(e,5),Re=(e,t)=>Y(e,t,5),ve=()=>Z(6),Se=e=>U(e,6),fe=e=>X(e,6),Pe=(e,t)=>Y(e,t,6),xe=()=>Z(7),qe=e=>U(e,7),Le=e=>X(e,7),Be=(e,t)=>Y(e,t,7),Me=e=>e.toLowerCase();Me(n);const Te="Transaction";Me(Te);const{useCallback:Ee,useEffect:ze,useMemo:Fe,useLayoutEffect:Qe,useRef:Ve,useState:Ae,useSyncExternalStore:Oe}=e,je=[],De=[{},[],[je,void 0,je],void 0,!1,0],He=[j,B,([e,t,o],[s,r,n])=>t===r&&B(e,s)&&B(o,n)],We=(e,t)=>e===t,_e=(e,t,o=je)=>{const[,s]=Ae(),[r,n]=Ae();return ze((()=>{const o=e?t(e):void 0;return n(o),s([]),o?.destroy}),[e,...o]),r},Ge=(e,t,...o)=>{const s=e?.["add"+t+n]?.(...o);return()=>e?.delListener(s)},Je=(e,t,s,r=je)=>{const n=Ve(De[s]),d=Ee((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??De[s];return(He[s]??We)(o,n.current)?n.current:n.current=o}),[t,s,e,...r]),c=Ee((n=>Ge(t,(4==s?i:o)+e,...r,n)),[t,s,e,...r]);return Oe(c,d,d)},Ke=(e,t,o,s=je,r=je,...n)=>Qe((()=>Ge(t,e,...r,o,...n)),[t,e,...r,...s,...n]),Ne=(e,t,o,s=je,r=q,n=je,...d)=>{const i=te(e);return Ee((e=>S(i,(s=>S(o(e,s),(o=>r(s["set"+t](...Ue(d,s,e),o),o)))))),[i,t,...s,...n,...Xe(d)])},Ue=(e,t,o)=>M(e,(e=>P(e)?e(o,t):e)),Xe=e=>{return t=e=>!P(e),e.filter(t);var t},Ye=(e,t,o=q,s=je,...r)=>{const n=te(e);return Ee((e=>o(n?.["del"+t](...Ue(r,n,e)))),[n,t,...s,...Xe(r)])},Ze=(e,t,o)=>{const s=we(e);return Ee((()=>s?.[t](o)),[s,t,o])},$e=(e,t=je)=>Fe(e,t),et=(e,t=je)=>Fe(e,t),tt=e=>Je(a,te(e),4,[]),ot=e=>Je(a,te(e),0),st=e=>Je(l,te(e),1),rt=(e,t)=>Je(u,te(t),4,[e]),nt=(e,t)=>Je(u,te(t),0,[e]),dt=(e,t)=>Je(u+C,te(t),1,[e]),it=(e,t,o)=>Je(u+y,te(o),4,[e,t]),ct=(e,t)=>Je(p,te(t),5,[e]),ut=(e,t)=>Je(g,te(t),1,[e]),at=(e,t,o,s=0,r,n)=>Je(b,te(n),1,[e,t,o,s,r]),lt=(e,t,o)=>Je(I,te(o),4,[e,t]),It=(e,t,o)=>Je(I,te(o),0,[e,t]),pt=(e,t,o)=>Je(C,te(o),1,[e,t]),gt=(e,t,o,s)=>Je(y,te(s),4,[e,t,o]),bt=(e,t,o,s)=>Je(y,te(s),3,[e,t,o]),yt=e=>Je(h,te(e),4,[]),Ct=e=>Je(h,te(e),0),mt=e=>Je(k,te(e),1),ht=(e,t)=>Je(m,te(t),4,[e]),kt=(e,t)=>Je(m,te(t),3,[e]),wt=(e,t,o,s,r)=>Ne(o,a,e,t,s,r),Rt=(e,t,o,s,r,n)=>Ne(s,u,t,o,r,n,e),vt=(e,t,o,s,r,n,d)=>Ne(r,I,o,s,n,d,e,t),St=(e,t,o=je,s,r=q,n=je,d=!0)=>{const i=te(s);return Ee((o=>S(i,(s=>S(t(o,s),(t=>r(s.addRow(P(e)?e(o,s):e,t,d),s,t)))))),[i,e,...o,...n,d])},ft=(e,t,o,s,r,n,d)=>Ne(r,"PartialRow",o,s,n,d,e,t),Pt=(e,t,o,s,r,n,d,i)=>Ne(n,y,s,r,d,i,e,t,o),xt=(e,t,o,s,r)=>Ne(o,h,e,t,s,r),qt=(e,t,o,s,r)=>Ne(o,"PartialValues",e,t,s,r),Lt=(e,t,o,s,r,n)=>Ne(s,m,t,o,r,n,e),Bt=(e,t,o)=>Ye(e,a,t,o),Mt=(e,t,o,s)=>Ye(t,u,o,s,e),Tt=(e,t,o,s,r)=>Ye(o,I,s,r,e,t),Et=(e,t,o,s,r,n,d)=>Ye(r,y,n,d,e,t,o,s),zt=(e,t,o)=>Ye(e,h,t,o),Ft=(e,t,o,s)=>Ye(t,m,o,s,e),Qt=(e,t,o,s)=>Ke(i+a,te(s),e,t,[],o),Vt=(e,t,o,s)=>Ke(a,te(s),e,t,je,o),At=(e,t,o,s)=>Ke(l,te(s),e,t,je,o),Ot=(e,t,o,s,r)=>Ke(i+u,te(r),t,o,[e],s),jt=(e,t,o,s,r)=>Ke(u,te(r),t,o,[e],s),Dt=(e,t,o,s,r)=>Ke(u+C,te(r),t,o,[e],s),Ht=(e,t,o,s,r,n)=>Ke(i+u+y,te(n),o,s,[e,t],r),Wt=(e,t,o,s,r)=>Ke(p,te(r),t,o,[e],s),_t=(e,t,o,s,r)=>Ke(g,te(r),t,o,[e],s),Gt=(e,t,o,s,r,n,d,i,c)=>Ke(b,te(c),n,d,[e,t,o,s,r],i),Jt=(e,t,o,s,r,n)=>Ke(i+I,te(n),o,s,[e,t],r),Kt=(e,t,o,s,r,n)=>Ke(I,te(n),o,s,[e,t],r),Nt=(e,t,o,s,r,n)=>Ke(C,te(n),o,s,[e,t],r),Ut=(e,t,o,s,r,n,d)=>Ke(i+y,te(d),s,r,[e,t,o],n),Xt=(e,t,o,s,r,n,d)=>Ke(y,te(d),s,r,[e,t,o],n),Yt=(e,t,o,s)=>Ke(i+h,te(s),e,t,[],o),Zt=(e,t,o,s)=>Ke(h,te(s),e,t,je,o),$t=(e,t,o,s)=>Ke(k,te(s),e,t,je,o),eo=(e,t,o,s,r)=>Ke(i+m,te(r),t,o,[e],s),to=(e,t,o,s,r)=>Ke(m,te(r),t,o,[e],s),oo=(e,t,o)=>Ke("Start"+Te,te(o),e,t),so=(e,t,o)=>Ke("WillFinish"+Te,te(o),e,t),ro=(e,t,o)=>Ke("DidFinish"+Te,te(o),e,t),no=(e,t,o)=>_e(e,t,o),io=e=>Je("MetricIds",ne(e),1),co=(e,t)=>Je("Metric",ne(t),3,[e]),uo=(e,t,o,s)=>Ke("Metric",ne(s),t,o,[e]),ao=(e,t,o)=>_e(e,t,o),lo=(e,t)=>Je("SliceIds",ue(t),1,[e]),Io=e=>Je("IndexIds",ue(e),1),po=(e,t,o)=>Je("Slice"+g,ue(o),1,[e,t]),go=(e,t,o,s)=>Ke("SliceIds",ue(s),t,o,[e]),bo=(e,t,o,s,r)=>Ke("Slice"+g,ue(r),o,s,[e,t]),yo=(e,t,o)=>_e(e,t,o),Co=e=>Je("RelationshipIds",pe(e),1),mo=(e,t,o)=>Je("RemoteRowId",pe(o),3,[e,t]),ho=(e,t,o)=>Je("Local"+g,pe(o),1,[e,t]),ko=(e,t,o)=>Je("Linked"+g,pe(o),1,[e,t]),wo=(e,t,o,s,r)=>Ke("RemoteRowId",pe(r),o,s,[e,t]),Ro=(e,t,o,s,r)=>Ke("Local"+g,pe(r),o,s,[e,t]),vo=(e,t,o,s,r)=>Ke("Linked"+g,pe(r),o,s,[e,t]),So=(e,t,o)=>_e(e,t,o),fo=e=>Je("QueryIds",Ce(e),1),Po=(e,t)=>Je(d+u,Ce(t),0,[e]),xo=(e,t)=>Je(d+u+C,Ce(t),1,[e]),qo=(e,t)=>Je(d+p,Ce(t),5,[e]),Lo=(e,t)=>Je(d+g,Ce(t),1,[e]),Bo=(e,t,o,s=0,r,n)=>Je(d+b,Ce(n),1,[e,t,o,s,r]),Mo=(e,t,o)=>Je(d+I,Ce(o),0,[e,t]),To=(e,t,o)=>Je(d+C,Ce(o),1,[e,t]),Eo=(e,t,o,s)=>Je(d+y,Ce(s),3,[e,t,o]),zo=(e,t,o,s)=>Ke(d+u,Ce(s),t,o,[e]),Fo=(e,t,o,s)=>Ke(d+u+C,Ce(s),t,o,[e]),Qo=(e,t,o,s)=>Ke(d+p,Ce(s),t,o,[e]),Vo=(e,t,o,s)=>Ke(d+g,Ce(s),t,o,[e]),Ao=(e,t,o,s,r,n,i,c)=>Ke(d+b,Ce(c),n,i,[e,t,o,s,r]),Oo=(e,t,o,s,r)=>Ke(d+I,Ce(r),o,s,[e,t]),jo=(e,t,o,s,r)=>Ke(d+C,Ce(r),o,s,[e,t]),Do=(e,t,o,s,r,n)=>Ke(d+y,Ce(n),s,r,[e,t,o]),Ho=(e,t,o)=>_e(e,t,o),Wo=e=>Je("CheckpointIds",we(e),2),_o=(e,t)=>Je("Checkpoint",we(t),3,[e]),Go=(e=q,t=je,o,s=q,r=je)=>{const n=we(o);return Ee((t=>S(n,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[n,...t,...r])},Jo=e=>Ze(e,"goBackward"),Ko=e=>Ze(e,"goForward"),No=(e,t=je,o,s=q,r=je)=>{const n=we(o);return Ee((t=>S(n,(o=>S(e(t),(e=>s(o.goTo(e),e)))))),[n,...t,...r])},Uo=e=>{const t=we(e),[s,r]=Wo(t);return[(n=s,!(0==x(n))),Jo(t),r,S(r,(e=>t?.getCheckpoint(e)))??o];var n},Xo=e=>{const t=we(e),[,,[s]]=Wo(t);return[!v(s),Ko(t),s,S(s,(e=>t?.getCheckpoint(e)))??o]},Yo=(e,t,o)=>Ke("CheckpointIds",we(o),e,t),Zo=(e,t,o,s)=>Ke("Checkpoint",we(s),t,o,[e]),$o=(e,t,o=je,s,r=je,n,d=je)=>{const[,i]=Ae(),[c,u]=Ae();return ze((()=>{(async()=>{const o=e?await t(e):void 0;u(o),o&&s&&(async()=>{await s(o),i([])})()})()}),[e,...o,...r]),ze((()=>()=>{c&&(c.destroy(),n?.(c))}),[c,...d]),c},es=e=>Je(w,fe(e),5,[]),ts=(e,t,o)=>Ke(w,fe(o),e,t,[]),os=(e,t,o=je,s,r=je)=>{const[n,d]=Ae();return ze((()=>{(async()=>{const o=e?await t(e):void 0;d(o)})()}),[e,...o]),ze((()=>()=>{n&&(n.destroy(),s?.(n))}),[n,...r]),n},ss=e=>Je(w,Le(e),5,[]),rs=(e,t,o)=>Ke(w,Le(o),e,t,[]),{PureComponent:ns,Fragment:ds,createElement:is,useCallback:cs,useLayoutEffect:us,useRef:as,useState:ls}=e,Is=(e,...t)=>v(e)?{}:e(...t),ps=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:gs,useContext:bs,useMemo:ys,useState:Cs}=e,ms=(e,t,o,s,r)=>[o??t[2*e],{...t[2*e+1],...s,...r[e]}],hs=({tableId:e,store:t,rowComponent:o=Ps,getRowComponentProps:s,customCellIds:r,separator:n,debugIds:d},i)=>Ss(M(i,(n=>is(o,{...Is(s,n),key:n,tableId:e,rowId:n,customCellIds:r,store:t,debugIds:d}))),n,d,e),ks=({queryId:e,queries:t,resultRowComponent:o=Os,getResultRowComponentProps:s,separator:r,debugIds:n},d)=>Ss(M(d,(r=>is(o,{...Is(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:n}))),r,n,e),ws=({relationshipId:e,relationships:t,rowComponent:o=Ps,getRowComponentProps:s,separator:r,debugIds:n},d,i)=>{const[c,u,a]=ps(pe(t),e),l=d(e,i,c);return Ss(M(l,(e=>is(o,{...Is(s,e),key:e,tableId:a,rowId:e,store:u,debugIds:n}))),r,n,i)},Rs=e=>({checkpoints:t,checkpointComponent:o=Hs,getCheckpointComponentProps:s,separator:r,debugIds:n})=>{const d=we(t);return Ss(M(e(Wo(d)),(e=>is(o,{...Is(s,e),key:e,checkpoints:d,checkpointId:e,debugIds:n}))),r)},vs=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:n,relationships:d,relationshipsById:i,queries:c,queriesById:u,checkpoints:a,checkpointsById:l,persister:I,persistersById:p,synchronizer:g,synchronizersById:b,children:y})=>{const C=bs(G),[m,h]=Cs((()=>M([,,,,,,,,].fill(0),((e,t)=>({}))))),k=gs(((e,t,o)=>h((s=>A(s[e],t)==o?s:T(s,e,{...s[e],[t]:o})))),[]),w=gs(((e,t)=>h((o=>O(o[e],t)?T(o,e,((e,t)=>(delete e[t],e))(o[e],t)):o))),[]);return is(G.Provider,{value:ys((()=>[...ms(_.Store,C,e,t,m),...ms(_.Metrics,C,o,s,m),...ms(_.Indexes,C,r,n,m),...ms(_.Relationships,C,d,i,m),...ms(_.Queries,C,c,u,m),...ms(_.Checkpoints,C,a,l,m),...ms(_.Persister,C,I,p,m),...ms(_.Synchronizer,C,g,b,m),k,w]),[m,e,t,o,s,r,n,d,i,c,u,a,l,I,p,g,b,C,k,w])},y)},Ss=(e,t,o,s)=>{const r=v(t)||!Array.isArray(e)?e:M(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},fs=({tableId:e,rowId:t,cellId:s,store:r,debugIds:n})=>Ss(o+(bt(e,t,s,r)??o),void 0,n,s),Ps=({tableId:e,rowId:t,store:o,cellComponent:s=fs,getCellComponentProps:r,customCellIds:n,separator:d,debugIds:i})=>Ss(M(((e,t,o,s)=>{const r=pt(t,o,s);return e??r})(n,e,t,o),(n=>is(s,{...Is(r,n),key:n,tableId:e,rowId:t,cellId:n,store:o,debugIds:i}))),d,i,t),xs=e=>hs(e,ut(e.tableId,e.store)),qs=({cellId:e,descending:t,offset:o,limit:s,...r})=>hs(r,at(r.tableId,e,t,o,s,r.store)),Ls=({store:e,tableComponent:t=xs,getTableComponentProps:o,separator:s,debugIds:r})=>Ss(M(st(e),(s=>is(t,{...Is(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Bs=({valueId:e,store:t,debugIds:s})=>Ss(o+(kt(e,t)??o),void 0,s,e),Ms=({store:e,valueComponent:t=Bs,getValueComponentProps:o,separator:s,debugIds:r})=>Ss(M(mt(e),(s=>is(t,{...Is(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),Ts=({metricId:e,metrics:t,debugIds:s})=>Ss(co(e,t)??o,void 0,s,e),Es=({indexId:e,sliceId:t,indexes:o,rowComponent:s=Ps,getRowComponentProps:r,separator:n,debugIds:d})=>{const[i,c,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(ue(o),e),a=po(e,t,i);return Ss(M(a,(e=>is(s,{...Is(r,e),key:e,tableId:u,rowId:e,store:c,debugIds:d}))),n,d,t)},zs=({indexId:e,indexes:t,sliceComponent:o=Es,getSliceComponentProps:s,separator:r,debugIds:n})=>Ss(M(lo(e,t),(r=>is(o,{...Is(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:n}))),r,n,e),Fs=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=Ps,getRowComponentProps:r,debugIds:n})=>{const[d,i,,c]=ps(pe(o),e),u=mo(e,t,d);return Ss(v(c)||v(u)?null:is(s,{...Is(r,u),key:u,tableId:c,rowId:u,store:i,debugIds:n}),void 0,n,t)},Qs=e=>ws(e,ho,e.remoteRowId),Vs=e=>ws(e,ko,e.firstRowId),As=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:n})=>Ss(o+(Eo(e,t,s,r)??o),void 0,n,s),Os=({queryId:e,rowId:t,queries:o,resultCellComponent:s=As,getResultCellComponentProps:r,separator:n,debugIds:d})=>Ss(M(To(e,t,o),(n=>is(s,{...Is(r,n),key:n,queryId:e,rowId:t,cellId:n,queries:o,debugIds:d}))),n,d,t),js=e=>ks(e,Lo(e.queryId,e.queries)),Ds=({cellId:e,descending:t,offset:o,limit:s,...r})=>ks(r,Bo(r.queryId,e,t,o,s,r.queries)),Hs=({checkpoints:e,checkpointId:t,debugIds:s})=>Ss(_o(t,e)??o,void 0,s,t),Ws=Rs((e=>e[0])),_s=Rs((e=>v(e[1])?[]:[e[1]])),Gs=Rs((e=>e[2]));export{Ws as BackwardCheckpointsView,fs as CellView,Hs as CheckpointView,_s as CurrentCheckpointView,Gs as ForwardCheckpointsView,zs as IndexView,Vs as LinkedRowsView,Qs as LocalRowsView,Ts as MetricView,vs as Provider,Fs as RemoteRowView,As as ResultCellView,Os as ResultRowView,Ds as ResultSortedTableView,js as ResultTableView,Ps as RowView,Es as SliceView,qs as SortedTableView,xs as TableView,Ls as TablesView,Bs as ValueView,Ms as ValuesView,St as useAddRowCallback,bt as useCell,pt as useCellIds,Nt as useCellIdsListener,Xt as useCellListener,_o as useCheckpoint,Wo as useCheckpointIds,Yo as useCheckpointIdsListener,Zo as useCheckpointListener,ke as useCheckpoints,he as useCheckpointsIds,we as useCheckpointsOrCheckpointsById,Ho as useCreateCheckpoints,ao as useCreateIndexes,et as useCreateMergeableStore,no as useCreateMetrics,$o as useCreatePersister,So as useCreateQueries,yo as useCreateRelationships,$e as useCreateStore,os as useCreateSynchronizer,Et as useDelCellCallback,Tt as useDelRowCallback,Mt as useDelTableCallback,Bt as useDelTablesCallback,Ft as useDelValueCallback,zt as useDelValuesCallback,ro as useDidFinishTransactionListener,Jo as useGoBackwardCallback,Ko as useGoForwardCallback,No as useGoToCallback,gt as useHasCell,Ut as useHasCellListener,lt as useHasRow,Jt as useHasRowListener,rt as useHasTable,it as useHasTableCell,Ht as useHasTableCellListener,Ot as useHasTableListener,tt as useHasTables,Qt as useHasTablesListener,ht as useHasValue,eo as useHasValueListener,yt as useHasValues,Yt as useHasValuesListener,Io as useIndexIds,ce as useIndexes,ie as useIndexesIds,ue as useIndexesOrIndexesById,ko as useLinkedRowIds,vo as useLinkedRowIdsListener,ho as useLocalRowIds,Ro as useLocalRowIdsListener,co as useMetric,io as useMetricIds,uo as useMetricListener,re as useMetrics,se as useMetricsIds,ne as useMetricsOrMetricsById,Se as usePersister,ve as usePersisterIds,fe as usePersisterOrPersisterById,es as usePersisterStatus,ts as usePersisterStatusListener,Re as useProvideCheckpoints,ae as useProvideIndexes,de as useProvideMetrics,Pe as useProvidePersister,me as useProvideQueries,ge as useProvideRelationships,oe as useProvideStore,Be as useProvideSynchronizer,ye as useQueries,be as useQueriesIds,Ce as useQueriesOrQueriesById,fo as useQueryIds,Xo as useRedoInformation,Co as useRelationshipIds,Ie as useRelationships,le as useRelationshipsIds,pe as useRelationshipsOrRelationshipsById,mo as useRemoteRowId,wo as useRemoteRowIdListener,Eo as useResultCell,To as useResultCellIds,jo as useResultCellIdsListener,Do as useResultCellListener,Mo as useResultRow,qo as useResultRowCount,Qo as useResultRowCountListener,Lo as useResultRowIds,Vo as useResultRowIdsListener,Oo as useResultRowListener,Bo as useResultSortedRowIds,Ao as useResultSortedRowIdsListener,Po as useResultTable,xo as useResultTableCellIds,Fo as useResultTableCellIdsListener,zo as useResultTableListener,It as useRow,ct as useRowCount,Wt as useRowCountListener,ut as useRowIds,_t as useRowIdsListener,Kt as useRowListener,Pt as useSetCellCallback,Go as useSetCheckpointCallback,ft as useSetPartialRowCallback,qt as useSetPartialValuesCallback,vt as useSetRowCallback,Rt as useSetTableCallback,wt as useSetTablesCallback,Lt as useSetValueCallback,xt as useSetValuesCallback,lo as useSliceIds,go as useSliceIdsListener,po as useSliceRowIds,bo as useSliceRowIdsListener,at as useSortedRowIds,Gt as useSortedRowIdsListener,oo as useStartTransactionListener,ee as useStore,$ as useStoreIds,te as useStoreOrStoreById,qe as useSynchronizer,xe as useSynchronizerIds,Le as useSynchronizerOrSynchronizerById,ss as useSynchronizerStatus,rs as useSynchronizerStatusListener,nt as useTable,dt as useTableCellIds,Dt as useTableCellIdsListener,st as useTableIds,At as useTableIdsListener,jt as useTableListener,ot as useTables,Vt as useTablesListener,Uo as useUndoInformation,kt as useValue,mt as useValueIds,$t as useValueIdsListener,to as useValueListener,Ct as useValues,Zt as useValuesListener,so as useWillFinishTransactionListener};
1
+ import e from"react";const t=e=>typeof e,o="",r=t(o),s=t(t),n="Result",d="Has",u="Ids",i="Table",c=i+"s",l=i+u,I="Row",a=I+"Count",p=I+u,g="Sorted"+I+u,b="Cell",y=b+u,m="Value",C=m+"s",w=m+u,h="Transaction",k="Partial",v="Finish",R="Status",q="Metric",f="Slice",P="RemoteRowId",x="Local",S="Linked",B="Checkpoint",T=globalThis,L=e=>null==e,E=(e,t,o)=>L(e)?o?.():t(e),F=e=>t(e)==r,z=e=>t(e)==s,A=e=>e.length,M=()=>{},O=(e,t)=>e.every(t),V=(e,t)=>A(e)===A(t)&&O(e,((e,o)=>t[o]===e)),j=(e,t)=>e.map(t),D=(e,t,o)=>e.with(t,o),{PureComponent:H,Fragment:Q,createContext:W,createElement:_,useCallback:G,useContext:J,useEffect:K,useLayoutEffect:N,useMemo:U,useRef:X,useState:Y,useSyncExternalStore:Z}=e,$=(e,...t)=>L(e)?{}:e(...t),ee=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],te=Object,oe=e=>te.getPrototypeOf(e),re=te.entries,se=e=>!L(e)&&E(oe(e),(e=>e==te.prototype||L(oe(e))),(()=>!0)),ne=te.keys,de=(e,t)=>E(e,(e=>e[t])),ue=(e,t)=>t in e,ie=(e,t)=>{const o=re(e);return A(o)===A(ne(t))&&O(o,(([e,o])=>se(o)?!!se(t[e])&&ie(t[e],o):t[e]===o))},ce=(ae=()=>W([]),ue(le=T,Ie="tinybase_uirc")||(le[Ie]=ae()),le[Ie]);var le,Ie,ae;const pe=(e,t)=>{const o=J(ce);return L(e)?o[2*t]:F(e)?de(o[2*t+1]??{},e):e},ge=(e,t)=>{const o=pe(e,t);return L(e)||F(e)?o:e},be=(e,t,o)=>{const{16:r,17:s}=J(ce);K((()=>(r?.(o,e,t),()=>s?.(o,e))),[r,e,t,o,s])},ye=e=>ne(J(ce)[2*e+1]??{}),me=()=>ye(0),Ce=e=>pe(e,0),we=e=>ge(e,0),he=(e,t)=>be(e,t,0),ke=()=>ye(1),ve=e=>pe(e,1),Re=e=>ge(e,1),qe=(e,t)=>be(e,t,1),fe=()=>ye(2),Pe=e=>pe(e,2),xe=e=>ge(e,2),Se=(e,t)=>be(e,t,2),Be=()=>ye(3),Te=e=>pe(e,3),Le=e=>ge(e,3),Ee=(e,t)=>be(e,t,3),Fe=()=>ye(4),ze=e=>pe(e,4),Ae=e=>ge(e,4),Me=(e,t)=>be(e,t,4),Oe=()=>ye(5),Ve=e=>pe(e,5),je=e=>ge(e,5),De=(e,t)=>be(e,t,5),He=()=>ye(6),Qe=e=>pe(e,6),We=e=>ge(e,6),_e=(e,t)=>be(e,t,6),Ge=()=>ye(7),Je=e=>pe(e,7),Ke=e=>ge(e,7),Ne=(e,t)=>be(e,t,7),Ue=[],Xe=[{},[],[Ue,void 0,Ue],void 0,!1,0],Ye=[ie,V,([e,t,o],[r,s,n])=>t===s&&V(e,r)&&V(o,n)],Ze=(e,t)=>e===t,$e=(e,t,o=Ue)=>{const[,r]=Y(),[s,n]=Y();return K((()=>{const o=e?t(e):void 0;return n(o),r([]),o?.destroy}),[e,...o]),s},et=(e,t,...o)=>{const r=e?.["add"+t+"Listener"]?.(...o);return()=>e?.delListener(r)},tt=(e,t,r,s=Ue)=>{const n=X(Xe[r]),u=G((()=>{const o=t?.[(4==r?"has":"get")+e]?.(...s)??Xe[r];return(Ye[r]??Ze)(o,n.current)?n.current:n.current=o}),[t,r,e,...s]),i=G((n=>et(t,(4==r?d:o)+e,...s,n)),[t,r,e,...s]);return Z(i,u,u)},ot=(e,t,o,r=Ue,s=Ue,...n)=>N((()=>et(t,e,...s,o,...n)),[t,e,...s,...r,...n]),rt=(e,t,o,r=Ue,s=M,n=Ue,...d)=>{const u=we(e);return G((e=>E(u,(r=>E(o(e,r),(o=>s(r["set"+t](...st(d,r,e),o),o)))))),[u,t,...r,...n,...nt(d)])},st=(e,t,o)=>j(e,(e=>z(e)?e(o,t):e)),nt=e=>{return t=e=>!z(e),e.filter(t);var t},dt=(e,t,o=M,r=Ue,...s)=>{const n=we(e);return G((e=>o(n?.["del"+t](...st(s,n,e)))),[n,t,...r,...nt(s)])},ut=(e,t,o)=>{const r=je(e);return G((()=>r?.[t](o)),[r,t,o])},it=(e,t=Ue)=>U(e,t),ct=(e,t=Ue)=>U(e,t),lt=e=>tt(c,we(e),4,[]),It=e=>tt(c,we(e),0),at=e=>tt(l,we(e),1),pt=(e,t)=>tt(i,we(t),4,[e]),gt=(e,t)=>tt(i,we(t),0,[e]),bt=(e,t)=>tt(i+y,we(t),1,[e]),yt=(e,t,o)=>tt(i+b,we(o),4,[e,t]),mt=(e,t)=>tt(a,we(t),5,[e]),Ct=(e,t)=>tt(p,we(t),1,[e]),wt=(e,t,o,r=0,s,n)=>tt(g,we(n),1,[e,t,o,r,s]),ht=(e,t,o)=>tt(I,we(o),4,[e,t]),kt=(e,t,o)=>tt(I,we(o),0,[e,t]),vt=(e,t,o)=>tt(y,we(o),1,[e,t]),Rt=(e,t,o,r)=>tt(b,we(r),4,[e,t,o]),qt=(e,t,o,r)=>tt(b,we(r),3,[e,t,o]),ft=e=>tt(C,we(e),4,[]),Pt=e=>tt(C,we(e),0),xt=e=>tt(w,we(e),1),St=(e,t)=>tt(m,we(t),4,[e]),Bt=(e,t)=>tt(m,we(t),3,[e]),Tt=(e,t,o,r,s)=>rt(o,c,e,t,r,s),Lt=(e,t,o,r,s,n)=>rt(r,i,t,o,s,n,e),Et=(e,t,o,r,s,n,d)=>rt(s,I,o,r,n,d,e,t),Ft=(e,t,o=Ue,r,s=M,n=Ue,d=!0)=>{const u=we(r);return G((o=>E(u,(r=>E(t(o,r),(t=>s(r.addRow(z(e)?e(o,r):e,t,d),r,t)))))),[u,e,...o,...n,d])},zt=(e,t,o,r,s,n,d)=>rt(s,k+I,o,r,n,d,e,t),At=(e,t,o,r,s,n,d,u)=>rt(n,b,r,s,d,u,e,t,o),Mt=(e,t,o,r,s)=>rt(o,C,e,t,r,s),Ot=(e,t,o,r,s)=>rt(o,k+C,e,t,r,s),Vt=(e,t,o,r,s,n)=>rt(r,m,t,o,s,n,e),jt=(e,t,o)=>dt(e,c,t,o),Dt=(e,t,o,r)=>dt(t,i,o,r,e),Ht=(e,t,o,r,s)=>dt(o,I,r,s,e,t),Qt=(e,t,o,r,s,n,d)=>dt(s,b,n,d,e,t,o,r),Wt=(e,t,o)=>dt(e,C,t,o),_t=(e,t,o,r)=>dt(t,m,o,r,e),Gt=(e,t,o,r)=>ot(d+c,we(r),e,t,[],o),Jt=(e,t,o,r)=>ot(c,we(r),e,t,Ue,o),Kt=(e,t,o,r)=>ot(l,we(r),e,t,Ue,o),Nt=(e,t,o,r,s)=>ot(d+i,we(s),t,o,[e],r),Ut=(e,t,o,r,s)=>ot(i,we(s),t,o,[e],r),Xt=(e,t,o,r,s)=>ot(i+y,we(s),t,o,[e],r),Yt=(e,t,o,r,s,n)=>ot(d+i+b,we(n),o,r,[e,t],s),Zt=(e,t,o,r,s)=>ot(a,we(s),t,o,[e],r),$t=(e,t,o,r,s)=>ot(p,we(s),t,o,[e],r),eo=(e,t,o,r,s,n,d,u,i)=>ot(g,we(i),n,d,[e,t,o,r,s],u),to=(e,t,o,r,s,n)=>ot(d+I,we(n),o,r,[e,t],s),oo=(e,t,o,r,s,n)=>ot(I,we(n),o,r,[e,t],s),ro=(e,t,o,r,s,n)=>ot(y,we(n),o,r,[e,t],s),so=(e,t,o,r,s,n,u)=>ot(d+b,we(u),r,s,[e,t,o],n),no=(e,t,o,r,s,n,d)=>ot(b,we(d),r,s,[e,t,o],n),uo=(e,t,o,r)=>ot(d+C,we(r),e,t,[],o),io=(e,t,o,r)=>ot(C,we(r),e,t,Ue,o),co=(e,t,o,r)=>ot(w,we(r),e,t,Ue,o),lo=(e,t,o,r,s)=>ot(d+m,we(s),t,o,[e],r),Io=(e,t,o,r,s)=>ot(m,we(s),t,o,[e],r),ao=(e,t,o)=>ot("Start"+h,we(o),e,t),po=(e,t,o)=>ot("Will"+v+h,we(o),e,t),go=(e,t,o)=>ot("Did"+v+h,we(o),e,t),bo=(e,t,o)=>$e(e,t,o),yo=e=>tt(q+u,Re(e),1),mo=(e,t)=>tt(q,Re(t),3,[e]),Co=(e,t,o,r)=>ot(q,Re(r),t,o,[e]),wo=(e,t,o)=>$e(e,t,o),ho=(e,t)=>tt(f+u,xe(t),1,[e]),ko=e=>tt("Index"+u,xe(e),1),vo=(e,t,o)=>tt(f+p,xe(o),1,[e,t]),Ro=(e,t,o,r)=>ot(f+u,xe(r),t,o,[e]),qo=(e,t,o,r,s)=>ot(f+p,xe(s),o,r,[e,t]),fo=(e,t,o)=>$e(e,t,o),Po=e=>tt("Relationship"+u,Le(e),1),xo=(e,t,o)=>tt(P,Le(o),3,[e,t]),So=(e,t,o)=>tt(x+p,Le(o),1,[e,t]),Bo=(e,t,o)=>tt(S+p,Le(o),1,[e,t]),To=(e,t,o,r,s)=>ot(P,Le(s),o,r,[e,t]),Lo=(e,t,o,r,s)=>ot(x+p,Le(s),o,r,[e,t]),Eo=(e,t,o,r,s)=>ot(S+p,Le(s),o,r,[e,t]),Fo=(e,t,o)=>$e(e,t,o),zo=e=>tt("Query"+u,Ae(e),1),Ao=(e,t)=>tt(n+i,Ae(t),0,[e]),Mo=(e,t)=>tt(n+i+y,Ae(t),1,[e]),Oo=(e,t)=>tt(n+a,Ae(t),5,[e]),Vo=(e,t)=>tt(n+p,Ae(t),1,[e]),jo=(e,t,o,r=0,s,d)=>tt(n+g,Ae(d),1,[e,t,o,r,s]),Do=(e,t,o)=>tt(n+I,Ae(o),0,[e,t]),Ho=(e,t,o)=>tt(n+y,Ae(o),1,[e,t]),Qo=(e,t,o,r)=>tt(n+b,Ae(r),3,[e,t,o]),Wo=(e,t,o,r)=>ot(n+i,Ae(r),t,o,[e]),_o=(e,t,o,r)=>ot(n+i+y,Ae(r),t,o,[e]),Go=(e,t,o,r)=>ot(n+a,Ae(r),t,o,[e]),Jo=(e,t,o,r)=>ot(n+p,Ae(r),t,o,[e]),Ko=(e,t,o,r,s,d,u,i)=>ot(n+g,Ae(i),d,u,[e,t,o,r,s]),No=(e,t,o,r,s)=>ot(n+I,Ae(s),o,r,[e,t]),Uo=(e,t,o,r,s)=>ot(n+y,Ae(s),o,r,[e,t]),Xo=(e,t,o,r,s,d)=>ot(n+b,Ae(d),r,s,[e,t,o]),Yo=(e,t,o)=>$e(e,t,o),Zo=e=>tt(B+u,je(e),2),$o=(e,t)=>tt(B,je(t),3,[e]),er=(e=M,t=Ue,o,r=M,s=Ue)=>{const n=je(o);return G((t=>E(n,(o=>{const s=e(t);r(o.addCheckpoint(s),o,s)}))),[n,...t,...s])},tr=e=>ut(e,"goBackward"),or=e=>ut(e,"goForward"),rr=(e,t=Ue,o,r=M,s=Ue)=>{const n=je(o);return G((t=>E(n,(o=>E(e(t),(e=>r(o.goTo(e),e)))))),[n,...t,...s])},sr=e=>{const t=je(e),[r,s]=Zo(t);return[(n=r,!(0==A(n))),tr(t),s,E(s,(e=>t?.getCheckpoint(e)))??o];var n},nr=e=>{const t=je(e),[,,[r]]=Zo(t);return[!L(r),or(t),r,E(r,(e=>t?.getCheckpoint(e)))??o]},dr=(e,t,o)=>ot(B+u,je(o),e,t),ur=(e,t,o,r)=>ot(B,je(r),t,o,[e]),ir=(e,t,o=Ue,r,s=Ue,n,d=Ue)=>{const[,u]=Y(),[i,c]=Y();return K((()=>{(async()=>{const o=e?await t(e):void 0;c(o),o&&r&&(async()=>{await r(o),u([])})()})()}),[e,...o,...s]),K((()=>()=>{i&&(i.destroy(),n?.(i))}),[i,...d]),i},cr=e=>tt(R,We(e),5,[]),lr=(e,t,o)=>ot(R,We(o),e,t,[]),Ir=(e,t,o=Ue,r,s=Ue)=>{const[n,d]=Y();return K((()=>{(async()=>{const o=e?await t(e):void 0;d(o)})()}),[e,...o]),K((()=>()=>{n&&(n.destroy(),r?.(n))}),[n,...s]),n},ar=e=>tt(R,Ke(e),5,[]),pr=(e,t,o)=>ot(R,Ke(o),e,t,[]),gr=(e,t,o,r,s)=>[o??t[2*e],{...t[2*e+1],...r,...s[e]}],br=({tableId:e,store:t,rowComponent:o=vr,getRowComponentProps:r,customCellIds:s,separator:n,debugIds:d},u)=>hr(j(u,(n=>_(o,{...$(r,n),key:n,tableId:e,rowId:n,customCellIds:s,store:t,debugIds:d}))),n,d,e),yr=({queryId:e,queries:t,resultRowComponent:o=Ar,getResultRowComponentProps:r,separator:s,debugIds:n},d)=>hr(j(d,(s=>_(o,{...$(r,s),key:s,queryId:e,rowId:s,queries:t,debugIds:n}))),s,n,e),mr=({relationshipId:e,relationships:t,rowComponent:o=vr,getRowComponentProps:r,separator:s,debugIds:n},d,u)=>{const[i,c,l]=ee(Le(t),e),I=d(e,u,i);return hr(j(I,(e=>_(o,{...$(r,e),key:e,tableId:l,rowId:e,store:c,debugIds:n}))),s,n,u)},Cr=e=>({checkpoints:t,checkpointComponent:o=Vr,getCheckpointComponentProps:r,separator:s,debugIds:n})=>{const d=je(t);return hr(j(e(Zo(d)),(e=>_(o,{...$(r,e),key:e,checkpoints:d,checkpointId:e,debugIds:n}))),s)},wr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:s,indexesById:n,relationships:d,relationshipsById:u,queries:i,queriesById:c,checkpoints:l,checkpointsById:I,persister:a,persistersById:p,synchronizer:g,synchronizersById:b,children:y})=>{const m=J(ce),[C,w]=Y((()=>j([,,,,,,,,].fill(0),((e,t)=>({}))))),h=G(((e,t,o)=>w((r=>de(r[e],t)==o?r:D(r,e,{...r[e],[t]:o})))),[]),k=G(((e,t)=>w((o=>ue(o[e],t)?D(o,e,((e,t)=>(delete e[t],e))(o[e],t)):o))),[]);return _(ce.Provider,{value:U((()=>[...gr(0,m,e,t,C),...gr(1,m,o,r,C),...gr(2,m,s,n,C),...gr(3,m,d,u,C),...gr(4,m,i,c,C),...gr(5,m,l,I,C),...gr(6,m,a,p,C),...gr(7,m,g,b,C),h,k]),[C,e,t,o,r,s,n,d,u,i,c,l,I,a,p,g,b,m,h,k])},y)},hr=(e,t,o,r)=>{const s=L(t)||!Array.isArray(e)?e:j(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",s,"}"]:s},kr=({tableId:e,rowId:t,cellId:r,store:s,debugIds:n})=>hr(o+(qt(e,t,r,s)??o),void 0,n,r),vr=({tableId:e,rowId:t,store:o,cellComponent:r=kr,getCellComponentProps:s,customCellIds:n,separator:d,debugIds:u})=>hr(j(((e,t,o,r)=>{const s=vt(t,o,r);return e??s})(n,e,t,o),(n=>_(r,{...$(s,n),key:n,tableId:e,rowId:t,cellId:n,store:o,debugIds:u}))),d,u,t),Rr=e=>br(e,Ct(e.tableId,e.store)),qr=({cellId:e,descending:t,offset:o,limit:r,...s})=>br(s,wt(s.tableId,e,t,o,r,s.store)),fr=({store:e,tableComponent:t=Rr,getTableComponentProps:o,separator:r,debugIds:s})=>hr(j(at(e),(r=>_(t,{...$(o,r),key:r,tableId:r,store:e,debugIds:s}))),r),Pr=({valueId:e,store:t,debugIds:r})=>hr(o+(Bt(e,t)??o),void 0,r,e),xr=({store:e,valueComponent:t=Pr,getValueComponentProps:o,separator:r,debugIds:s})=>hr(j(xt(e),(r=>_(t,{...$(o,r),key:r,valueId:r,store:e,debugIds:s}))),r),Sr=({metricId:e,metrics:t,debugIds:r})=>hr(mo(e,t)??o,void 0,r,e),Br=({indexId:e,sliceId:t,indexes:o,rowComponent:r=vr,getRowComponentProps:s,separator:n,debugIds:d})=>{const[u,i,c]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(xe(o),e),l=vo(e,t,u);return hr(j(l,(e=>_(r,{...$(s,e),key:e,tableId:c,rowId:e,store:i,debugIds:d}))),n,d,t)},Tr=({indexId:e,indexes:t,sliceComponent:o=Br,getSliceComponentProps:r,separator:s,debugIds:n})=>hr(j(ho(e,t),(s=>_(o,{...$(r,s),key:s,indexId:e,sliceId:s,indexes:t,debugIds:n}))),s,n,e),Lr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=vr,getRowComponentProps:s,debugIds:n})=>{const[d,u,,i]=ee(Le(o),e),c=xo(e,t,d);return hr(L(i)||L(c)?null:_(r,{...$(s,c),key:c,tableId:i,rowId:c,store:u,debugIds:n}),void 0,n,t)},Er=e=>mr(e,So,e.remoteRowId),Fr=e=>mr(e,Bo,e.firstRowId),zr=({queryId:e,rowId:t,cellId:r,queries:s,debugIds:n})=>hr(o+(Qo(e,t,r,s)??o),void 0,n,r),Ar=({queryId:e,rowId:t,queries:o,resultCellComponent:r=zr,getResultCellComponentProps:s,separator:n,debugIds:d})=>hr(j(Ho(e,t,o),(n=>_(r,{...$(s,n),key:n,queryId:e,rowId:t,cellId:n,queries:o,debugIds:d}))),n,d,t),Mr=e=>yr(e,Vo(e.queryId,e.queries)),Or=({cellId:e,descending:t,offset:o,limit:r,...s})=>yr(s,jo(s.queryId,e,t,o,r,s.queries)),Vr=({checkpoints:e,checkpointId:t,debugIds:r})=>hr($o(t,e)??o,void 0,r,t),jr=Cr((e=>e[0])),Dr=Cr((e=>L(e[1])?[]:[e[1]])),Hr=Cr((e=>e[2]));export{jr as BackwardCheckpointsView,kr as CellView,Vr as CheckpointView,Dr as CurrentCheckpointView,Hr as ForwardCheckpointsView,Tr as IndexView,Fr as LinkedRowsView,Er as LocalRowsView,Sr as MetricView,wr as Provider,Lr as RemoteRowView,zr as ResultCellView,Ar as ResultRowView,Or as ResultSortedTableView,Mr as ResultTableView,vr as RowView,Br as SliceView,qr as SortedTableView,Rr as TableView,fr as TablesView,Pr as ValueView,xr as ValuesView,Ft as useAddRowCallback,qt as useCell,vt as useCellIds,ro as useCellIdsListener,no as useCellListener,$o as useCheckpoint,Zo as useCheckpointIds,dr as useCheckpointIdsListener,ur as useCheckpointListener,Ve as useCheckpoints,Oe as useCheckpointsIds,je as useCheckpointsOrCheckpointsById,Yo as useCreateCheckpoints,wo as useCreateIndexes,ct as useCreateMergeableStore,bo as useCreateMetrics,ir as useCreatePersister,Fo as useCreateQueries,fo as useCreateRelationships,it as useCreateStore,Ir as useCreateSynchronizer,Qt as useDelCellCallback,Ht as useDelRowCallback,Dt as useDelTableCallback,jt as useDelTablesCallback,_t as useDelValueCallback,Wt as useDelValuesCallback,go as useDidFinishTransactionListener,tr as useGoBackwardCallback,or as useGoForwardCallback,rr as useGoToCallback,Rt as useHasCell,so as useHasCellListener,ht as useHasRow,to as useHasRowListener,pt as useHasTable,yt as useHasTableCell,Yt as useHasTableCellListener,Nt as useHasTableListener,lt as useHasTables,Gt as useHasTablesListener,St as useHasValue,lo as useHasValueListener,ft as useHasValues,uo as useHasValuesListener,ko as useIndexIds,Pe as useIndexes,fe as useIndexesIds,xe as useIndexesOrIndexesById,Bo as useLinkedRowIds,Eo as useLinkedRowIdsListener,So as useLocalRowIds,Lo as useLocalRowIdsListener,mo as useMetric,yo as useMetricIds,Co as useMetricListener,ve as useMetrics,ke as useMetricsIds,Re as useMetricsOrMetricsById,Qe as usePersister,He as usePersisterIds,We as usePersisterOrPersisterById,cr as usePersisterStatus,lr as usePersisterStatusListener,De as useProvideCheckpoints,Se as useProvideIndexes,qe as useProvideMetrics,_e as useProvidePersister,Me as useProvideQueries,Ee as useProvideRelationships,he as useProvideStore,Ne as useProvideSynchronizer,ze as useQueries,Fe as useQueriesIds,Ae as useQueriesOrQueriesById,zo as useQueryIds,nr as useRedoInformation,Po as useRelationshipIds,Te as useRelationships,Be as useRelationshipsIds,Le as useRelationshipsOrRelationshipsById,xo as useRemoteRowId,To as useRemoteRowIdListener,Qo as useResultCell,Ho as useResultCellIds,Uo as useResultCellIdsListener,Xo as useResultCellListener,Do as useResultRow,Oo as useResultRowCount,Go as useResultRowCountListener,Vo as useResultRowIds,Jo as useResultRowIdsListener,No as useResultRowListener,jo as useResultSortedRowIds,Ko as useResultSortedRowIdsListener,Ao as useResultTable,Mo as useResultTableCellIds,_o as useResultTableCellIdsListener,Wo as useResultTableListener,kt as useRow,mt as useRowCount,Zt as useRowCountListener,Ct as useRowIds,$t as useRowIdsListener,oo as useRowListener,At as useSetCellCallback,er as useSetCheckpointCallback,zt as useSetPartialRowCallback,Ot as useSetPartialValuesCallback,Et as useSetRowCallback,Lt as useSetTableCallback,Tt as useSetTablesCallback,Vt as useSetValueCallback,Mt as useSetValuesCallback,ho as useSliceIds,Ro as useSliceIdsListener,vo as useSliceRowIds,qo as useSliceRowIdsListener,wt as useSortedRowIds,eo as useSortedRowIdsListener,ao as useStartTransactionListener,Ce as useStore,me as useStoreIds,we as useStoreOrStoreById,Je as useSynchronizer,Ge as useSynchronizerIds,Ke as useSynchronizerOrSynchronizerById,ar as useSynchronizerStatus,pr as useSynchronizerStatusListener,gt as useTable,bt as useTableCellIds,Xt as useTableCellIdsListener,at as useTableIds,Kt as useTableIdsListener,Ut as useTableListener,It as useTables,Jt as useTablesListener,sr as useUndoInformation,Bt as useValue,xt as useValueIds,co as useValueIdsListener,Io as useValueListener,Pt as useValues,io as useValuesListener,po as useWillFinishTransactionListener};
Binary file
@@ -1 +1 @@
1
- import e from"react";const t=e=>typeof e,o="",s=t(o),r=t(t),n="Listener",d="Result",i="Has",c="Ids",u="Table",a=u+"s",l=u+c,I="Row",p=I+"Count",g=I+c,b="Sorted"+I+c,y="Cell",C=y+c,m="Value",h=m+"s",k=m+c,w="Status",R=globalThis,v=e=>null==e,S=(e,t,o)=>v(e)?o?.():t(e),f=e=>t(e)==s,P=e=>t(e)==r,x=e=>e.length,q=()=>{},L=(e,t)=>e.every(t),B=(e,t)=>x(e)===x(t)&&L(e,((e,o)=>t[o]===e)),M=(e,t)=>e.map(t),T=(e,t,o)=>e.with(t,o),E=Object,z=e=>E.getPrototypeOf(e),F=E.entries,Q=e=>!v(e)&&S(z(e),(e=>e==E.prototype||v(z(e))),(()=>!0)),V=E.keys,A=(e,t)=>S(e,(e=>e[t])),O=(e,t)=>t in e,j=(e,t)=>{const o=F(e);return x(o)===x(V(t))&&L(o,(([e,o])=>Q(o)?!!Q(t[e])&&j(t[e],o):t[e]===o))},{createContext:D,useContext:H,useEffect:W}=e;var _=(e=>(e[e.Store=0]="Store",e[e.Metrics=1]="Metrics",e[e.Indexes=2]="Indexes",e[e.Relationships=3]="Relationships",e[e.Queries=4]="Queries",e[e.Checkpoints=5]="Checkpoints",e[e.Persister=6]="Persister",e[e.Synchronizer=7]="Synchronizer",e))(_||{});const G=(N=()=>D([]),O(J=R,K="tinybase_uirc")||(J[K]=N()),J[K]);var J,K,N;const U=(e,t)=>{const o=H(G);return v(e)?o[2*t]:f(e)?A(o[2*t+1]??{},e):e},X=(e,t)=>{const o=U(e,t);return v(e)||f(e)?o:e},Y=(e,t,o)=>{const{16:s,17:r}=H(G);W((()=>(s?.(o,e,t),()=>r?.(o,e))),[s,e,t,o,r])},Z=e=>V(H(G)[2*e+1]??{}),$=()=>Z(0),ee=e=>U(e,0),te=e=>X(e,0),oe=(e,t)=>Y(e,t,0),se=()=>Z(1),re=e=>U(e,1),ne=e=>X(e,1),de=(e,t)=>Y(e,t,1),ie=()=>Z(2),ce=e=>U(e,2),ue=e=>X(e,2),ae=(e,t)=>Y(e,t,2),le=()=>Z(3),Ie=e=>U(e,3),pe=e=>X(e,3),ge=(e,t)=>Y(e,t,3),be=()=>Z(4),ye=e=>U(e,4),Ce=e=>X(e,4),me=(e,t)=>Y(e,t,4),he=()=>Z(5),ke=e=>U(e,5),we=e=>X(e,5),Re=(e,t)=>Y(e,t,5),ve=()=>Z(6),Se=e=>U(e,6),fe=e=>X(e,6),Pe=(e,t)=>Y(e,t,6),xe=()=>Z(7),qe=e=>U(e,7),Le=e=>X(e,7),Be=(e,t)=>Y(e,t,7),Me=e=>e.toLowerCase();Me(n);const Te="Transaction";Me(Te);const{useCallback:Ee,useEffect:ze,useMemo:Fe,useLayoutEffect:Qe,useRef:Ve,useState:Ae,useSyncExternalStore:Oe}=e,je=[],De=[{},[],[je,void 0,je],void 0,!1,0],He=[j,B,([e,t,o],[s,r,n])=>t===r&&B(e,s)&&B(o,n)],We=(e,t)=>e===t,_e=(e,t,o=je)=>{const[,s]=Ae(),[r,n]=Ae();return ze((()=>{const o=e?t(e):void 0;return n(o),s([]),o?.destroy}),[e,...o]),r},Ge=(e,t,...o)=>{const s=e?.["add"+t+n]?.(...o);return()=>e?.delListener(s)},Je=(e,t,s,r=je)=>{const n=Ve(De[s]),d=Ee((()=>{const o=t?.[(4==s?"has":"get")+e]?.(...r)??De[s];return(He[s]??We)(o,n.current)?n.current:n.current=o}),[t,s,e,...r]),c=Ee((n=>Ge(t,(4==s?i:o)+e,...r,n)),[t,s,e,...r]);return Oe(c,d,d)},Ke=(e,t,o,s=je,r=je,...n)=>Qe((()=>Ge(t,e,...r,o,...n)),[t,e,...r,...s,...n]),Ne=(e,t,o,s=je,r=q,n=je,...d)=>{const i=te(e);return Ee((e=>S(i,(s=>S(o(e,s),(o=>r(s["set"+t](...Ue(d,s,e),o),o)))))),[i,t,...s,...n,...Xe(d)])},Ue=(e,t,o)=>M(e,(e=>P(e)?e(o,t):e)),Xe=e=>{return t=e=>!P(e),e.filter(t);var t},Ye=(e,t,o=q,s=je,...r)=>{const n=te(e);return Ee((e=>o(n?.["del"+t](...Ue(r,n,e)))),[n,t,...s,...Xe(r)])},Ze=(e,t,o)=>{const s=we(e);return Ee((()=>s?.[t](o)),[s,t,o])},$e=(e,t=je)=>Fe(e,t),et=(e,t=je)=>Fe(e,t),tt=e=>Je(a,te(e),4,[]),ot=e=>Je(a,te(e),0),st=e=>Je(l,te(e),1),rt=(e,t)=>Je(u,te(t),4,[e]),nt=(e,t)=>Je(u,te(t),0,[e]),dt=(e,t)=>Je(u+C,te(t),1,[e]),it=(e,t,o)=>Je(u+y,te(o),4,[e,t]),ct=(e,t)=>Je(p,te(t),5,[e]),ut=(e,t)=>Je(g,te(t),1,[e]),at=(e,t,o,s=0,r,n)=>Je(b,te(n),1,[e,t,o,s,r]),lt=(e,t,o)=>Je(I,te(o),4,[e,t]),It=(e,t,o)=>Je(I,te(o),0,[e,t]),pt=(e,t,o)=>Je(C,te(o),1,[e,t]),gt=(e,t,o,s)=>Je(y,te(s),4,[e,t,o]),bt=(e,t,o,s)=>Je(y,te(s),3,[e,t,o]),yt=e=>Je(h,te(e),4,[]),Ct=e=>Je(h,te(e),0),mt=e=>Je(k,te(e),1),ht=(e,t)=>Je(m,te(t),4,[e]),kt=(e,t)=>Je(m,te(t),3,[e]),wt=(e,t,o,s,r)=>Ne(o,a,e,t,s,r),Rt=(e,t,o,s,r,n)=>Ne(s,u,t,o,r,n,e),vt=(e,t,o,s,r,n,d)=>Ne(r,I,o,s,n,d,e,t),St=(e,t,o=je,s,r=q,n=je,d=!0)=>{const i=te(s);return Ee((o=>S(i,(s=>S(t(o,s),(t=>r(s.addRow(P(e)?e(o,s):e,t,d),s,t)))))),[i,e,...o,...n,d])},ft=(e,t,o,s,r,n,d)=>Ne(r,"PartialRow",o,s,n,d,e,t),Pt=(e,t,o,s,r,n,d,i)=>Ne(n,y,s,r,d,i,e,t,o),xt=(e,t,o,s,r)=>Ne(o,h,e,t,s,r),qt=(e,t,o,s,r)=>Ne(o,"PartialValues",e,t,s,r),Lt=(e,t,o,s,r,n)=>Ne(s,m,t,o,r,n,e),Bt=(e,t,o)=>Ye(e,a,t,o),Mt=(e,t,o,s)=>Ye(t,u,o,s,e),Tt=(e,t,o,s,r)=>Ye(o,I,s,r,e,t),Et=(e,t,o,s,r,n,d)=>Ye(r,y,n,d,e,t,o,s),zt=(e,t,o)=>Ye(e,h,t,o),Ft=(e,t,o,s)=>Ye(t,m,o,s,e),Qt=(e,t,o,s)=>Ke(i+a,te(s),e,t,[],o),Vt=(e,t,o,s)=>Ke(a,te(s),e,t,je,o),At=(e,t,o,s)=>Ke(l,te(s),e,t,je,o),Ot=(e,t,o,s,r)=>Ke(i+u,te(r),t,o,[e],s),jt=(e,t,o,s,r)=>Ke(u,te(r),t,o,[e],s),Dt=(e,t,o,s,r)=>Ke(u+C,te(r),t,o,[e],s),Ht=(e,t,o,s,r,n)=>Ke(i+u+y,te(n),o,s,[e,t],r),Wt=(e,t,o,s,r)=>Ke(p,te(r),t,o,[e],s),_t=(e,t,o,s,r)=>Ke(g,te(r),t,o,[e],s),Gt=(e,t,o,s,r,n,d,i,c)=>Ke(b,te(c),n,d,[e,t,o,s,r],i),Jt=(e,t,o,s,r,n)=>Ke(i+I,te(n),o,s,[e,t],r),Kt=(e,t,o,s,r,n)=>Ke(I,te(n),o,s,[e,t],r),Nt=(e,t,o,s,r,n)=>Ke(C,te(n),o,s,[e,t],r),Ut=(e,t,o,s,r,n,d)=>Ke(i+y,te(d),s,r,[e,t,o],n),Xt=(e,t,o,s,r,n,d)=>Ke(y,te(d),s,r,[e,t,o],n),Yt=(e,t,o,s)=>Ke(i+h,te(s),e,t,[],o),Zt=(e,t,o,s)=>Ke(h,te(s),e,t,je,o),$t=(e,t,o,s)=>Ke(k,te(s),e,t,je,o),eo=(e,t,o,s,r)=>Ke(i+m,te(r),t,o,[e],s),to=(e,t,o,s,r)=>Ke(m,te(r),t,o,[e],s),oo=(e,t,o)=>Ke("Start"+Te,te(o),e,t),so=(e,t,o)=>Ke("WillFinish"+Te,te(o),e,t),ro=(e,t,o)=>Ke("DidFinish"+Te,te(o),e,t),no=(e,t,o)=>_e(e,t,o),io=e=>Je("MetricIds",ne(e),1),co=(e,t)=>Je("Metric",ne(t),3,[e]),uo=(e,t,o,s)=>Ke("Metric",ne(s),t,o,[e]),ao=(e,t,o)=>_e(e,t,o),lo=(e,t)=>Je("SliceIds",ue(t),1,[e]),Io=e=>Je("IndexIds",ue(e),1),po=(e,t,o)=>Je("Slice"+g,ue(o),1,[e,t]),go=(e,t,o,s)=>Ke("SliceIds",ue(s),t,o,[e]),bo=(e,t,o,s,r)=>Ke("Slice"+g,ue(r),o,s,[e,t]),yo=(e,t,o)=>_e(e,t,o),Co=e=>Je("RelationshipIds",pe(e),1),mo=(e,t,o)=>Je("RemoteRowId",pe(o),3,[e,t]),ho=(e,t,o)=>Je("Local"+g,pe(o),1,[e,t]),ko=(e,t,o)=>Je("Linked"+g,pe(o),1,[e,t]),wo=(e,t,o,s,r)=>Ke("RemoteRowId",pe(r),o,s,[e,t]),Ro=(e,t,o,s,r)=>Ke("Local"+g,pe(r),o,s,[e,t]),vo=(e,t,o,s,r)=>Ke("Linked"+g,pe(r),o,s,[e,t]),So=(e,t,o)=>_e(e,t,o),fo=e=>Je("QueryIds",Ce(e),1),Po=(e,t)=>Je(d+u,Ce(t),0,[e]),xo=(e,t)=>Je(d+u+C,Ce(t),1,[e]),qo=(e,t)=>Je(d+p,Ce(t),5,[e]),Lo=(e,t)=>Je(d+g,Ce(t),1,[e]),Bo=(e,t,o,s=0,r,n)=>Je(d+b,Ce(n),1,[e,t,o,s,r]),Mo=(e,t,o)=>Je(d+I,Ce(o),0,[e,t]),To=(e,t,o)=>Je(d+C,Ce(o),1,[e,t]),Eo=(e,t,o,s)=>Je(d+y,Ce(s),3,[e,t,o]),zo=(e,t,o,s)=>Ke(d+u,Ce(s),t,o,[e]),Fo=(e,t,o,s)=>Ke(d+u+C,Ce(s),t,o,[e]),Qo=(e,t,o,s)=>Ke(d+p,Ce(s),t,o,[e]),Vo=(e,t,o,s)=>Ke(d+g,Ce(s),t,o,[e]),Ao=(e,t,o,s,r,n,i,c)=>Ke(d+b,Ce(c),n,i,[e,t,o,s,r]),Oo=(e,t,o,s,r)=>Ke(d+I,Ce(r),o,s,[e,t]),jo=(e,t,o,s,r)=>Ke(d+C,Ce(r),o,s,[e,t]),Do=(e,t,o,s,r,n)=>Ke(d+y,Ce(n),s,r,[e,t,o]),Ho=(e,t,o)=>_e(e,t,o),Wo=e=>Je("CheckpointIds",we(e),2),_o=(e,t)=>Je("Checkpoint",we(t),3,[e]),Go=(e=q,t=je,o,s=q,r=je)=>{const n=we(o);return Ee((t=>S(n,(o=>{const r=e(t);s(o.addCheckpoint(r),o,r)}))),[n,...t,...r])},Jo=e=>Ze(e,"goBackward"),Ko=e=>Ze(e,"goForward"),No=(e,t=je,o,s=q,r=je)=>{const n=we(o);return Ee((t=>S(n,(o=>S(e(t),(e=>s(o.goTo(e),e)))))),[n,...t,...r])},Uo=e=>{const t=we(e),[s,r]=Wo(t);return[(n=s,!(0==x(n))),Jo(t),r,S(r,(e=>t?.getCheckpoint(e)))??o];var n},Xo=e=>{const t=we(e),[,,[s]]=Wo(t);return[!v(s),Ko(t),s,S(s,(e=>t?.getCheckpoint(e)))??o]},Yo=(e,t,o)=>Ke("CheckpointIds",we(o),e,t),Zo=(e,t,o,s)=>Ke("Checkpoint",we(s),t,o,[e]),$o=(e,t,o=je,s,r=je,n,d=je)=>{const[,i]=Ae(),[c,u]=Ae();return ze((()=>{(async()=>{const o=e?await t(e):void 0;u(o),o&&s&&(async()=>{await s(o),i([])})()})()}),[e,...o,...r]),ze((()=>()=>{c&&(c.destroy(),n?.(c))}),[c,...d]),c},es=e=>Je(w,fe(e),5,[]),ts=(e,t,o)=>Ke(w,fe(o),e,t,[]),os=(e,t,o=je,s,r=je)=>{const[n,d]=Ae();return ze((()=>{(async()=>{const o=e?await t(e):void 0;d(o)})()}),[e,...o]),ze((()=>()=>{n&&(n.destroy(),s?.(n))}),[n,...r]),n},ss=e=>Je(w,Le(e),5,[]),rs=(e,t,o)=>Ke(w,Le(o),e,t,[]),{PureComponent:ns,Fragment:ds,createElement:is,useCallback:cs,useLayoutEffect:us,useRef:as,useState:ls}=e,Is=(e,...t)=>v(e)?{}:e(...t),ps=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],{useCallback:gs,useContext:bs,useMemo:ys,useState:Cs}=e,ms=(e,t,o,s,r)=>[o??t[2*e],{...t[2*e+1],...s,...r[e]}],hs=({tableId:e,store:t,rowComponent:o=Ps,getRowComponentProps:s,customCellIds:r,separator:n,debugIds:d},i)=>Ss(M(i,(n=>is(o,{...Is(s,n),key:n,tableId:e,rowId:n,customCellIds:r,store:t,debugIds:d}))),n,d,e),ks=({queryId:e,queries:t,resultRowComponent:o=Os,getResultRowComponentProps:s,separator:r,debugIds:n},d)=>Ss(M(d,(r=>is(o,{...Is(s,r),key:r,queryId:e,rowId:r,queries:t,debugIds:n}))),r,n,e),ws=({relationshipId:e,relationships:t,rowComponent:o=Ps,getRowComponentProps:s,separator:r,debugIds:n},d,i)=>{const[c,u,a]=ps(pe(t),e),l=d(e,i,c);return Ss(M(l,(e=>is(o,{...Is(s,e),key:e,tableId:a,rowId:e,store:u,debugIds:n}))),r,n,i)},Rs=e=>({checkpoints:t,checkpointComponent:o=Hs,getCheckpointComponentProps:s,separator:r,debugIds:n})=>{const d=we(t);return Ss(M(e(Wo(d)),(e=>is(o,{...Is(s,e),key:e,checkpoints:d,checkpointId:e,debugIds:n}))),r)},vs=({store:e,storesById:t,metrics:o,metricsById:s,indexes:r,indexesById:n,relationships:d,relationshipsById:i,queries:c,queriesById:u,checkpoints:a,checkpointsById:l,persister:I,persistersById:p,synchronizer:g,synchronizersById:b,children:y})=>{const C=bs(G),[m,h]=Cs((()=>M([,,,,,,,,].fill(0),((e,t)=>({}))))),k=gs(((e,t,o)=>h((s=>A(s[e],t)==o?s:T(s,e,{...s[e],[t]:o})))),[]),w=gs(((e,t)=>h((o=>O(o[e],t)?T(o,e,((e,t)=>(delete e[t],e))(o[e],t)):o))),[]);return is(G.Provider,{value:ys((()=>[...ms(_.Store,C,e,t,m),...ms(_.Metrics,C,o,s,m),...ms(_.Indexes,C,r,n,m),...ms(_.Relationships,C,d,i,m),...ms(_.Queries,C,c,u,m),...ms(_.Checkpoints,C,a,l,m),...ms(_.Persister,C,I,p,m),...ms(_.Synchronizer,C,g,b,m),k,w]),[m,e,t,o,s,r,n,d,i,c,u,a,l,I,p,g,b,C,k,w])},y)},Ss=(e,t,o,s)=>{const r=v(t)||!Array.isArray(e)?e:M(e,((e,o)=>o>0?[t,e]:e));return o?[s,":{",r,"}"]:r},fs=({tableId:e,rowId:t,cellId:s,store:r,debugIds:n})=>Ss(o+(bt(e,t,s,r)??o),void 0,n,s),Ps=({tableId:e,rowId:t,store:o,cellComponent:s=fs,getCellComponentProps:r,customCellIds:n,separator:d,debugIds:i})=>Ss(M(((e,t,o,s)=>{const r=pt(t,o,s);return e??r})(n,e,t,o),(n=>is(s,{...Is(r,n),key:n,tableId:e,rowId:t,cellId:n,store:o,debugIds:i}))),d,i,t),xs=e=>hs(e,ut(e.tableId,e.store)),qs=({cellId:e,descending:t,offset:o,limit:s,...r})=>hs(r,at(r.tableId,e,t,o,s,r.store)),Ls=({store:e,tableComponent:t=xs,getTableComponentProps:o,separator:s,debugIds:r})=>Ss(M(st(e),(s=>is(t,{...Is(o,s),key:s,tableId:s,store:e,debugIds:r}))),s),Bs=({valueId:e,store:t,debugIds:s})=>Ss(o+(kt(e,t)??o),void 0,s,e),Ms=({store:e,valueComponent:t=Bs,getValueComponentProps:o,separator:s,debugIds:r})=>Ss(M(mt(e),(s=>is(t,{...Is(o,s),key:s,valueId:s,store:e,debugIds:r}))),s),Ts=({metricId:e,metrics:t,debugIds:s})=>Ss(co(e,t)??o,void 0,s,e),Es=({indexId:e,sliceId:t,indexes:o,rowComponent:s=Ps,getRowComponentProps:r,separator:n,debugIds:d})=>{const[i,c,u]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(ue(o),e),a=po(e,t,i);return Ss(M(a,(e=>is(s,{...Is(r,e),key:e,tableId:u,rowId:e,store:c,debugIds:d}))),n,d,t)},zs=({indexId:e,indexes:t,sliceComponent:o=Es,getSliceComponentProps:s,separator:r,debugIds:n})=>Ss(M(lo(e,t),(r=>is(o,{...Is(s,r),key:r,indexId:e,sliceId:r,indexes:t,debugIds:n}))),r,n,e),Fs=({relationshipId:e,localRowId:t,relationships:o,rowComponent:s=Ps,getRowComponentProps:r,debugIds:n})=>{const[d,i,,c]=ps(pe(o),e),u=mo(e,t,d);return Ss(v(c)||v(u)?null:is(s,{...Is(r,u),key:u,tableId:c,rowId:u,store:i,debugIds:n}),void 0,n,t)},Qs=e=>ws(e,ho,e.remoteRowId),Vs=e=>ws(e,ko,e.firstRowId),As=({queryId:e,rowId:t,cellId:s,queries:r,debugIds:n})=>Ss(o+(Eo(e,t,s,r)??o),void 0,n,s),Os=({queryId:e,rowId:t,queries:o,resultCellComponent:s=As,getResultCellComponentProps:r,separator:n,debugIds:d})=>Ss(M(To(e,t,o),(n=>is(s,{...Is(r,n),key:n,queryId:e,rowId:t,cellId:n,queries:o,debugIds:d}))),n,d,t),js=e=>ks(e,Lo(e.queryId,e.queries)),Ds=({cellId:e,descending:t,offset:o,limit:s,...r})=>ks(r,Bo(r.queryId,e,t,o,s,r.queries)),Hs=({checkpoints:e,checkpointId:t,debugIds:s})=>Ss(_o(t,e)??o,void 0,s,t),Ws=Rs((e=>e[0])),_s=Rs((e=>v(e[1])?[]:[e[1]])),Gs=Rs((e=>e[2]));export{Ws as BackwardCheckpointsView,fs as CellView,Hs as CheckpointView,_s as CurrentCheckpointView,Gs as ForwardCheckpointsView,zs as IndexView,Vs as LinkedRowsView,Qs as LocalRowsView,Ts as MetricView,vs as Provider,Fs as RemoteRowView,As as ResultCellView,Os as ResultRowView,Ds as ResultSortedTableView,js as ResultTableView,Ps as RowView,Es as SliceView,qs as SortedTableView,xs as TableView,Ls as TablesView,Bs as ValueView,Ms as ValuesView,St as useAddRowCallback,bt as useCell,pt as useCellIds,Nt as useCellIdsListener,Xt as useCellListener,_o as useCheckpoint,Wo as useCheckpointIds,Yo as useCheckpointIdsListener,Zo as useCheckpointListener,ke as useCheckpoints,he as useCheckpointsIds,we as useCheckpointsOrCheckpointsById,Ho as useCreateCheckpoints,ao as useCreateIndexes,et as useCreateMergeableStore,no as useCreateMetrics,$o as useCreatePersister,So as useCreateQueries,yo as useCreateRelationships,$e as useCreateStore,os as useCreateSynchronizer,Et as useDelCellCallback,Tt as useDelRowCallback,Mt as useDelTableCallback,Bt as useDelTablesCallback,Ft as useDelValueCallback,zt as useDelValuesCallback,ro as useDidFinishTransactionListener,Jo as useGoBackwardCallback,Ko as useGoForwardCallback,No as useGoToCallback,gt as useHasCell,Ut as useHasCellListener,lt as useHasRow,Jt as useHasRowListener,rt as useHasTable,it as useHasTableCell,Ht as useHasTableCellListener,Ot as useHasTableListener,tt as useHasTables,Qt as useHasTablesListener,ht as useHasValue,eo as useHasValueListener,yt as useHasValues,Yt as useHasValuesListener,Io as useIndexIds,ce as useIndexes,ie as useIndexesIds,ue as useIndexesOrIndexesById,ko as useLinkedRowIds,vo as useLinkedRowIdsListener,ho as useLocalRowIds,Ro as useLocalRowIdsListener,co as useMetric,io as useMetricIds,uo as useMetricListener,re as useMetrics,se as useMetricsIds,ne as useMetricsOrMetricsById,Se as usePersister,ve as usePersisterIds,fe as usePersisterOrPersisterById,es as usePersisterStatus,ts as usePersisterStatusListener,Re as useProvideCheckpoints,ae as useProvideIndexes,de as useProvideMetrics,Pe as useProvidePersister,me as useProvideQueries,ge as useProvideRelationships,oe as useProvideStore,Be as useProvideSynchronizer,ye as useQueries,be as useQueriesIds,Ce as useQueriesOrQueriesById,fo as useQueryIds,Xo as useRedoInformation,Co as useRelationshipIds,Ie as useRelationships,le as useRelationshipsIds,pe as useRelationshipsOrRelationshipsById,mo as useRemoteRowId,wo as useRemoteRowIdListener,Eo as useResultCell,To as useResultCellIds,jo as useResultCellIdsListener,Do as useResultCellListener,Mo as useResultRow,qo as useResultRowCount,Qo as useResultRowCountListener,Lo as useResultRowIds,Vo as useResultRowIdsListener,Oo as useResultRowListener,Bo as useResultSortedRowIds,Ao as useResultSortedRowIdsListener,Po as useResultTable,xo as useResultTableCellIds,Fo as useResultTableCellIdsListener,zo as useResultTableListener,It as useRow,ct as useRowCount,Wt as useRowCountListener,ut as useRowIds,_t as useRowIdsListener,Kt as useRowListener,Pt as useSetCellCallback,Go as useSetCheckpointCallback,ft as useSetPartialRowCallback,qt as useSetPartialValuesCallback,vt as useSetRowCallback,Rt as useSetTableCallback,wt as useSetTablesCallback,Lt as useSetValueCallback,xt as useSetValuesCallback,lo as useSliceIds,go as useSliceIdsListener,po as useSliceRowIds,bo as useSliceRowIdsListener,at as useSortedRowIds,Gt as useSortedRowIdsListener,oo as useStartTransactionListener,ee as useStore,$ as useStoreIds,te as useStoreOrStoreById,qe as useSynchronizer,xe as useSynchronizerIds,Le as useSynchronizerOrSynchronizerById,ss as useSynchronizerStatus,rs as useSynchronizerStatusListener,nt as useTable,dt as useTableCellIds,Dt as useTableCellIdsListener,st as useTableIds,At as useTableIdsListener,jt as useTableListener,ot as useTables,Vt as useTablesListener,Uo as useUndoInformation,kt as useValue,mt as useValueIds,$t as useValueIdsListener,to as useValueListener,Ct as useValues,Zt as useValuesListener,so as useWillFinishTransactionListener};
1
+ import e from"react";const t=e=>typeof e,o="",r=t(o),s=t(t),n="Result",d="Has",u="Ids",i="Table",c=i+"s",l=i+u,I="Row",a=I+"Count",p=I+u,g="Sorted"+I+u,b="Cell",y=b+u,m="Value",C=m+"s",w=m+u,h="Transaction",k="Partial",v="Finish",R="Status",q="Metric",f="Slice",P="RemoteRowId",x="Local",S="Linked",B="Checkpoint",T=globalThis,L=e=>null==e,E=(e,t,o)=>L(e)?o?.():t(e),F=e=>t(e)==r,z=e=>t(e)==s,A=e=>e.length,M=()=>{},O=(e,t)=>e.every(t),V=(e,t)=>A(e)===A(t)&&O(e,((e,o)=>t[o]===e)),j=(e,t)=>e.map(t),D=(e,t,o)=>e.with(t,o),{PureComponent:H,Fragment:Q,createContext:W,createElement:_,useCallback:G,useContext:J,useEffect:K,useLayoutEffect:N,useMemo:U,useRef:X,useState:Y,useSyncExternalStore:Z}=e,$=(e,...t)=>L(e)?{}:e(...t),ee=(e,t)=>[e,e?.getStore(),e?.getLocalTableId(t),e?.getRemoteTableId(t)],te=Object,oe=e=>te.getPrototypeOf(e),re=te.entries,se=e=>!L(e)&&E(oe(e),(e=>e==te.prototype||L(oe(e))),(()=>!0)),ne=te.keys,de=(e,t)=>E(e,(e=>e[t])),ue=(e,t)=>t in e,ie=(e,t)=>{const o=re(e);return A(o)===A(ne(t))&&O(o,(([e,o])=>se(o)?!!se(t[e])&&ie(t[e],o):t[e]===o))},ce=(ae=()=>W([]),ue(le=T,Ie="tinybase_uirc")||(le[Ie]=ae()),le[Ie]);var le,Ie,ae;const pe=(e,t)=>{const o=J(ce);return L(e)?o[2*t]:F(e)?de(o[2*t+1]??{},e):e},ge=(e,t)=>{const o=pe(e,t);return L(e)||F(e)?o:e},be=(e,t,o)=>{const{16:r,17:s}=J(ce);K((()=>(r?.(o,e,t),()=>s?.(o,e))),[r,e,t,o,s])},ye=e=>ne(J(ce)[2*e+1]??{}),me=()=>ye(0),Ce=e=>pe(e,0),we=e=>ge(e,0),he=(e,t)=>be(e,t,0),ke=()=>ye(1),ve=e=>pe(e,1),Re=e=>ge(e,1),qe=(e,t)=>be(e,t,1),fe=()=>ye(2),Pe=e=>pe(e,2),xe=e=>ge(e,2),Se=(e,t)=>be(e,t,2),Be=()=>ye(3),Te=e=>pe(e,3),Le=e=>ge(e,3),Ee=(e,t)=>be(e,t,3),Fe=()=>ye(4),ze=e=>pe(e,4),Ae=e=>ge(e,4),Me=(e,t)=>be(e,t,4),Oe=()=>ye(5),Ve=e=>pe(e,5),je=e=>ge(e,5),De=(e,t)=>be(e,t,5),He=()=>ye(6),Qe=e=>pe(e,6),We=e=>ge(e,6),_e=(e,t)=>be(e,t,6),Ge=()=>ye(7),Je=e=>pe(e,7),Ke=e=>ge(e,7),Ne=(e,t)=>be(e,t,7),Ue=[],Xe=[{},[],[Ue,void 0,Ue],void 0,!1,0],Ye=[ie,V,([e,t,o],[r,s,n])=>t===s&&V(e,r)&&V(o,n)],Ze=(e,t)=>e===t,$e=(e,t,o=Ue)=>{const[,r]=Y(),[s,n]=Y();return K((()=>{const o=e?t(e):void 0;return n(o),r([]),o?.destroy}),[e,...o]),s},et=(e,t,...o)=>{const r=e?.["add"+t+"Listener"]?.(...o);return()=>e?.delListener(r)},tt=(e,t,r,s=Ue)=>{const n=X(Xe[r]),u=G((()=>{const o=t?.[(4==r?"has":"get")+e]?.(...s)??Xe[r];return(Ye[r]??Ze)(o,n.current)?n.current:n.current=o}),[t,r,e,...s]),i=G((n=>et(t,(4==r?d:o)+e,...s,n)),[t,r,e,...s]);return Z(i,u,u)},ot=(e,t,o,r=Ue,s=Ue,...n)=>N((()=>et(t,e,...s,o,...n)),[t,e,...s,...r,...n]),rt=(e,t,o,r=Ue,s=M,n=Ue,...d)=>{const u=we(e);return G((e=>E(u,(r=>E(o(e,r),(o=>s(r["set"+t](...st(d,r,e),o),o)))))),[u,t,...r,...n,...nt(d)])},st=(e,t,o)=>j(e,(e=>z(e)?e(o,t):e)),nt=e=>{return t=e=>!z(e),e.filter(t);var t},dt=(e,t,o=M,r=Ue,...s)=>{const n=we(e);return G((e=>o(n?.["del"+t](...st(s,n,e)))),[n,t,...r,...nt(s)])},ut=(e,t,o)=>{const r=je(e);return G((()=>r?.[t](o)),[r,t,o])},it=(e,t=Ue)=>U(e,t),ct=(e,t=Ue)=>U(e,t),lt=e=>tt(c,we(e),4,[]),It=e=>tt(c,we(e),0),at=e=>tt(l,we(e),1),pt=(e,t)=>tt(i,we(t),4,[e]),gt=(e,t)=>tt(i,we(t),0,[e]),bt=(e,t)=>tt(i+y,we(t),1,[e]),yt=(e,t,o)=>tt(i+b,we(o),4,[e,t]),mt=(e,t)=>tt(a,we(t),5,[e]),Ct=(e,t)=>tt(p,we(t),1,[e]),wt=(e,t,o,r=0,s,n)=>tt(g,we(n),1,[e,t,o,r,s]),ht=(e,t,o)=>tt(I,we(o),4,[e,t]),kt=(e,t,o)=>tt(I,we(o),0,[e,t]),vt=(e,t,o)=>tt(y,we(o),1,[e,t]),Rt=(e,t,o,r)=>tt(b,we(r),4,[e,t,o]),qt=(e,t,o,r)=>tt(b,we(r),3,[e,t,o]),ft=e=>tt(C,we(e),4,[]),Pt=e=>tt(C,we(e),0),xt=e=>tt(w,we(e),1),St=(e,t)=>tt(m,we(t),4,[e]),Bt=(e,t)=>tt(m,we(t),3,[e]),Tt=(e,t,o,r,s)=>rt(o,c,e,t,r,s),Lt=(e,t,o,r,s,n)=>rt(r,i,t,o,s,n,e),Et=(e,t,o,r,s,n,d)=>rt(s,I,o,r,n,d,e,t),Ft=(e,t,o=Ue,r,s=M,n=Ue,d=!0)=>{const u=we(r);return G((o=>E(u,(r=>E(t(o,r),(t=>s(r.addRow(z(e)?e(o,r):e,t,d),r,t)))))),[u,e,...o,...n,d])},zt=(e,t,o,r,s,n,d)=>rt(s,k+I,o,r,n,d,e,t),At=(e,t,o,r,s,n,d,u)=>rt(n,b,r,s,d,u,e,t,o),Mt=(e,t,o,r,s)=>rt(o,C,e,t,r,s),Ot=(e,t,o,r,s)=>rt(o,k+C,e,t,r,s),Vt=(e,t,o,r,s,n)=>rt(r,m,t,o,s,n,e),jt=(e,t,o)=>dt(e,c,t,o),Dt=(e,t,o,r)=>dt(t,i,o,r,e),Ht=(e,t,o,r,s)=>dt(o,I,r,s,e,t),Qt=(e,t,o,r,s,n,d)=>dt(s,b,n,d,e,t,o,r),Wt=(e,t,o)=>dt(e,C,t,o),_t=(e,t,o,r)=>dt(t,m,o,r,e),Gt=(e,t,o,r)=>ot(d+c,we(r),e,t,[],o),Jt=(e,t,o,r)=>ot(c,we(r),e,t,Ue,o),Kt=(e,t,o,r)=>ot(l,we(r),e,t,Ue,o),Nt=(e,t,o,r,s)=>ot(d+i,we(s),t,o,[e],r),Ut=(e,t,o,r,s)=>ot(i,we(s),t,o,[e],r),Xt=(e,t,o,r,s)=>ot(i+y,we(s),t,o,[e],r),Yt=(e,t,o,r,s,n)=>ot(d+i+b,we(n),o,r,[e,t],s),Zt=(e,t,o,r,s)=>ot(a,we(s),t,o,[e],r),$t=(e,t,o,r,s)=>ot(p,we(s),t,o,[e],r),eo=(e,t,o,r,s,n,d,u,i)=>ot(g,we(i),n,d,[e,t,o,r,s],u),to=(e,t,o,r,s,n)=>ot(d+I,we(n),o,r,[e,t],s),oo=(e,t,o,r,s,n)=>ot(I,we(n),o,r,[e,t],s),ro=(e,t,o,r,s,n)=>ot(y,we(n),o,r,[e,t],s),so=(e,t,o,r,s,n,u)=>ot(d+b,we(u),r,s,[e,t,o],n),no=(e,t,o,r,s,n,d)=>ot(b,we(d),r,s,[e,t,o],n),uo=(e,t,o,r)=>ot(d+C,we(r),e,t,[],o),io=(e,t,o,r)=>ot(C,we(r),e,t,Ue,o),co=(e,t,o,r)=>ot(w,we(r),e,t,Ue,o),lo=(e,t,o,r,s)=>ot(d+m,we(s),t,o,[e],r),Io=(e,t,o,r,s)=>ot(m,we(s),t,o,[e],r),ao=(e,t,o)=>ot("Start"+h,we(o),e,t),po=(e,t,o)=>ot("Will"+v+h,we(o),e,t),go=(e,t,o)=>ot("Did"+v+h,we(o),e,t),bo=(e,t,o)=>$e(e,t,o),yo=e=>tt(q+u,Re(e),1),mo=(e,t)=>tt(q,Re(t),3,[e]),Co=(e,t,o,r)=>ot(q,Re(r),t,o,[e]),wo=(e,t,o)=>$e(e,t,o),ho=(e,t)=>tt(f+u,xe(t),1,[e]),ko=e=>tt("Index"+u,xe(e),1),vo=(e,t,o)=>tt(f+p,xe(o),1,[e,t]),Ro=(e,t,o,r)=>ot(f+u,xe(r),t,o,[e]),qo=(e,t,o,r,s)=>ot(f+p,xe(s),o,r,[e,t]),fo=(e,t,o)=>$e(e,t,o),Po=e=>tt("Relationship"+u,Le(e),1),xo=(e,t,o)=>tt(P,Le(o),3,[e,t]),So=(e,t,o)=>tt(x+p,Le(o),1,[e,t]),Bo=(e,t,o)=>tt(S+p,Le(o),1,[e,t]),To=(e,t,o,r,s)=>ot(P,Le(s),o,r,[e,t]),Lo=(e,t,o,r,s)=>ot(x+p,Le(s),o,r,[e,t]),Eo=(e,t,o,r,s)=>ot(S+p,Le(s),o,r,[e,t]),Fo=(e,t,o)=>$e(e,t,o),zo=e=>tt("Query"+u,Ae(e),1),Ao=(e,t)=>tt(n+i,Ae(t),0,[e]),Mo=(e,t)=>tt(n+i+y,Ae(t),1,[e]),Oo=(e,t)=>tt(n+a,Ae(t),5,[e]),Vo=(e,t)=>tt(n+p,Ae(t),1,[e]),jo=(e,t,o,r=0,s,d)=>tt(n+g,Ae(d),1,[e,t,o,r,s]),Do=(e,t,o)=>tt(n+I,Ae(o),0,[e,t]),Ho=(e,t,o)=>tt(n+y,Ae(o),1,[e,t]),Qo=(e,t,o,r)=>tt(n+b,Ae(r),3,[e,t,o]),Wo=(e,t,o,r)=>ot(n+i,Ae(r),t,o,[e]),_o=(e,t,o,r)=>ot(n+i+y,Ae(r),t,o,[e]),Go=(e,t,o,r)=>ot(n+a,Ae(r),t,o,[e]),Jo=(e,t,o,r)=>ot(n+p,Ae(r),t,o,[e]),Ko=(e,t,o,r,s,d,u,i)=>ot(n+g,Ae(i),d,u,[e,t,o,r,s]),No=(e,t,o,r,s)=>ot(n+I,Ae(s),o,r,[e,t]),Uo=(e,t,o,r,s)=>ot(n+y,Ae(s),o,r,[e,t]),Xo=(e,t,o,r,s,d)=>ot(n+b,Ae(d),r,s,[e,t,o]),Yo=(e,t,o)=>$e(e,t,o),Zo=e=>tt(B+u,je(e),2),$o=(e,t)=>tt(B,je(t),3,[e]),er=(e=M,t=Ue,o,r=M,s=Ue)=>{const n=je(o);return G((t=>E(n,(o=>{const s=e(t);r(o.addCheckpoint(s),o,s)}))),[n,...t,...s])},tr=e=>ut(e,"goBackward"),or=e=>ut(e,"goForward"),rr=(e,t=Ue,o,r=M,s=Ue)=>{const n=je(o);return G((t=>E(n,(o=>E(e(t),(e=>r(o.goTo(e),e)))))),[n,...t,...s])},sr=e=>{const t=je(e),[r,s]=Zo(t);return[(n=r,!(0==A(n))),tr(t),s,E(s,(e=>t?.getCheckpoint(e)))??o];var n},nr=e=>{const t=je(e),[,,[r]]=Zo(t);return[!L(r),or(t),r,E(r,(e=>t?.getCheckpoint(e)))??o]},dr=(e,t,o)=>ot(B+u,je(o),e,t),ur=(e,t,o,r)=>ot(B,je(r),t,o,[e]),ir=(e,t,o=Ue,r,s=Ue,n,d=Ue)=>{const[,u]=Y(),[i,c]=Y();return K((()=>{(async()=>{const o=e?await t(e):void 0;c(o),o&&r&&(async()=>{await r(o),u([])})()})()}),[e,...o,...s]),K((()=>()=>{i&&(i.destroy(),n?.(i))}),[i,...d]),i},cr=e=>tt(R,We(e),5,[]),lr=(e,t,o)=>ot(R,We(o),e,t,[]),Ir=(e,t,o=Ue,r,s=Ue)=>{const[n,d]=Y();return K((()=>{(async()=>{const o=e?await t(e):void 0;d(o)})()}),[e,...o]),K((()=>()=>{n&&(n.destroy(),r?.(n))}),[n,...s]),n},ar=e=>tt(R,Ke(e),5,[]),pr=(e,t,o)=>ot(R,Ke(o),e,t,[]),gr=(e,t,o,r,s)=>[o??t[2*e],{...t[2*e+1],...r,...s[e]}],br=({tableId:e,store:t,rowComponent:o=vr,getRowComponentProps:r,customCellIds:s,separator:n,debugIds:d},u)=>hr(j(u,(n=>_(o,{...$(r,n),key:n,tableId:e,rowId:n,customCellIds:s,store:t,debugIds:d}))),n,d,e),yr=({queryId:e,queries:t,resultRowComponent:o=Ar,getResultRowComponentProps:r,separator:s,debugIds:n},d)=>hr(j(d,(s=>_(o,{...$(r,s),key:s,queryId:e,rowId:s,queries:t,debugIds:n}))),s,n,e),mr=({relationshipId:e,relationships:t,rowComponent:o=vr,getRowComponentProps:r,separator:s,debugIds:n},d,u)=>{const[i,c,l]=ee(Le(t),e),I=d(e,u,i);return hr(j(I,(e=>_(o,{...$(r,e),key:e,tableId:l,rowId:e,store:c,debugIds:n}))),s,n,u)},Cr=e=>({checkpoints:t,checkpointComponent:o=Vr,getCheckpointComponentProps:r,separator:s,debugIds:n})=>{const d=je(t);return hr(j(e(Zo(d)),(e=>_(o,{...$(r,e),key:e,checkpoints:d,checkpointId:e,debugIds:n}))),s)},wr=({store:e,storesById:t,metrics:o,metricsById:r,indexes:s,indexesById:n,relationships:d,relationshipsById:u,queries:i,queriesById:c,checkpoints:l,checkpointsById:I,persister:a,persistersById:p,synchronizer:g,synchronizersById:b,children:y})=>{const m=J(ce),[C,w]=Y((()=>j([,,,,,,,,].fill(0),((e,t)=>({}))))),h=G(((e,t,o)=>w((r=>de(r[e],t)==o?r:D(r,e,{...r[e],[t]:o})))),[]),k=G(((e,t)=>w((o=>ue(o[e],t)?D(o,e,((e,t)=>(delete e[t],e))(o[e],t)):o))),[]);return _(ce.Provider,{value:U((()=>[...gr(0,m,e,t,C),...gr(1,m,o,r,C),...gr(2,m,s,n,C),...gr(3,m,d,u,C),...gr(4,m,i,c,C),...gr(5,m,l,I,C),...gr(6,m,a,p,C),...gr(7,m,g,b,C),h,k]),[C,e,t,o,r,s,n,d,u,i,c,l,I,a,p,g,b,m,h,k])},y)},hr=(e,t,o,r)=>{const s=L(t)||!Array.isArray(e)?e:j(e,((e,o)=>o>0?[t,e]:e));return o?[r,":{",s,"}"]:s},kr=({tableId:e,rowId:t,cellId:r,store:s,debugIds:n})=>hr(o+(qt(e,t,r,s)??o),void 0,n,r),vr=({tableId:e,rowId:t,store:o,cellComponent:r=kr,getCellComponentProps:s,customCellIds:n,separator:d,debugIds:u})=>hr(j(((e,t,o,r)=>{const s=vt(t,o,r);return e??s})(n,e,t,o),(n=>_(r,{...$(s,n),key:n,tableId:e,rowId:t,cellId:n,store:o,debugIds:u}))),d,u,t),Rr=e=>br(e,Ct(e.tableId,e.store)),qr=({cellId:e,descending:t,offset:o,limit:r,...s})=>br(s,wt(s.tableId,e,t,o,r,s.store)),fr=({store:e,tableComponent:t=Rr,getTableComponentProps:o,separator:r,debugIds:s})=>hr(j(at(e),(r=>_(t,{...$(o,r),key:r,tableId:r,store:e,debugIds:s}))),r),Pr=({valueId:e,store:t,debugIds:r})=>hr(o+(Bt(e,t)??o),void 0,r,e),xr=({store:e,valueComponent:t=Pr,getValueComponentProps:o,separator:r,debugIds:s})=>hr(j(xt(e),(r=>_(t,{...$(o,r),key:r,valueId:r,store:e,debugIds:s}))),r),Sr=({metricId:e,metrics:t,debugIds:r})=>hr(mo(e,t)??o,void 0,r,e),Br=({indexId:e,sliceId:t,indexes:o,rowComponent:r=vr,getRowComponentProps:s,separator:n,debugIds:d})=>{const[u,i,c]=((e,t)=>[e,e?.getStore(),e?.getTableId(t)])(xe(o),e),l=vo(e,t,u);return hr(j(l,(e=>_(r,{...$(s,e),key:e,tableId:c,rowId:e,store:i,debugIds:d}))),n,d,t)},Tr=({indexId:e,indexes:t,sliceComponent:o=Br,getSliceComponentProps:r,separator:s,debugIds:n})=>hr(j(ho(e,t),(s=>_(o,{...$(r,s),key:s,indexId:e,sliceId:s,indexes:t,debugIds:n}))),s,n,e),Lr=({relationshipId:e,localRowId:t,relationships:o,rowComponent:r=vr,getRowComponentProps:s,debugIds:n})=>{const[d,u,,i]=ee(Le(o),e),c=xo(e,t,d);return hr(L(i)||L(c)?null:_(r,{...$(s,c),key:c,tableId:i,rowId:c,store:u,debugIds:n}),void 0,n,t)},Er=e=>mr(e,So,e.remoteRowId),Fr=e=>mr(e,Bo,e.firstRowId),zr=({queryId:e,rowId:t,cellId:r,queries:s,debugIds:n})=>hr(o+(Qo(e,t,r,s)??o),void 0,n,r),Ar=({queryId:e,rowId:t,queries:o,resultCellComponent:r=zr,getResultCellComponentProps:s,separator:n,debugIds:d})=>hr(j(Ho(e,t,o),(n=>_(r,{...$(s,n),key:n,queryId:e,rowId:t,cellId:n,queries:o,debugIds:d}))),n,d,t),Mr=e=>yr(e,Vo(e.queryId,e.queries)),Or=({cellId:e,descending:t,offset:o,limit:r,...s})=>yr(s,jo(s.queryId,e,t,o,r,s.queries)),Vr=({checkpoints:e,checkpointId:t,debugIds:r})=>hr($o(t,e)??o,void 0,r,t),jr=Cr((e=>e[0])),Dr=Cr((e=>L(e[1])?[]:[e[1]])),Hr=Cr((e=>e[2]));export{jr as BackwardCheckpointsView,kr as CellView,Vr as CheckpointView,Dr as CurrentCheckpointView,Hr as ForwardCheckpointsView,Tr as IndexView,Fr as LinkedRowsView,Er as LocalRowsView,Sr as MetricView,wr as Provider,Lr as RemoteRowView,zr as ResultCellView,Ar as ResultRowView,Or as ResultSortedTableView,Mr as ResultTableView,vr as RowView,Br as SliceView,qr as SortedTableView,Rr as TableView,fr as TablesView,Pr as ValueView,xr as ValuesView,Ft as useAddRowCallback,qt as useCell,vt as useCellIds,ro as useCellIdsListener,no as useCellListener,$o as useCheckpoint,Zo as useCheckpointIds,dr as useCheckpointIdsListener,ur as useCheckpointListener,Ve as useCheckpoints,Oe as useCheckpointsIds,je as useCheckpointsOrCheckpointsById,Yo as useCreateCheckpoints,wo as useCreateIndexes,ct as useCreateMergeableStore,bo as useCreateMetrics,ir as useCreatePersister,Fo as useCreateQueries,fo as useCreateRelationships,it as useCreateStore,Ir as useCreateSynchronizer,Qt as useDelCellCallback,Ht as useDelRowCallback,Dt as useDelTableCallback,jt as useDelTablesCallback,_t as useDelValueCallback,Wt as useDelValuesCallback,go as useDidFinishTransactionListener,tr as useGoBackwardCallback,or as useGoForwardCallback,rr as useGoToCallback,Rt as useHasCell,so as useHasCellListener,ht as useHasRow,to as useHasRowListener,pt as useHasTable,yt as useHasTableCell,Yt as useHasTableCellListener,Nt as useHasTableListener,lt as useHasTables,Gt as useHasTablesListener,St as useHasValue,lo as useHasValueListener,ft as useHasValues,uo as useHasValuesListener,ko as useIndexIds,Pe as useIndexes,fe as useIndexesIds,xe as useIndexesOrIndexesById,Bo as useLinkedRowIds,Eo as useLinkedRowIdsListener,So as useLocalRowIds,Lo as useLocalRowIdsListener,mo as useMetric,yo as useMetricIds,Co as useMetricListener,ve as useMetrics,ke as useMetricsIds,Re as useMetricsOrMetricsById,Qe as usePersister,He as usePersisterIds,We as usePersisterOrPersisterById,cr as usePersisterStatus,lr as usePersisterStatusListener,De as useProvideCheckpoints,Se as useProvideIndexes,qe as useProvideMetrics,_e as useProvidePersister,Me as useProvideQueries,Ee as useProvideRelationships,he as useProvideStore,Ne as useProvideSynchronizer,ze as useQueries,Fe as useQueriesIds,Ae as useQueriesOrQueriesById,zo as useQueryIds,nr as useRedoInformation,Po as useRelationshipIds,Te as useRelationships,Be as useRelationshipsIds,Le as useRelationshipsOrRelationshipsById,xo as useRemoteRowId,To as useRemoteRowIdListener,Qo as useResultCell,Ho as useResultCellIds,Uo as useResultCellIdsListener,Xo as useResultCellListener,Do as useResultRow,Oo as useResultRowCount,Go as useResultRowCountListener,Vo as useResultRowIds,Jo as useResultRowIdsListener,No as useResultRowListener,jo as useResultSortedRowIds,Ko as useResultSortedRowIdsListener,Ao as useResultTable,Mo as useResultTableCellIds,_o as useResultTableCellIdsListener,Wo as useResultTableListener,kt as useRow,mt as useRowCount,Zt as useRowCountListener,Ct as useRowIds,$t as useRowIdsListener,oo as useRowListener,At as useSetCellCallback,er as useSetCheckpointCallback,zt as useSetPartialRowCallback,Ot as useSetPartialValuesCallback,Et as useSetRowCallback,Lt as useSetTableCallback,Tt as useSetTablesCallback,Vt as useSetValueCallback,Mt as useSetValuesCallback,ho as useSliceIds,Ro as useSliceIdsListener,vo as useSliceRowIds,qo as useSliceRowIdsListener,wt as useSortedRowIds,eo as useSortedRowIdsListener,ao as useStartTransactionListener,Ce as useStore,me as useStoreIds,we as useStoreOrStoreById,Je as useSynchronizer,Ge as useSynchronizerIds,Ke as useSynchronizerOrSynchronizerById,ar as useSynchronizerStatus,pr as useSynchronizerStatusListener,gt as useTable,bt as useTableCellIds,Xt as useTableCellIdsListener,at as useTableIds,Kt as useTableIdsListener,Ut as useTableListener,It as useTables,Jt as useTablesListener,sr as useUndoInformation,Bt as useValue,xt as useValueIds,co as useValueIdsListener,Io as useValueListener,Pt as useValues,io as useValuesListener,po as useWillFinishTransactionListener};