@fluidframework/tree 2.81.0 → 2.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (579) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/api-report/tree.alpha.api.md +54 -22
  3. package/api-report/tree.beta.api.md +150 -1
  4. package/api-report/tree.legacy.beta.api.md +150 -1
  5. package/api-report/tree.legacy.public.api.md +1 -0
  6. package/api-report/tree.public.api.md +1 -0
  7. package/dist/alpha.d.ts +8 -2
  8. package/dist/beta.d.ts +3 -0
  9. package/dist/codec/codec.d.ts +17 -8
  10. package/dist/codec/codec.d.ts.map +1 -1
  11. package/dist/codec/codec.js +8 -1
  12. package/dist/codec/codec.js.map +1 -1
  13. package/dist/codec/index.d.ts +1 -1
  14. package/dist/codec/index.d.ts.map +1 -1
  15. package/dist/codec/index.js +2 -1
  16. package/dist/codec/index.js.map +1 -1
  17. package/dist/codec/versioned/codec.d.ts +1 -1
  18. package/dist/codec/versioned/codec.d.ts.map +1 -1
  19. package/dist/codec/versioned/codec.js.map +1 -1
  20. package/dist/core/index.d.ts +1 -1
  21. package/dist/core/index.d.ts.map +1 -1
  22. package/dist/core/index.js +4 -2
  23. package/dist/core/index.js.map +1 -1
  24. package/dist/core/rebase/changeRebaser.d.ts +3 -2
  25. package/dist/core/rebase/changeRebaser.d.ts.map +1 -1
  26. package/dist/core/rebase/changeRebaser.js.map +1 -1
  27. package/dist/core/rebase/index.d.ts +1 -1
  28. package/dist/core/rebase/index.d.ts.map +1 -1
  29. package/dist/core/rebase/index.js +4 -2
  30. package/dist/core/rebase/index.js.map +1 -1
  31. package/dist/core/rebase/types.d.ts +23 -3
  32. package/dist/core/rebase/types.d.ts.map +1 -1
  33. package/dist/core/rebase/types.js +30 -16
  34. package/dist/core/rebase/types.js.map +1 -1
  35. package/dist/core/schema-stored/formatV1.d.ts +2 -2
  36. package/dist/core/schema-stored/formatV1.d.ts.map +1 -1
  37. package/dist/core/schema-stored/formatV1.js +0 -5
  38. package/dist/core/schema-stored/formatV1.js.map +1 -1
  39. package/dist/core/schema-stored/formatV2.d.ts +11 -10
  40. package/dist/core/schema-stored/formatV2.d.ts.map +1 -1
  41. package/dist/core/schema-stored/formatV2.js +1 -6
  42. package/dist/core/schema-stored/formatV2.js.map +1 -1
  43. package/dist/core/schema-stored/index.d.ts.map +1 -1
  44. package/dist/core/schema-stored/index.js.map +1 -1
  45. package/dist/core/schema-stored/schema.d.ts.map +1 -1
  46. package/dist/core/schema-stored/schema.js.map +1 -1
  47. package/dist/core/tree/anchorSet.d.ts.map +1 -1
  48. package/dist/core/tree/anchorSet.js.map +1 -1
  49. package/dist/core/tree/delta.d.ts +9 -7
  50. package/dist/core/tree/delta.d.ts.map +1 -1
  51. package/dist/core/tree/delta.js.map +1 -1
  52. package/dist/core/tree/deltaUtil.js +1 -1
  53. package/dist/core/tree/deltaUtil.js.map +1 -1
  54. package/dist/core/tree/visitDelta.js +2 -2
  55. package/dist/core/tree/visitDelta.js.map +1 -1
  56. package/dist/extensibleSchemaUnion.d.ts +72 -0
  57. package/dist/extensibleSchemaUnion.d.ts.map +1 -0
  58. package/dist/extensibleSchemaUnion.js +79 -0
  59. package/dist/extensibleSchemaUnion.js.map +1 -0
  60. package/dist/feature-libraries/changeAtomIdBTree.d.ts +4 -2
  61. package/dist/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  62. package/dist/feature-libraries/changeAtomIdBTree.js +9 -1
  63. package/dist/feature-libraries/changeAtomIdBTree.js.map +1 -1
  64. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
  65. package/dist/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  66. package/dist/feature-libraries/default-schema/defaultFieldKinds.js +20 -21
  67. package/dist/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  68. package/dist/feature-libraries/default-schema/index.d.ts +1 -1
  69. package/dist/feature-libraries/default-schema/index.d.ts.map +1 -1
  70. package/dist/feature-libraries/default-schema/index.js.map +1 -1
  71. package/dist/feature-libraries/forest-summary/codec.d.ts +2 -1
  72. package/dist/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  73. package/dist/feature-libraries/forest-summary/codec.js.map +1 -1
  74. package/dist/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  75. package/dist/feature-libraries/forest-summary/forestSummarizer.js +5 -2
  76. package/dist/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  77. package/dist/feature-libraries/forest-summary/formatCommon.d.ts +1 -39
  78. package/dist/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  79. package/dist/feature-libraries/forest-summary/formatCommon.js +1 -2
  80. package/dist/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  81. package/dist/feature-libraries/forest-summary/formatV1.d.ts +1 -39
  82. package/dist/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  83. package/dist/feature-libraries/forest-summary/formatV2.d.ts +1 -39
  84. package/dist/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  85. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  86. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  87. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
  88. package/dist/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  89. package/dist/feature-libraries/index.d.ts +3 -3
  90. package/dist/feature-libraries/index.d.ts.map +1 -1
  91. package/dist/feature-libraries/index.js +4 -3
  92. package/dist/feature-libraries/index.js.map +1 -1
  93. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
  94. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
  95. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js +42 -22
  96. package/dist/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  97. package/dist/feature-libraries/modular-schema/genericFieldKind.js +1 -1
  98. package/dist/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  99. package/dist/feature-libraries/modular-schema/index.d.ts +1 -1
  100. package/dist/feature-libraries/modular-schema/index.d.ts.map +1 -1
  101. package/dist/feature-libraries/modular-schema/index.js +2 -1
  102. package/dist/feature-libraries/modular-schema/index.js.map +1 -1
  103. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
  104. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  105. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js +9 -5
  106. package/dist/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  107. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
  108. package/dist/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  109. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js +30 -7
  110. package/dist/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  111. package/dist/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  112. package/dist/feature-libraries/modular-schema/modularChangeFamily.js +38 -27
  113. package/dist/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  114. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
  115. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  116. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
  117. package/dist/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  118. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
  119. package/dist/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  120. package/dist/feature-libraries/optional-field/optionalField.js +1 -1
  121. package/dist/feature-libraries/optional-field/optionalField.js.map +1 -1
  122. package/dist/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
  123. package/dist/feature-libraries/optional-field/requiredField.js.map +1 -1
  124. package/dist/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  125. package/dist/feature-libraries/schema-index/codec.js.map +1 -1
  126. package/dist/feature-libraries/schema-index/formatV2.d.ts +4 -4
  127. package/dist/feature-libraries/schema-index/schemaSummarizer.js +1 -1
  128. package/dist/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  129. package/dist/feature-libraries/sequence-field/invert.js +2 -2
  130. package/dist/feature-libraries/sequence-field/invert.js.map +1 -1
  131. package/dist/feature-libraries/sequence-field/replaceRevisions.js +16 -16
  132. package/dist/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  133. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
  134. package/dist/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  135. package/dist/index.d.ts +5 -5
  136. package/dist/index.d.ts.map +1 -1
  137. package/dist/index.js +4 -1
  138. package/dist/index.js.map +1 -1
  139. package/dist/legacy.d.ts +3 -0
  140. package/dist/packageVersion.d.ts +1 -1
  141. package/dist/packageVersion.js +1 -1
  142. package/dist/packageVersion.js.map +1 -1
  143. package/dist/shared-tree/independentView.d.ts +36 -13
  144. package/dist/shared-tree/independentView.d.ts.map +1 -1
  145. package/dist/shared-tree/independentView.js +1 -0
  146. package/dist/shared-tree/independentView.js.map +1 -1
  147. package/dist/shared-tree/index.d.ts +1 -1
  148. package/dist/shared-tree/index.d.ts.map +1 -1
  149. package/dist/shared-tree/index.js.map +1 -1
  150. package/dist/shared-tree/schematizingTreeView.d.ts +10 -0
  151. package/dist/shared-tree/schematizingTreeView.d.ts.map +1 -1
  152. package/dist/shared-tree/schematizingTreeView.js +25 -9
  153. package/dist/shared-tree/schematizingTreeView.js.map +1 -1
  154. package/dist/shared-tree/sharedTree.d.ts +3 -3
  155. package/dist/shared-tree/sharedTree.d.ts.map +1 -1
  156. package/dist/shared-tree/sharedTree.js +8 -32
  157. package/dist/shared-tree/sharedTree.js.map +1 -1
  158. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
  159. package/dist/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  160. package/dist/shared-tree/sharedTreeChangeCodecs.js +38 -4
  161. package/dist/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  162. package/dist/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
  163. package/dist/shared-tree/tree.js +1 -1
  164. package/dist/shared-tree/tree.js.map +1 -1
  165. package/dist/shared-tree/treeCheckout.d.ts +20 -0
  166. package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
  167. package/dist/shared-tree/treeCheckout.js +39 -3
  168. package/dist/shared-tree/treeCheckout.js.map +1 -1
  169. package/dist/shared-tree-core/editManagerSummarizer.js +1 -1
  170. package/dist/shared-tree-core/editManagerSummarizer.js.map +1 -1
  171. package/dist/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  172. package/dist/shared-tree-core/messageCodecV1ToV4.js +2 -2
  173. package/dist/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  174. package/dist/shared-tree-core/transaction.d.ts +14 -3
  175. package/dist/shared-tree-core/transaction.d.ts.map +1 -1
  176. package/dist/shared-tree-core/transaction.js +59 -16
  177. package/dist/shared-tree-core/transaction.js.map +1 -1
  178. package/dist/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  179. package/dist/shared-tree-core/versionedSummarizer.js +1 -1
  180. package/dist/shared-tree-core/versionedSummarizer.js.map +1 -1
  181. package/dist/simple-tree/api/index.d.ts +1 -1
  182. package/dist/simple-tree/api/index.d.ts.map +1 -1
  183. package/dist/simple-tree/api/index.js +3 -2
  184. package/dist/simple-tree/api/index.js.map +1 -1
  185. package/dist/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
  186. package/dist/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  187. package/dist/simple-tree/api/schemaCreationUtilities.js +16 -1
  188. package/dist/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  189. package/dist/simple-tree/api/simpleTreeIndex.js.map +1 -1
  190. package/dist/simple-tree/api/transactionTypes.d.ts +10 -0
  191. package/dist/simple-tree/api/transactionTypes.d.ts.map +1 -1
  192. package/dist/simple-tree/api/transactionTypes.js.map +1 -1
  193. package/dist/simple-tree/api/tree.d.ts +81 -6
  194. package/dist/simple-tree/api/tree.d.ts.map +1 -1
  195. package/dist/simple-tree/api/tree.js.map +1 -1
  196. package/dist/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  197. package/dist/simple-tree/core/treeNodeSchema.js.map +1 -1
  198. package/dist/simple-tree/index.d.ts +2 -2
  199. package/dist/simple-tree/index.d.ts.map +1 -1
  200. package/dist/simple-tree/index.js +4 -2
  201. package/dist/simple-tree/index.js.map +1 -1
  202. package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
  203. package/dist/simple-tree/leafNodeSchema.js.map +1 -1
  204. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
  205. package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  206. package/dist/simple-tree/node-kinds/array/arrayNode.js +43 -1
  207. package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  208. package/dist/simple-tree/node-kinds/array/index.d.ts +1 -1
  209. package/dist/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  210. package/dist/simple-tree/node-kinds/array/index.js +2 -1
  211. package/dist/simple-tree/node-kinds/array/index.js.map +1 -1
  212. package/dist/simple-tree/node-kinds/index.d.ts +1 -1
  213. package/dist/simple-tree/node-kinds/index.d.ts.map +1 -1
  214. package/dist/simple-tree/node-kinds/index.js +2 -1
  215. package/dist/simple-tree/node-kinds/index.js.map +1 -1
  216. package/dist/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  217. package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  218. package/dist/tableSchema.d.ts +71 -48
  219. package/dist/tableSchema.d.ts.map +1 -1
  220. package/dist/tableSchema.js +200 -98
  221. package/dist/tableSchema.js.map +1 -1
  222. package/dist/text/textDomainFormatted.js +1 -1
  223. package/dist/text/textDomainFormatted.js.map +1 -1
  224. package/dist/util/bTreeUtils.d.ts +30 -4
  225. package/dist/util/bTreeUtils.d.ts.map +1 -1
  226. package/dist/util/bTreeUtils.js +29 -17
  227. package/dist/util/bTreeUtils.js.map +1 -1
  228. package/dist/util/brand.d.ts.map +1 -1
  229. package/dist/util/brand.js.map +1 -1
  230. package/dist/util/brandedMap.d.ts.map +1 -1
  231. package/dist/util/brandedMap.js.map +1 -1
  232. package/dist/util/breakable.d.ts.map +1 -1
  233. package/dist/util/breakable.js +2 -1
  234. package/dist/util/breakable.js.map +1 -1
  235. package/dist/util/index.d.ts +2 -2
  236. package/dist/util/index.d.ts.map +1 -1
  237. package/dist/util/index.js +6 -3
  238. package/dist/util/index.js.map +1 -1
  239. package/dist/util/opaque.d.ts.map +1 -1
  240. package/dist/util/opaque.js.map +1 -1
  241. package/dist/util/rangeMap.d.ts +3 -2
  242. package/dist/util/rangeMap.d.ts.map +1 -1
  243. package/dist/util/rangeMap.js +7 -1
  244. package/dist/util/rangeMap.js.map +1 -1
  245. package/dist/util/readSnapshotBlob.d.ts +1 -1
  246. package/dist/util/readSnapshotBlob.d.ts.map +1 -1
  247. package/dist/util/readSnapshotBlob.js.map +1 -1
  248. package/dist/util/typeCheck.d.ts.map +1 -1
  249. package/dist/util/typeCheck.js.map +1 -1
  250. package/dist/util/utils.d.ts +20 -16
  251. package/dist/util/utils.d.ts.map +1 -1
  252. package/dist/util/utils.js +49 -17
  253. package/dist/util/utils.js.map +1 -1
  254. package/eslint.config.mts +0 -9
  255. package/lib/alpha.d.ts +8 -2
  256. package/lib/beta.d.ts +3 -0
  257. package/lib/codec/codec.d.ts +17 -8
  258. package/lib/codec/codec.d.ts.map +1 -1
  259. package/lib/codec/codec.js +6 -0
  260. package/lib/codec/codec.js.map +1 -1
  261. package/lib/codec/index.d.ts +1 -1
  262. package/lib/codec/index.d.ts.map +1 -1
  263. package/lib/codec/index.js +1 -1
  264. package/lib/codec/index.js.map +1 -1
  265. package/lib/codec/versioned/codec.d.ts +1 -1
  266. package/lib/codec/versioned/codec.d.ts.map +1 -1
  267. package/lib/codec/versioned/codec.js.map +1 -1
  268. package/lib/core/index.d.ts +1 -1
  269. package/lib/core/index.d.ts.map +1 -1
  270. package/lib/core/index.js +1 -1
  271. package/lib/core/index.js.map +1 -1
  272. package/lib/core/rebase/changeRebaser.d.ts +3 -2
  273. package/lib/core/rebase/changeRebaser.d.ts.map +1 -1
  274. package/lib/core/rebase/changeRebaser.js.map +1 -1
  275. package/lib/core/rebase/index.d.ts +1 -1
  276. package/lib/core/rebase/index.d.ts.map +1 -1
  277. package/lib/core/rebase/index.js +1 -1
  278. package/lib/core/rebase/index.js.map +1 -1
  279. package/lib/core/rebase/types.d.ts +23 -3
  280. package/lib/core/rebase/types.d.ts.map +1 -1
  281. package/lib/core/rebase/types.js +27 -15
  282. package/lib/core/rebase/types.js.map +1 -1
  283. package/lib/core/schema-stored/formatV1.d.ts +2 -2
  284. package/lib/core/schema-stored/formatV1.d.ts.map +1 -1
  285. package/lib/core/schema-stored/formatV1.js +0 -5
  286. package/lib/core/schema-stored/formatV1.js.map +1 -1
  287. package/lib/core/schema-stored/formatV2.d.ts +11 -10
  288. package/lib/core/schema-stored/formatV2.d.ts.map +1 -1
  289. package/lib/core/schema-stored/formatV2.js +1 -6
  290. package/lib/core/schema-stored/formatV2.js.map +1 -1
  291. package/lib/core/schema-stored/index.d.ts.map +1 -1
  292. package/lib/core/schema-stored/index.js +2 -0
  293. package/lib/core/schema-stored/index.js.map +1 -1
  294. package/lib/core/schema-stored/schema.d.ts.map +1 -1
  295. package/lib/core/schema-stored/schema.js.map +1 -1
  296. package/lib/core/tree/anchorSet.d.ts.map +1 -1
  297. package/lib/core/tree/anchorSet.js.map +1 -1
  298. package/lib/core/tree/delta.d.ts +9 -7
  299. package/lib/core/tree/delta.d.ts.map +1 -1
  300. package/lib/core/tree/delta.js.map +1 -1
  301. package/lib/core/tree/deltaUtil.js +1 -1
  302. package/lib/core/tree/deltaUtil.js.map +1 -1
  303. package/lib/core/tree/visitDelta.js +2 -2
  304. package/lib/core/tree/visitDelta.js.map +1 -1
  305. package/lib/extensibleSchemaUnion.d.ts +72 -0
  306. package/lib/extensibleSchemaUnion.d.ts.map +1 -0
  307. package/lib/extensibleSchemaUnion.js +76 -0
  308. package/lib/extensibleSchemaUnion.js.map +1 -0
  309. package/lib/feature-libraries/changeAtomIdBTree.d.ts +4 -2
  310. package/lib/feature-libraries/changeAtomIdBTree.d.ts.map +1 -1
  311. package/lib/feature-libraries/changeAtomIdBTree.js +7 -0
  312. package/lib/feature-libraries/changeAtomIdBTree.js.map +1 -1
  313. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts +1 -3
  314. package/lib/feature-libraries/default-schema/defaultFieldKinds.d.ts.map +1 -1
  315. package/lib/feature-libraries/default-schema/defaultFieldKinds.js +4 -5
  316. package/lib/feature-libraries/default-schema/defaultFieldKinds.js.map +1 -1
  317. package/lib/feature-libraries/default-schema/index.d.ts +1 -1
  318. package/lib/feature-libraries/default-schema/index.d.ts.map +1 -1
  319. package/lib/feature-libraries/default-schema/index.js.map +1 -1
  320. package/lib/feature-libraries/forest-summary/codec.d.ts +2 -1
  321. package/lib/feature-libraries/forest-summary/codec.d.ts.map +1 -1
  322. package/lib/feature-libraries/forest-summary/codec.js.map +1 -1
  323. package/lib/feature-libraries/forest-summary/forestSummarizer.d.ts.map +1 -1
  324. package/lib/feature-libraries/forest-summary/forestSummarizer.js +6 -3
  325. package/lib/feature-libraries/forest-summary/forestSummarizer.js.map +1 -1
  326. package/lib/feature-libraries/forest-summary/formatCommon.d.ts +1 -39
  327. package/lib/feature-libraries/forest-summary/formatCommon.d.ts.map +1 -1
  328. package/lib/feature-libraries/forest-summary/formatCommon.js +2 -3
  329. package/lib/feature-libraries/forest-summary/formatCommon.js.map +1 -1
  330. package/lib/feature-libraries/forest-summary/formatV1.d.ts +1 -39
  331. package/lib/feature-libraries/forest-summary/formatV1.d.ts.map +1 -1
  332. package/lib/feature-libraries/forest-summary/formatV2.d.ts +1 -39
  333. package/lib/feature-libraries/forest-summary/formatV2.d.ts.map +1 -1
  334. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts +1 -1
  335. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.d.ts.map +1 -1
  336. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js +1 -1
  337. package/lib/feature-libraries/forest-summary/incrementalSummaryBuilder.js.map +1 -1
  338. package/lib/feature-libraries/index.d.ts +3 -3
  339. package/lib/feature-libraries/index.d.ts.map +1 -1
  340. package/lib/feature-libraries/index.js +3 -3
  341. package/lib/feature-libraries/index.js.map +1 -1
  342. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts +2 -2
  343. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.d.ts.map +1 -1
  344. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js +41 -21
  345. package/lib/feature-libraries/modular-schema/defaultRevisionReplacer.js.map +1 -1
  346. package/lib/feature-libraries/modular-schema/genericFieldKind.js +1 -1
  347. package/lib/feature-libraries/modular-schema/genericFieldKind.js.map +1 -1
  348. package/lib/feature-libraries/modular-schema/index.d.ts +1 -1
  349. package/lib/feature-libraries/modular-schema/index.d.ts.map +1 -1
  350. package/lib/feature-libraries/modular-schema/index.js +1 -1
  351. package/lib/feature-libraries/modular-schema/index.js.map +1 -1
  352. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts +1 -1
  353. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.d.ts.map +1 -1
  354. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js +10 -6
  355. package/lib/feature-libraries/modular-schema/modularChangeCodecV1.js.map +1 -1
  356. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts +11 -1
  357. package/lib/feature-libraries/modular-schema/modularChangeCodecs.d.ts.map +1 -1
  358. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js +29 -6
  359. package/lib/feature-libraries/modular-schema/modularChangeCodecs.js.map +1 -1
  360. package/lib/feature-libraries/modular-schema/modularChangeFamily.d.ts.map +1 -1
  361. package/lib/feature-libraries/modular-schema/modularChangeFamily.js +41 -30
  362. package/lib/feature-libraries/modular-schema/modularChangeFamily.js.map +1 -1
  363. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts +10 -127
  364. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.d.ts.map +1 -1
  365. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js +2 -4
  366. package/lib/feature-libraries/modular-schema/modularChangeFormatV1.js.map +1 -1
  367. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts +3 -79
  368. package/lib/feature-libraries/modular-schema/modularChangeFormatV2.d.ts.map +1 -1
  369. package/lib/feature-libraries/optional-field/optionalField.js +1 -1
  370. package/lib/feature-libraries/optional-field/optionalField.js.map +1 -1
  371. package/lib/feature-libraries/optional-field/requiredField.d.ts.map +1 -1
  372. package/lib/feature-libraries/optional-field/requiredField.js.map +1 -1
  373. package/lib/feature-libraries/schema-edits/schemaChangeFormat.d.ts +2 -2
  374. package/lib/feature-libraries/schema-index/codec.js.map +1 -1
  375. package/lib/feature-libraries/schema-index/formatV2.d.ts +4 -4
  376. package/lib/feature-libraries/schema-index/schemaSummarizer.js +1 -1
  377. package/lib/feature-libraries/schema-index/schemaSummarizer.js.map +1 -1
  378. package/lib/feature-libraries/sequence-field/invert.js +2 -2
  379. package/lib/feature-libraries/sequence-field/invert.js.map +1 -1
  380. package/lib/feature-libraries/sequence-field/replaceRevisions.js +16 -16
  381. package/lib/feature-libraries/sequence-field/replaceRevisions.js.map +1 -1
  382. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js +1 -1
  383. package/lib/feature-libraries/sequence-field/sequenceFieldToDelta.js.map +1 -1
  384. package/lib/index.d.ts +5 -5
  385. package/lib/index.d.ts.map +1 -1
  386. package/lib/index.js +4 -3
  387. package/lib/index.js.map +1 -1
  388. package/lib/legacy.d.ts +3 -0
  389. package/lib/packageVersion.d.ts +1 -1
  390. package/lib/packageVersion.js +1 -1
  391. package/lib/packageVersion.js.map +1 -1
  392. package/lib/shared-tree/independentView.d.ts +36 -13
  393. package/lib/shared-tree/independentView.d.ts.map +1 -1
  394. package/lib/shared-tree/independentView.js +1 -0
  395. package/lib/shared-tree/independentView.js.map +1 -1
  396. package/lib/shared-tree/index.d.ts +1 -1
  397. package/lib/shared-tree/index.d.ts.map +1 -1
  398. package/lib/shared-tree/index.js.map +1 -1
  399. package/lib/shared-tree/schematizingTreeView.d.ts +10 -0
  400. package/lib/shared-tree/schematizingTreeView.d.ts.map +1 -1
  401. package/lib/shared-tree/schematizingTreeView.js +25 -9
  402. package/lib/shared-tree/schematizingTreeView.js.map +1 -1
  403. package/lib/shared-tree/sharedTree.d.ts +3 -3
  404. package/lib/shared-tree/sharedTree.d.ts.map +1 -1
  405. package/lib/shared-tree/sharedTree.js +10 -34
  406. package/lib/shared-tree/sharedTree.js.map +1 -1
  407. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts +11 -3
  408. package/lib/shared-tree/sharedTreeChangeCodecs.d.ts.map +1 -1
  409. package/lib/shared-tree/sharedTreeChangeCodecs.js +39 -5
  410. package/lib/shared-tree/sharedTreeChangeCodecs.js.map +1 -1
  411. package/lib/shared-tree/sharedTreeChangeFormat.d.ts +4 -4
  412. package/lib/shared-tree/tree.js +1 -1
  413. package/lib/shared-tree/tree.js.map +1 -1
  414. package/lib/shared-tree/treeCheckout.d.ts +20 -0
  415. package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
  416. package/lib/shared-tree/treeCheckout.js +39 -3
  417. package/lib/shared-tree/treeCheckout.js.map +1 -1
  418. package/lib/shared-tree-core/editManagerSummarizer.js +1 -1
  419. package/lib/shared-tree-core/editManagerSummarizer.js.map +1 -1
  420. package/lib/shared-tree-core/messageCodecV1ToV4.d.ts.map +1 -1
  421. package/lib/shared-tree-core/messageCodecV1ToV4.js +2 -2
  422. package/lib/shared-tree-core/messageCodecV1ToV4.js.map +1 -1
  423. package/lib/shared-tree-core/transaction.d.ts +14 -3
  424. package/lib/shared-tree-core/transaction.d.ts.map +1 -1
  425. package/lib/shared-tree-core/transaction.js +61 -18
  426. package/lib/shared-tree-core/transaction.js.map +1 -1
  427. package/lib/shared-tree-core/versionedSummarizer.d.ts.map +1 -1
  428. package/lib/shared-tree-core/versionedSummarizer.js +1 -1
  429. package/lib/shared-tree-core/versionedSummarizer.js.map +1 -1
  430. package/lib/simple-tree/api/index.d.ts +1 -1
  431. package/lib/simple-tree/api/index.d.ts.map +1 -1
  432. package/lib/simple-tree/api/index.js +1 -1
  433. package/lib/simple-tree/api/index.js.map +1 -1
  434. package/lib/simple-tree/api/schemaCreationUtilities.d.ts +9 -0
  435. package/lib/simple-tree/api/schemaCreationUtilities.d.ts.map +1 -1
  436. package/lib/simple-tree/api/schemaCreationUtilities.js +14 -0
  437. package/lib/simple-tree/api/schemaCreationUtilities.js.map +1 -1
  438. package/lib/simple-tree/api/simpleTreeIndex.js.map +1 -1
  439. package/lib/simple-tree/api/transactionTypes.d.ts +10 -0
  440. package/lib/simple-tree/api/transactionTypes.d.ts.map +1 -1
  441. package/lib/simple-tree/api/transactionTypes.js.map +1 -1
  442. package/lib/simple-tree/api/tree.d.ts +81 -6
  443. package/lib/simple-tree/api/tree.d.ts.map +1 -1
  444. package/lib/simple-tree/api/tree.js.map +1 -1
  445. package/lib/simple-tree/core/treeNodeSchema.d.ts.map +1 -1
  446. package/lib/simple-tree/core/treeNodeSchema.js.map +1 -1
  447. package/lib/simple-tree/index.d.ts +2 -2
  448. package/lib/simple-tree/index.d.ts.map +1 -1
  449. package/lib/simple-tree/index.js +2 -2
  450. package/lib/simple-tree/index.js.map +1 -1
  451. package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
  452. package/lib/simple-tree/leafNodeSchema.js.map +1 -1
  453. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +63 -0
  454. package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
  455. package/lib/simple-tree/node-kinds/array/arrayNode.js +41 -0
  456. package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
  457. package/lib/simple-tree/node-kinds/array/index.d.ts +1 -1
  458. package/lib/simple-tree/node-kinds/array/index.d.ts.map +1 -1
  459. package/lib/simple-tree/node-kinds/array/index.js +1 -1
  460. package/lib/simple-tree/node-kinds/array/index.js.map +1 -1
  461. package/lib/simple-tree/node-kinds/index.d.ts +1 -1
  462. package/lib/simple-tree/node-kinds/index.d.ts.map +1 -1
  463. package/lib/simple-tree/node-kinds/index.js +1 -1
  464. package/lib/simple-tree/node-kinds/index.js.map +1 -1
  465. package/lib/simple-tree/node-kinds/object/objectNode.d.ts.map +1 -1
  466. package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
  467. package/lib/tableSchema.d.ts +71 -48
  468. package/lib/tableSchema.d.ts.map +1 -1
  469. package/lib/tableSchema.js +201 -99
  470. package/lib/tableSchema.js.map +1 -1
  471. package/lib/text/textDomainFormatted.js +1 -1
  472. package/lib/text/textDomainFormatted.js.map +1 -1
  473. package/lib/util/bTreeUtils.d.ts +30 -4
  474. package/lib/util/bTreeUtils.d.ts.map +1 -1
  475. package/lib/util/bTreeUtils.js +27 -16
  476. package/lib/util/bTreeUtils.js.map +1 -1
  477. package/lib/util/brand.d.ts.map +1 -1
  478. package/lib/util/brand.js.map +1 -1
  479. package/lib/util/brandedMap.d.ts.map +1 -1
  480. package/lib/util/brandedMap.js.map +1 -1
  481. package/lib/util/breakable.d.ts.map +1 -1
  482. package/lib/util/breakable.js +2 -1
  483. package/lib/util/breakable.js.map +1 -1
  484. package/lib/util/index.d.ts +2 -2
  485. package/lib/util/index.d.ts.map +1 -1
  486. package/lib/util/index.js +2 -2
  487. package/lib/util/index.js.map +1 -1
  488. package/lib/util/opaque.d.ts.map +1 -1
  489. package/lib/util/opaque.js.map +1 -1
  490. package/lib/util/rangeMap.d.ts +3 -2
  491. package/lib/util/rangeMap.d.ts.map +1 -1
  492. package/lib/util/rangeMap.js +7 -1
  493. package/lib/util/rangeMap.js.map +1 -1
  494. package/lib/util/readSnapshotBlob.d.ts +1 -1
  495. package/lib/util/readSnapshotBlob.d.ts.map +1 -1
  496. package/lib/util/readSnapshotBlob.js.map +1 -1
  497. package/lib/util/typeCheck.d.ts.map +1 -1
  498. package/lib/util/typeCheck.js.map +1 -1
  499. package/lib/util/utils.d.ts +20 -16
  500. package/lib/util/utils.d.ts.map +1 -1
  501. package/lib/util/utils.js +44 -15
  502. package/lib/util/utils.js.map +1 -1
  503. package/package.json +23 -23
  504. package/src/codec/codec.ts +30 -11
  505. package/src/codec/index.ts +2 -0
  506. package/src/codec/versioned/codec.ts +9 -13
  507. package/src/core/index.ts +3 -1
  508. package/src/core/rebase/changeRebaser.ts +3 -2
  509. package/src/core/rebase/index.ts +3 -1
  510. package/src/core/rebase/types.ts +51 -13
  511. package/src/core/schema-stored/formatV1.ts +2 -4
  512. package/src/core/schema-stored/formatV2.ts +9 -7
  513. package/src/core/schema-stored/index.ts +2 -0
  514. package/src/core/schema-stored/schema.ts +4 -1
  515. package/src/core/tree/anchorSet.ts +1 -3
  516. package/src/core/tree/delta.ts +9 -7
  517. package/src/core/tree/deltaUtil.ts +1 -1
  518. package/src/core/tree/visitDelta.ts +2 -2
  519. package/src/extensibleSchemaUnion.ts +135 -0
  520. package/src/feature-libraries/changeAtomIdBTree.ts +17 -2
  521. package/src/feature-libraries/default-schema/defaultFieldKinds.ts +5 -6
  522. package/src/feature-libraries/default-schema/index.ts +0 -1
  523. package/src/feature-libraries/forest-summary/codec.ts +7 -2
  524. package/src/feature-libraries/forest-summary/forestSummarizer.ts +15 -3
  525. package/src/feature-libraries/forest-summary/formatCommon.ts +2 -3
  526. package/src/feature-libraries/forest-summary/incrementalSummaryBuilder.ts +4 -5
  527. package/src/feature-libraries/index.ts +3 -2
  528. package/src/feature-libraries/modular-schema/defaultRevisionReplacer.ts +57 -31
  529. package/src/feature-libraries/modular-schema/genericFieldKind.ts +1 -1
  530. package/src/feature-libraries/modular-schema/index.ts +4 -1
  531. package/src/feature-libraries/modular-schema/modularChangeCodecV1.ts +7 -6
  532. package/src/feature-libraries/modular-schema/modularChangeCodecs.ts +32 -7
  533. package/src/feature-libraries/modular-schema/modularChangeFamily.ts +54 -33
  534. package/src/feature-libraries/modular-schema/modularChangeFormatV1.ts +2 -4
  535. package/src/feature-libraries/optional-field/optionalField.ts +1 -1
  536. package/src/feature-libraries/optional-field/requiredField.ts +2 -4
  537. package/src/feature-libraries/schema-index/codec.ts +1 -1
  538. package/src/feature-libraries/schema-index/schemaSummarizer.ts +1 -1
  539. package/src/feature-libraries/sequence-field/invert.ts +2 -2
  540. package/src/feature-libraries/sequence-field/replaceRevisions.ts +17 -10
  541. package/src/feature-libraries/sequence-field/sequenceFieldToDelta.ts +1 -1
  542. package/src/index.ts +12 -7
  543. package/src/packageVersion.ts +1 -1
  544. package/src/shared-tree/independentView.ts +42 -6
  545. package/src/shared-tree/index.ts +2 -0
  546. package/src/shared-tree/schematizingTreeView.ts +63 -18
  547. package/src/shared-tree/sharedTree.ts +19 -37
  548. package/src/shared-tree/sharedTreeChangeCodecs.ts +43 -9
  549. package/src/shared-tree/tree.ts +1 -1
  550. package/src/shared-tree/treeCheckout.ts +50 -3
  551. package/src/shared-tree-core/editManagerSummarizer.ts +1 -1
  552. package/src/shared-tree-core/messageCodecV1ToV4.ts +4 -3
  553. package/src/shared-tree-core/transaction.ts +125 -23
  554. package/src/shared-tree-core/versionedSummarizer.ts +3 -2
  555. package/src/simple-tree/api/index.ts +1 -0
  556. package/src/simple-tree/api/schemaCreationUtilities.ts +35 -5
  557. package/src/simple-tree/api/simpleTreeIndex.ts +1 -1
  558. package/src/simple-tree/api/transactionTypes.ts +10 -0
  559. package/src/simple-tree/api/tree.ts +88 -6
  560. package/src/simple-tree/core/treeNodeSchema.ts +5 -8
  561. package/src/simple-tree/index.ts +3 -0
  562. package/src/simple-tree/leafNodeSchema.ts +3 -2
  563. package/src/simple-tree/node-kinds/array/arrayNode.ts +86 -0
  564. package/src/simple-tree/node-kinds/array/index.ts +2 -0
  565. package/src/simple-tree/node-kinds/index.ts +2 -0
  566. package/src/simple-tree/node-kinds/object/objectNode.ts +19 -18
  567. package/src/tableSchema.ts +280 -140
  568. package/src/text/textDomainFormatted.ts +1 -1
  569. package/src/util/bTreeUtils.ts +45 -26
  570. package/src/util/brand.ts +4 -12
  571. package/src/util/brandedMap.ts +2 -6
  572. package/src/util/breakable.ts +3 -2
  573. package/src/util/index.ts +9 -3
  574. package/src/util/opaque.ts +2 -6
  575. package/src/util/rangeMap.ts +11 -5
  576. package/src/util/readSnapshotBlob.ts +3 -3
  577. package/src/util/typeCheck.ts +11 -9
  578. package/src/util/utils.ts +57 -28
  579. package/biome.jsonc +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"tableSchema.js","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;AAEH,4KAA4K;AAE5K,kEAA2D;AAC3D,uEAAsE;AAEtE,8CAA2C;AAC3C,qDAAmD;AACnD,qDA0BgC;AAChC,8CAAoE;AAEpE,4BAA4B;AAC5B,mDAAmD;AACnD,oDAAoD;AACpD,2EAA2E;AAE3E,oBAAoB;AACpB,mGAAmG;AAEnG;;;GAGG;AACH,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAEnD;;GAEG;AACH,MAAM,iBAAiB,GAAkB,MAAM,CAAC,WAAW,CAAC,CAAC;AAwB7D;;;;;;;;;GASG;AACH,IAAiB,kBAAkB,CAsjClC;AAtjCD,WAAiB,kBAAkB;IAkFlC;;;OAGG;IACH,sIAAsI;IACtI,SAAgB,kBAAkB,CAIhC,kBAAiD,EAAE,WAAyB;QAC7E,MAAM,aAAa,GAAG,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;QAGnE,gFAAgF;QAChF,yCAAyC;QACzC,kDAAkD;QAClD,MAA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CAAC;IARe,kBAAM,SAQrB,CAAA;IA0ED;;OAEG;IACH,SAAgB,GAAG,CAAC,EACnB,aAAa,EACb,IAAI,EACJ,KAAK,GAAG,wBAAa,CAAC,QAAQ,CAAC,wBAAa,CAAC,IAAI,CAAC,GAGlD;QACA,OAAO,kBAAkB,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;IARe,eAAG,MAQlB,CAAA;IAiYD;;OAEG;IACH,SAAgB,KAAK,CAAC,EACrB,aAAa,EACb,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC;QAC7B,aAAa;QACb,IAAI,EAAE,UAAU;KAChB,CAAC,EACF,GAAG,EAAE,SAAS,GAAG,GAAG,CAAC;QACpB,aAAa;QACb,IAAI,EAAE,UAAU;KAChB,CAAC,GAIF;QACA,OAAO,kBAAkB,CAAC,iBAAiB,CAC1C,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,CACT,CAAC;IACH,CAAC;IArBe,iBAAK,QAqBpB,CAAA;IAED,aAAa;AACd,CAAC,EAvkBgB,WAAW,2BAAX,WAAW,QAukB3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-unsafe-member-access -- This file uses intentional `as any` casts to access hidden internal properties (cells, tableSchemaSymbol) */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey } from \"./core/index.js\";\nimport { TreeAlpha } from \"./shared-tree/index.js\";\nimport {\n\ttype FieldHasDefault,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeKind,\n\tSchemaFactoryBeta,\n\ttype ScopedSchemaName,\n\tTreeArrayNode,\n\ttype TreeNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InternalTreeNode,\n\tSchemaFactory,\n\tscoped,\n\ttype ImplicitFieldSchema,\n\twithBufferedTreeEvents,\n\ttype TreeRecordNode,\n\tobjectSchema,\n\teraseSchemaDetailsSubclassable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports -- This makes the API report slightly cleaner.\n\tTreeNodeSchemaCore,\n} from \"./simple-tree/index.js\";\nimport { validateIndex, validateIndexRange } from \"./util/index.js\";\n\n// Future improvement TODOs:\n// - Omit `cells` property from Row insertion type.\n// - Record-like type parameters / input parameters?\n// - Omit `props` properties from Row and Column schemas when not provided?\n\n// Longer-term work:\n// - Add constraint APIs to make it possible to avoid situations that could yield \"orphaned\" cells.\n\n/**\n * Scope for table schema built-in types.\n * @remarks User-provided factory scoping will be applied as `com.fluidframework.table<user-scope>`.\n */\nconst baseSchemaScope = \"com.fluidframework.table\";\n\n/**\n * A private symbol put on table schema to help identify them.\n */\nconst tableSchemaSymbol: unique symbol = Symbol(\"tableNode\");\n\n/**\n * A row in a table.\n * @typeParam TCellSchema - The type of the cells in the {@link TableSchema.Table}.\n * @typeParam TPropsSchema - Additional properties to associate with the row.\n * @privateRemarks Private counterpart to the {@link TableSchema.Row}.\n * Exposes internal properties needed for table operations (publicly exposed via {@link TableSchema.Table}).\n * @sealed\n */\nexport interface RowPrivate<\n\tTCellSchema extends ImplicitAllowedTypes,\n\tTPropsSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> extends TableSchema.Row<TCellSchema, TPropsSchema> {\n\t/**\n\t * The row's cells.\n\t * @remarks This is a user-defined schema that can be used to store additional information about the row.\n\t * @privateRemarks\n\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createRowSchema}.\n\t * If you update the docs here, please also update the inline type definitions.\n\t */\n\treadonly cells: TreeRecordNode<TCellSchema>;\n}\n\n/**\n * Not intended for use outside of this package.\n *\n * @privateRemarks\n * This namespace is a collection of internal system types relate to {@link TableSchema}.\n * This namespace should be strictly type-exported by the package.\n * All members should be tagged with `@system`.\n *\n * @system @alpha\n */\nexport namespace System_TableSchema {\n\t/**\n\t * A list of items in a table whose elements may be rearranged, but not inserted or removed.\n\t *\n\t * @privateRemarks Used by {@link TableSchema.Table} for its `rows` and `columns` properties to allow basic rearrangement operations on the underlying sequences without permitting mutation operations that might violate table invariants.\n\t *\n\t * Note: this can't reasonably be implemented via `Pick<ArrayNode<...>>` because we only want to include the\n\t * subset of its method overloads which do not support moving items between lists.\n\t *\n\t * @alpha @system\n\t */\n\texport type RearrangeableList<TItemSchema extends ImplicitAllowedTypes> = TreeNode &\n\t\treadonly TreeNodeFromImplicitAllowedTypes<TItemSchema>[] & {\n\t\t\t// #region Capture the subset of item rearrangement methods from `TreeArrayNode` that do not allow moving between lists.\n\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveToEnd:1)} */\n\t\t\tmoveToEnd(sourceIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveToStart:1)} */\n\t\t\tmoveToStart(sourceIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveToIndex:1)} */\n\t\t\tmoveToIndex(sourceIndex: number, destinationIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveRangeToEnd:1)} */\n\t\t\tmoveRangeToEnd(startIndex: number, endIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveRangeToStart:1)} */\n\t\t\tmoveRangeToStart(startIndex: number, endIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveRangeToIndex:1)} */\n\t\t\tmoveRangeToIndex(startIndex: number, endIndex: number, destinationIndex: number): void;\n\n\t\t\t// #endregion\n\t\t};\n\n\t/**\n\t * Default type used for column and row \"props\" fields.\n\t * @privateRemarks\n\t * Longer term, it would be better to simply omit \"props\" altogether by default.\n\t * For now, this ensures that the user doesn't have to specify a \"props\" entry when initializing column/row nodes\n\t * and ensures that they cannot set anything that might conflict with future evolutions of the schema.\n\t * @system @alpha\n\t */\n\texport type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;\n\n\t/**\n\t * A base interface for factory input options which include an schema factory.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @alpha\n\t */\n\texport interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryBeta> {\n\t\t/**\n\t\t * Schema factory with which the Column schema will be associated.\n\t\t * @remarks Can be used to associate the resulting schema with an existing {@link SchemaFactory.scope|scope}.\n\t\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.<Column|Row|Table>`.\n\t\t */\n\t\treadonly schemaFactory: TSchemaFactory;\n\t}\n\n\t/**\n\t * A base interface for factory input options which include the table cell schema.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @alpha\n\t */\n\texport interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * Schema for the table's cells.\n\t\t */\n\t\treadonly cell: TCellSchema;\n\t}\n\n\t// #region Column\n\n\t/**\n\t * Base options for creating table column schema.\n\t * @remarks Includes parameters common to all column factory overloads.\n\t * @system @alpha\n\t */\n\texport type CreateColumnOptionsBase<\n\t\tTUserScope extends string = string,\n\t\tTSchemaFactory extends SchemaFactoryBeta<TUserScope> = SchemaFactoryBeta<TUserScope>,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCellSchema>;\n\n\t/**\n\t * Factory for creating column schema.\n\t * @system @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createColumnSchema<\n\t\tconst TUserScope extends string,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitFieldSchema,\n\t>(inputSchemaFactory: SchemaFactoryBeta<TUserScope>, propsSchema: TPropsSchema) {\n\t\tconst schemaFactory = createTableScopedFactory(inputSchemaFactory);\n\t\ttype Scope = typeof schemaFactory.scope;\n\n\t\t// Note: `columnFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `ColumnInsertableType` below.\n\t\tconst columnFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t} as const;\n\t\tconst columnFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Column} fields.\n\t\t *\n\t\t * @remarks\n\t\t * Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t *\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst columnFields = {\n\t\t\t...columnFieldsBuiltInParts,\n\t\t\t...columnFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * A column in a table.\n\t\t */\n\t\tclass Column\n\t\t\textends schemaFactory.object(\"Column\", columnFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Column<TCellSchema, TPropsSchema> {}\n\n\t\ttype ColumnValueType = TreeNode &\n\t\t\tTableSchema.Column<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Column\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof columnFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around the issue.\n\t\t// type ColumnInsertableType = InsertableObjectFromSchemaRecord<typeof columnFields>;\n\t\ttype ColumnInsertableType = InsertableObjectFromSchemaRecord<\n\t\t\ttypeof columnFieldsBuiltInParts\n\t\t> &\n\t\t\t(FieldHasDefault<TPropsSchema> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IColumn.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<TPropsSchema>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<TPropsSchema>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Column` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype ColumnSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Column]: (typeof Column)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | ColumnInsertableType,\n\t\t\t) => Column) & {\n\t\t\t\tcreateFromInsertable(parameters: ColumnInsertableType): Column;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst ColumnSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Column\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ ColumnValueType,\n\t\t\t/* TInsertable */ object & ColumnInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof columnFields\n\t\t> = Column as ColumnSchemaModifiedType;\n\n\t\treturn ColumnSchemaType;\n\t}\n\n\t/**\n\t * Base column schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type ColumnSchemaBase<\n\t\tTUserScope extends string = string,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t> = ReturnType<typeof createColumnSchema<TUserScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * Base options for creating table row schema.\n\t * @remarks Includes parameters common to all row factory overloads.\n\t * @system @alpha\n\t */\n\texport type CreateRowOptionsBase<\n\t\tTUserScope extends string = string,\n\t\tTSchemaFactory extends SchemaFactoryBeta<TUserScope> = SchemaFactoryBeta<TUserScope>,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCellSchema>;\n\n\t/**\n\t * Factory for creating row schema.\n\t * @sealed @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createRowSchema<\n\t\tconst TUserScope extends string,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryBeta<TUserScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = createTableScopedFactory(inputSchemaFactory);\n\t\ttype Scope = typeof schemaFactory.scope;\n\n\t\t// Note: `rowFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `RowInsertableType` below.\n\t\tconst rowFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t\t/**\n\t\t\t * The cells of the table row, keyed by column ID.\n\t\t\t * @remarks\n\t\t\t * The table row models its cells as a record, where each key is the ID of the column it belongs to. The choice of record (as opposed to a map) is intended to make interop with common table rendering libraries in TypeScript/JavaScript easier.\n\t\t\t */\n\t\t\tcells: schemaFactory.required(schemaFactory.record(\"Row.cells\", cellSchema), {\n\t\t\t\tmetadata: {\n\t\t\t\t\tdescription: \"The cells of the table row, keyed by column ID.\",\n\t\t\t\t},\n\t\t\t}),\n\t\t} as const;\n\t\tconst rowFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link RowSchema} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst rowFields = {\n\t\t\t...rowFieldsBuiltInParts,\n\t\t\t...rowFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * The Row schema - this is a map of Cells where the key is the column id\n\t\t */\n\t\tclass RowSchema\n\t\t\textends schemaFactory.object(\"Row\", rowFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements RowPrivate<TCellSchema, TPropsSchema> {}\n\n\t\ttype RowValueType = TreeNode &\n\t\t\tTableSchema.Row<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Row\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof rowFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around\n\t\t// the issue.\n\t\t// type RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFields>;\n\t\ttype RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFieldsBuiltInParts> &\n\t\t\t(FieldHasDefault<TPropsSchema> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IRow.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<TPropsSchema>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<TPropsSchema>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Row` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype RowSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof RowSchema]: (typeof RowSchema)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | RowInsertableType,\n\t\t\t) => RowSchema) & {\n\t\t\t\tcreateFromInsertable(parameters: RowInsertableType): RowSchema;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst RowSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Row\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ RowValueType,\n\t\t\t/* TInsertable */ object & RowInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof rowFields\n\t\t> = RowSchema as RowSchemaModifiedType;\n\n\t\treturn RowSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type RowSchemaBase<\n\t\tTUserScope extends string = string,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t> = ReturnType<typeof createRowSchema<TUserScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * Base options for creating table schema.\n\t * @remarks Includes parameters common to all table factory overloads.\n\t * @system @alpha\n\t */\n\texport type TableFactoryOptionsBase<\n\t\tTUserScope extends string = string,\n\t\tTSchemaFactory extends SchemaFactoryBeta<TUserScope> = SchemaFactoryBeta<TUserScope>,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCellSchema>;\n\n\t/**\n\t * Factory for creating table schema.\n\t * @system @alpha\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createTableSchema<\n\t\tconst TUserScope extends string,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TColumnSchema extends ColumnSchemaBase<TUserScope, TCellSchema>,\n\t\tconst TRowSchema extends RowSchemaBase<TUserScope, TCellSchema>,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryBeta<TUserScope>,\n\t\t_cellSchema: TCellSchema,\n\t\tcolumnSchema: TColumnSchema,\n\t\trowSchema: TRowSchema,\n\t) {\n\t\tconst schemaFactory = createTableScopedFactory(inputSchemaFactory);\n\t\ttype Scope = typeof schemaFactory.scope;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\t\ttype ColumnInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\t\ttype RowValueType = TreeNodeFromImplicitAllowedTypes<TRowSchema>;\n\t\ttype RowInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>;\n\n\t\t// Internal version of RowValueType that exposes the `cells` property for use within Table methods.\n\t\ttype RowValueInternalType = RowValueType & RowPrivate<TCellSchema>;\n\n\t\t/**\n\t\t * {@link Table} inner fields.\n\t\t * @remarks Extracted for re-use as construction parameters.\n\t\t * @see {@link Table.create}.\n\t\t */\n\t\tconst tableInnerFields = {\n\t\t\trows: schemaFactory.array(\"Table.rows\", rowSchema),\n\t\t\tcolumns: schemaFactory.array(\"Table.columns\", columnSchema),\n\t\t} as const satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * {@link Table} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst tableFields = {\n\t\t\ttable: schemaFactory.required(schemaFactory.object(\"Table\", tableInnerFields), {\n\t\t\t\t// Use an empty key in the stored schema format to help prevent schema-unaware edits from being\n\t\t\t\t// made to the table, which may violate intended invariants.\n\t\t\t\tkey: EmptyKey,\n\t\t\t}),\n\t\t} as const satisfies Record<string, ImplicitFieldSchema>;\n\n\t\ttype TableValueType = TreeNode &\n\t\t\tTableSchema.Table<TUserScope, TCellSchema, TColumnSchema, TRowSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"TableRoot\">>;\n\t\ttype TableConstructorType = new (data?: InternalTreeNode | undefined) => TableValueType;\n\n\t\t/**\n\t\t * The Table schema\n\t\t */\n\t\tclass Table\n\t\t\t// Calling the objectSchema factory directly rather than using the schemaFactory so we can specify\n\t\t\t// `implicitlyConstructable: false`, which the SchemaFactory APIs do not yet support.\n\t\t\t// TODO: when support for configuring `implicitlyConstructable` is added to SchemaFactory, switch to\n\t\t\t// using that instead.\n\t\t\textends objectSchema(\n\t\t\t\t/* identifier: */ scoped(schemaFactory as SchemaFactory<Scope>, \"TableRoot\"),\n\t\t\t\t/* info: */ tableFields,\n\t\t\t\t/* implicitlyConstructable: */ false,\n\t\t\t\t/* nodeOptions: */ {\n\t\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t\t},\n\t\t\t)\n\t\t\timplements TableSchema.Table<TUserScope, TCellSchema, TColumnSchema, TRowSchema>\n\t\t{\n\t\t\tpublic constructor(node?: InternalTreeNode | undefined) {\n\t\t\t\tsuper(node ?? { table: { columns: [], rows: [] } });\n\t\t\t}\n\n\t\t\tpublic static create<TThis extends TableConstructorType>(\n\t\t\t\tthis: TThis,\n\t\t\t\tinitialContents?:\n\t\t\t\t\t| TableSchema.TableFactoryMethodParameters<\n\t\t\t\t\t\t\tTUserScope,\n\t\t\t\t\t\t\tTCellSchema,\n\t\t\t\t\t\t\tTColumnSchema,\n\t\t\t\t\t\t\tTRowSchema\n\t\t\t\t\t >\n\t\t\t\t\t| undefined,\n\t\t\t): InstanceType<TThis> {\n\t\t\t\t// #region Input validation\n\n\t\t\t\tconst columns =\n\t\t\t\t\t(initialContents?.columns as Iterable<ColumnInsertableType> | undefined) ?? [];\n\n\t\t\t\tconst columnIds = new Set<string>();\n\t\t\t\tfor (const column of columns) {\n\t\t\t\t\tcolumnIds.add((column as ColumnValueType).id);\n\t\t\t\t}\n\n\t\t\t\tconst rows = (initialContents?.rows as Iterable<RowInsertableType> | undefined) ?? [];\n\n\t\t\t\tTable._validateNewColumns(\n\t\t\t\t\tcolumns,\n\t\t\t\t\t// New table, so no existing columns to validate against\n\t\t\t\t\tnew Set(),\n\t\t\t\t);\n\n\t\t\t\tTable._validateNewRows(\n\t\t\t\t\trows,\n\t\t\t\t\t// New table, so no existing rows to validate against\n\t\t\t\t\tnew Set(),\n\t\t\t\t\t// No existing columns to validate cells against, but we do need to validate the new rows against the new columns\n\t\t\t\t\tcolumnIds,\n\t\t\t\t);\n\n\t\t\t\t// #endregion\n\t\t\t\treturn new this(\n\t\t\t\t\tinitialContents === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: ({\n\t\t\t\t\t\t\t\ttable: initialContents,\n\t\t\t\t\t\t\t\t// We have typed our constructor to prevent users from calling it directly with insertable contents.\n\t\t\t\t\t\t\t\t// But the base constructor still allows it. Cast to work around this.\n\t\t\t\t\t\t\t} as unknown as InternalTreeNode),\n\t\t\t\t) as InstanceType<TThis>;\n\t\t\t}\n\n\t\t\tpublic get columns(): RearrangeableList<TColumnSchema> {\n\t\t\t\treturn this.table.columns as RearrangeableList<TColumnSchema>;\n\t\t\t}\n\n\t\t\tpublic get rows(): RearrangeableList<TRowSchema> {\n\t\t\t\treturn this.table.rows as RearrangeableList<TRowSchema>;\n\t\t\t}\n\n\t\t\tpublic getColumn(indexOrId: number | string): ColumnValueType | undefined {\n\t\t\t\treturn this.#tryGetColumn(indexOrId);\n\t\t\t}\n\n\t\t\tpublic getRow(indexOrId: number | string): RowValueType | undefined {\n\t\t\t\treturn this.#tryGetRow(indexOrId);\n\t\t\t}\n\n\t\t\tpublic getCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrIdOrIndex, row: rowOrIdOrIndex } = key;\n\t\t\t\tconst row = this.#tryGetRow(rowOrIdOrIndex);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst column = this.#tryGetColumn(columnOrIdOrIndex);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn (row as RowValueInternalType).cells[column.id];\n\t\t\t}\n\n\t\t\tpublic insertColumns({\n\t\t\t\tcolumns,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnsParameters<TColumnSchema>): ColumnValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure specified index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tvalidateIndex(index, this.table.columns, \"Table.insertColumns\", true);\n\t\t\t\t}\n\n\t\t\t\t// Ensure the new columns being inserted are valid\n\t\t\t\tthis.#validateNewColumns(columns);\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// TypeScript is unable to narrow the column type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.table.columns.insertAtEnd(TreeArrayNode.spread(columns) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.table.columns.insertAt(index, TreeArrayNode.spread(columns) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn columns as unknown as ColumnValueType[];\n\t\t\t}\n\n\t\t\tpublic insertRows({\n\t\t\t\tindex,\n\t\t\t\trows,\n\t\t\t}: TableSchema.InsertRowsParameters<TRowSchema>): RowValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure specified index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tvalidateIndex(index, this.table.rows, \"Table.insertRows\", true);\n\t\t\t\t}\n\n\t\t\t\t// Ensure the new rows being inserted are valid\n\t\t\t\tthis.#validateNewRows(rows);\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the casts below.\n\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\tif (index === undefined) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.table.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);\n\t\t\t\t} else {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tthis.table.rows.insertAt(index, TreeArrayNode.spread(rows) as any);\n\t\t\t\t}\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn rows as unknown as RowValueType[];\n\t\t\t}\n\n\t\t\tpublic setCell({\n\t\t\t\tkey,\n\t\t\t\tcell,\n\t\t\t}: TableSchema.SetCellParameters<TCellSchema, TColumnSchema, TRowSchema>): void {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\n\t\t\t\tconst row = this.#getRow(rowOrId);\n\t\t\t\tconst column = this.#getColumn(columnOrId);\n\n\t\t\t\t(row as RowValueInternalType).cells[column.id] = cell as CellValueType;\n\t\t\t}\n\n\t\t\tpublic removeColumns(\n\t\t\t\tindexOrColumns: number | undefined | readonly string[] | readonly ColumnValueType[],\n\t\t\t\tcount: number | undefined = undefined,\n\t\t\t): ColumnValueType[] {\n\t\t\t\tif (typeof indexOrColumns === \"number\" || indexOrColumns === undefined) {\n\t\t\t\t\tlet removedColumns: ColumnValueType[] | undefined;\n\t\t\t\t\tconst startIndex = indexOrColumns ?? 0;\n\t\t\t\t\tconst endIndex =\n\t\t\t\t\t\tcount === undefined ? this.table.columns.length : startIndex + count;\n\n\t\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\t\tif (startIndex === endIndex) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\tvalidateIndexRange(startIndex, endIndex, this.table.columns, \"Table.removeColumns\");\n\n\t\t\t\t\tthis.#applyEditsInBatch(() => {\n\t\t\t\t\t\tconst columnsToRemove = this.table.columns.slice(\n\t\t\t\t\t\t\tstartIndex,\n\t\t\t\t\t\t\tendIndex,\n\t\t\t\t\t\t) as ColumnValueType[];\n\n\t\t\t\t\t\t// First, remove all cells that correspond to each column from each row:\n\t\t\t\t\t\tfor (const column of columnsToRemove) {\n\t\t\t\t\t\t\tthis.#removeCells(column);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Second, remove the column nodes:\n\t\t\t\t\t\tremoveRangeFromArray(\n\t\t\t\t\t\t\tstartIndex,\n\t\t\t\t\t\t\tendIndex,\n\t\t\t\t\t\t\tthis.table.columns,\n\t\t\t\t\t\t\t\"Table.removeColumns\",\n\t\t\t\t\t\t);\n\t\t\t\t\t\tremovedColumns = columnsToRemove;\n\t\t\t\t\t});\n\t\t\t\t\treturn removedColumns ?? fail(0xc1f /* Transaction did not complete. */);\n\t\t\t\t} else {\n\t\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\t\tif (indexOrColumns.length === 0) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\t// Resolve any IDs to actual nodes.\n\t\t\t\t\t// This validates that all of the rows exist before starting transaction.\n\t\t\t\t\t// This improves user-facing error experience.\n\t\t\t\t\tconst columnsToRemove: ColumnValueType[] = [];\n\t\t\t\t\tfor (const columnOrIdToRemove of indexOrColumns) {\n\t\t\t\t\t\tcolumnsToRemove.push(this.#getColumn(columnOrIdToRemove));\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.#applyEditsInBatch(() => {\n\t\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t\t// So if we throw an error here for any column, no columns will be removed.\n\t\t\t\t\t\tfor (const columnToRemove of columnsToRemove) {\n\t\t\t\t\t\t\t// Remove the corresponding cell from all rows.\n\t\t\t\t\t\t\tfor (const row of this.table.rows) {\n\t\t\t\t\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t\t\t\tthis.removeCell({\n\t\t\t\t\t\t\t\t\tcolumn: columnToRemove,\n\t\t\t\t\t\t\t\t\trow: row as RowValueType,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// We have already validated that all of the columns exist above, so this is safe.\n\t\t\t\t\t\t\tthis.table.columns.removeAt(this.table.columns.indexOf(columnToRemove));\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\treturn columnsToRemove;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic removeRows(\n\t\t\t\tindexOrRows: number | undefined | readonly string[] | readonly RowValueType[],\n\t\t\t\tcount?: number | undefined,\n\t\t\t): RowValueType[] {\n\t\t\t\tif (typeof indexOrRows === \"number\" || indexOrRows === undefined) {\n\t\t\t\t\tconst startIndex = indexOrRows ?? 0;\n\t\t\t\t\tconst endIndex = count === undefined ? this.table.rows.length : startIndex + count;\n\n\t\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\t\tif (startIndex === endIndex) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\treturn removeRangeFromArray(\n\t\t\t\t\t\tstartIndex,\n\t\t\t\t\t\tendIndex,\n\t\t\t\t\t\tthis.table.rows,\n\t\t\t\t\t\t\"Table.removeRows\",\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\tif (indexOrRows.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// Resolve any IDs to actual nodes.\n\t\t\t\t// This validates that all of the rows exist before starting transaction.\n\t\t\t\t// This improves user-facing error experience.\n\t\t\t\tconst rowsToRemove: RowValueType[] = [];\n\t\t\t\tfor (const rowToRemove of indexOrRows) {\n\t\t\t\t\trowsToRemove.push(this.#getRow(rowToRemove));\n\t\t\t\t}\n\n\t\t\t\tthis.#applyEditsInBatch(() => {\n\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t// So if we throw an error here for any row, no rows will be removed.\n\t\t\t\t\tfor (const rowToRemove of rowsToRemove) {\n\t\t\t\t\t\t// We have already validated that all of the rows exist above, so this is safe.\n\t\t\t\t\t\tconst index = this.table.rows.indexOf(rowToRemove);\n\t\t\t\t\t\tthis.table.rows.removeAt(index);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn rowsToRemove;\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrIdOrIndex, row: rowOrIdOrIndex } = key;\n\t\t\t\tconst row = this.#getRow(rowOrIdOrIndex) as RowValueInternalType;\n\t\t\t\tconst column = this.#getColumn(columnOrIdOrIndex);\n\n\t\t\t\tconst cell: CellValueType | undefined = row.cells[column.id];\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete row.cells[column.id];\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Removes the cell corresponding with the specified column from each row in the table.\n\t\t\t */\n\t\t\t#removeCells(column: ColumnValueType): void {\n\t\t\t\tfor (const row of this.table.rows) {\n\t\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\tthis.removeCell({\n\t\t\t\t\t\tcolumn,\n\t\t\t\t\t\trow: row as RowValueType,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Applies the provided edits in a \"batch\".\n\t\t\t *\n\t\t\t * @remarks\n\t\t\t * For hydrated trees, this will be done in a transaction to ensure atomicity.\n\t\t\t *\n\t\t\t * Transactions are not supported for unhydrated trees, so we cannot run a transaction in that case.\n\t\t\t * But since there are no collaborators, this is not an issue.\n\t\t\t */\n\t\t\t#applyEditsInBatch(applyEdits: () => void): void {\n\t\t\t\tconst branch = TreeAlpha.branch(this);\n\n\t\t\t\t// Ensure events are paused until all of the edits are applied.\n\t\t\t\t// This ensures that the user sees the corresponding table-level edit as atomic,\n\t\t\t\t// and ensures they are not spammed with intermediate events.\n\t\t\t\twithBufferedTreeEvents(() => {\n\t\t\t\t\tif (branch === undefined) {\n\t\t\t\t\t\t// If this node does not have a corresponding branch, then it is unhydrated.\n\t\t\t\t\t\t// I.e., it is not part of a collaborative session yet.\n\t\t\t\t\t\t// Therefore, we don't need to run the edits as a transaction.\n\t\t\t\t\t\tapplyEdits();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbranch.runTransaction(() => {\n\t\t\t\t\t\t\tapplyEdits();\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Column node or ID to a Column node in the table.\n\t\t\t * Returns `undefined` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\t#tryGetColumn(\n\t\t\t\tcolumnOrIdOrIndex: ColumnValueType | string | number,\n\t\t\t): ColumnValueType | undefined {\n\t\t\t\tif (typeof columnOrIdOrIndex === \"number\") {\n\t\t\t\t\tif (columnOrIdOrIndex < 0 || columnOrIdOrIndex >= this.table.columns.length) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\treturn this.table.columns[columnOrIdOrIndex] as ColumnValueType;\n\t\t\t\t}\n\n\t\t\t\tif (typeof columnOrIdOrIndex === \"string\") {\n\t\t\t\t\tconst columnId = columnOrIdOrIndex;\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\treturn this.table.columns.find((col) => (col as ColumnValueType).id === columnId) as\n\t\t\t\t\t\t| ColumnValueType\n\t\t\t\t\t\t| undefined;\n\t\t\t\t}\n\n\t\t\t\t// If the user provided a node, ensure it actually exists in this table.\n\t\t\t\tif (!this.table.columns.includes(columnOrIdOrIndex)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn columnOrIdOrIndex;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Column node or ID to a Column node in the table.\n\t\t\t * @throws Throws a `UsageError` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\t#getColumn(columnOrIdOrIndex: ColumnValueType | string | number): ColumnValueType {\n\t\t\t\tconst column = this.#tryGetColumn(columnOrIdOrIndex);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tTable._throwMissingColumnError(columnOrIdOrIndex);\n\t\t\t\t}\n\t\t\t\treturn column;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Throw a `UsageError` for a missing Column by its ID or index.\n\t\t\t */\n\t\t\tprivate static _throwMissingColumnError(\n\t\t\t\tcolumnOrIdOrIndex: ColumnValueType | string | number,\n\t\t\t): never {\n\t\t\t\tif (typeof columnOrIdOrIndex === \"number\") {\n\t\t\t\t\tthrow new UsageError(`No column exists at index ${columnOrIdOrIndex}.`);\n\t\t\t\t}\n\n\t\t\t\tif (typeof columnOrIdOrIndex === \"string\") {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`No column with ID \"${columnOrIdOrIndex}\" exists in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`The specified column node with ID \"${columnOrIdOrIndex.id}\" does not exist in the table.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Row node or ID to a Row node in the table.\n\t\t\t * Returns `undefined` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\t#tryGetRow(rowOrIdOrIndex: RowValueType | string | number): RowValueType | undefined {\n\t\t\t\tif (typeof rowOrIdOrIndex === \"number\") {\n\t\t\t\t\tif (rowOrIdOrIndex < 0 || rowOrIdOrIndex >= this.table.rows.length) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\treturn this.table.rows[rowOrIdOrIndex] as RowValueType;\n\t\t\t\t}\n\n\t\t\t\tif (typeof rowOrIdOrIndex === \"string\") {\n\t\t\t\t\tconst rowId = rowOrIdOrIndex;\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\treturn this.table.rows.find((row) => (row as RowValueType).id === rowId) as\n\t\t\t\t\t\t| RowValueType\n\t\t\t\t\t\t| undefined;\n\t\t\t\t}\n\n\t\t\t\t// If the user provided a node, ensure it actually exists in this table.\n\t\t\t\tif (!this.table.rows.includes(rowOrIdOrIndex)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn rowOrIdOrIndex;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Row node, ID, or index to a Row node in the table.\n\t\t\t * @throws Throws a `UsageError` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\t#getRow(rowOrIdOrIndex: RowValueType | string | number): RowValueType {\n\t\t\t\tconst row = this.#tryGetRow(rowOrIdOrIndex);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tTable._throwMissingRowError(rowOrIdOrIndex);\n\t\t\t\t}\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Validates the provided list of new columns being inserted into the table.\n\t\t\t * @throws Throws a `UsageError` if any of the following conditions are met:\n\t\t\t * - A column with a duplicate ID is being inserted.\n\t\t\t */\n\t\t\t#validateNewColumns(newColumns: readonly ColumnInsertableType[]): void {\n\t\t\t\treturn Table._validateNewColumns(\n\t\t\t\t\tnewColumns,\n\t\t\t\t\tnew Set(this.table.columns.map((column) => (column as ColumnValueType).id)),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Validates the provided list of new rows being inserted into the table.\n\t\t\t * @throws Throws a `UsageError` if any of the following conditions are met:\n\t\t\t * - A row with a duplicate ID is being inserted.\n\t\t\t * - A row is being inserted that contains cells for columns that do not exist in the table.\n\t\t\t */\n\t\t\t#validateNewRows(newRows: readonly RowInsertableType[]): void {\n\t\t\t\treturn Table._validateNewRows(\n\t\t\t\t\tnewRows,\n\t\t\t\t\tnew Set(this.table.rows.map((row) => (row as RowValueType).id)),\n\t\t\t\t\tnew Set(this.table.columns.map((column) => (column as ColumnValueType).id)),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Validates the provided list of new columns being inserted into the table.\n\t\t\t * @throws Throws a `UsageError` if any of the following conditions are met:\n\t\t\t * - A column with a duplicate ID is being inserted.\n\t\t\t */\n\t\t\tprivate static _validateNewColumns(\n\t\t\t\tnewColumns: Iterable<ColumnInsertableType>,\n\t\t\t\texistingColumnIds: Set<string>,\n\t\t\t): void {\n\t\t\t\tconst newColumnIds = new Set<string>();\n\t\t\t\tfor (const newColumn of newColumns) {\n\t\t\t\t\t// #region Ensure each column ID is unique\n\t\t\t\t\tconst newColumnId = (newColumn as ColumnValueType).id;\n\t\t\t\t\tif (existingColumnIds.has(newColumnId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Attempted to insert a column with ID \"${newColumnId}\", but a column with that ID already exists in the table.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (newColumnIds.has(newColumnId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Attempted to insert multiple columns with ID \"${newColumnId}\". Column IDs must be unique.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tnewColumnIds.add(newColumnId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Validates the provided list of new rows being inserted into the table.\n\t\t\t * @throws Throws a `UsageError` if any of the following conditions are met:\n\t\t\t * - A row with a duplicate ID is being inserted.\n\t\t\t * - A row is being inserted that contains cells for columns that do not exist in the table.\n\t\t\t */\n\t\t\tprivate static _validateNewRows(\n\t\t\t\tnewRows: Iterable<RowInsertableType>,\n\t\t\t\texistingRowIds: Set<string>,\n\t\t\t\tcolumnIds: Set<string>,\n\t\t\t): void {\n\t\t\t\tconst newRowIds = new Set<string>();\n\t\t\t\tfor (const newRow of newRows) {\n\t\t\t\t\t// #region Ensure each row ID is unique\n\n\t\t\t\t\tconst newRowId = (newRow as RowValueType).id;\n\t\t\t\t\tif (existingRowIds.has(newRowId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Attempted to insert a row with ID \"${newRowId}\", but a row with that ID already exists in the table.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (newRowIds.has(newRowId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Attempted to insert multiple rows with ID \"${newRowId}\". Row IDs must be unique.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tnewRowIds.add(newRowId);\n\n\t\t\t\t\t// #endregion\n\n\t\t\t\t\t// #region If the row contains cells, verify that the table contains the columns for those cells\n\n\t\t\t\t\t// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\tif ((newRow as any).cells !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\tconst keys: string[] = Object.keys((newRow as any).cells);\n\t\t\t\t\t\tfor (const key of keys) {\n\t\t\t\t\t\t\tif (!columnIds.has(key)) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t`Attempted to insert a row containing a cell under column ID \"${key}\", but the table does not contain a column with that ID.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// #endregion\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Throw a `UsageError` for a missing Row by its ID or index.\n\t\t\t */\n\t\t\tprivate static _throwMissingRowError(\n\t\t\t\trowOrIdOrIndex: RowValueType | string | number,\n\t\t\t): never {\n\t\t\t\tif (typeof rowOrIdOrIndex === \"number\") {\n\t\t\t\t\tthrow new UsageError(`No row exists at index ${rowOrIdOrIndex}.`);\n\t\t\t\t}\n\n\t\t\t\tif (typeof rowOrIdOrIndex === \"string\") {\n\t\t\t\t\tthrow new UsageError(`No row with ID \"${rowOrIdOrIndex}\" exists in the table.`);\n\t\t\t\t}\n\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`The specified row node with ID \"${rowOrIdOrIndex.id}\" does not exist in the table.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Set a private symbol on the schema class that marks it as having been generated by this factory.\n\t\t// Column / Row functionality use this to validate that they are being used in a table.\n\t\t// This is effectively a work-around that allows columns and rows to invoke table methods\n\t\t// without having to pass the table as a parameter to their construction, which isn't possible.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t(Table as any)[tableSchemaSymbol] = true;\n\n\t\t// Named interfaces here do not compile.\n\t\ttype Statics = {\n\t\t\t/**\n\t\t\t * Create a table with initial contents.\n\t\t\t * @param initialContents - The initial contents of the table.\n\t\t\t * If not provided, an empty table will be constructed.\n\t\t\t * @remarks Performs the following input validation:\n\t\t\t * - Ensures that any cells specified in the initial rows correspond to existing columns in the initial columns.\n\t\t\t * - Ensures that all column and row IDs are unique.\n\t\t\t */\n\t\t\tcreate<TThis extends TableConstructorType>(\n\t\t\t\tthis: TThis,\n\t\t\t\tinitialContents?:\n\t\t\t\t\t| TableSchema.TableFactoryMethodParameters<\n\t\t\t\t\t\t\tTUserScope,\n\t\t\t\t\t\t\tTCellSchema,\n\t\t\t\t\t\t\tTColumnSchema,\n\t\t\t\t\t\t\tTRowSchema\n\t\t\t\t\t >\n\t\t\t\t\t| undefined,\n\t\t\t): InstanceType<TThis>;\n\t\t} & TableConstructorType;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via eraseSubclassableSchemaDetails to erase internal details.\n\t\tconst TableSchemaType = eraseSchemaDetailsSubclassable<TableValueType, Statics>()(Table);\n\n\t\t// Return the table schema\n\t\treturn TableSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @alpha\n\t */\n\texport type TableSchemaBase<\n\t\tTUserScope extends string,\n\t\tTCellSchema extends ImplicitAllowedTypes,\n\t\tTColumnSchema extends ColumnSchemaBase<TUserScope, TCellSchema>,\n\t\tTRowSchema extends RowSchemaBase<TUserScope, TCellSchema>,\n\t> = ReturnType<typeof createTableSchema<TUserScope, TCellSchema, TColumnSchema, TRowSchema>>;\n\n\t// #endregion\n}\n\nfunction createTableScopedFactory<TUserScope extends string>(\n\tinputSchemaFactory: SchemaFactoryBeta<TUserScope>,\n): SchemaFactoryBeta<`${typeof baseSchemaScope}<${TUserScope}>`> {\n\treturn new SchemaFactoryBeta(`${baseSchemaScope}<${inputSchemaFactory.scope}>`);\n}\n\n/**\n * Removes the specified range of elements from the array.\n * @returns The removed elements.\n */\nfunction removeRangeFromArray<TNodeSchema extends ImplicitAllowedTypes>(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: TreeArrayNode<TNodeSchema>,\n\tmethodName: string,\n): TreeNodeFromImplicitAllowedTypes<TNodeSchema>[] {\n\tvalidateIndexRange(startIndex, endIndex, array, methodName);\n\n\t// TypeScript is unable to narrow the array element type correctly here, hence the cast.\n\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\tconst removedRows = array.slice(\n\t\tstartIndex,\n\t\tendIndex,\n\t) as TreeNodeFromImplicitAllowedTypes<TNodeSchema>[];\n\tarray.removeRange(startIndex, endIndex);\n\n\treturn removedRows;\n}\n\n/**\n * Contains types and factories for creating schema to represent dynamic tabular data.\n *\n * @remarks\n *\n * WARNING: These APIs are in preview and are subject to change.\n * Until these APIs have stabilized, it is not recommended to use them in production code.\n * There may be breaking changes to these APIs and their underlying data format.\n * Using these APIs in production code may result in data loss or corruption.\n *\n * The primary APIs for create tabular data schema are:\n *\n * - {@link TableSchema.(table:1)}\n *\n * - {@link TableSchema.(column:1)}\n *\n * - {@link TableSchema.(row:1)}\n *\n * Tables created using these APIs are...\n *\n * - sparse, meaning that cells may be omitted, and new rows are empty by default.\n *\n * - dynamic, meaning that their structure can be modified at runtime.\n * Columns and rows can be inserted, removed, modified, and reordered.\n * Cells can be inserted, removed, and modified.\n *\n * - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.\n *\n * Column and Row schema created using these APIs are extensible via the `props` field.\n * This allows association of additional properties with column and row nodes.\n *\n * Cells in the table may become \"orphaned.\"\n * That is, it is possible to enter a state where one or more rows contain cells with no corresponding column.\n * To reduce the likelihood of this, you can manually remove corresponding cells when removing columns.\n * Either way, it is possible to enter such a state via the merging of edits.\n * For example: one client might add a row while another concurrently removes a column, orphaning the cell where the column and row intersected.\n *\n * @example Defining a Table schema\n *\n * ```typescript\n * class MyTable extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: schemaFactory.string,\n * }) {}\n *\n * const table = MyTable.create({\n * \tcolumns: [{ id: \"column-0\" }],\n * \trows: [{ id: \"row-0\", cells: { \"column-0\": \"Hello world!\" } }],\n * });\n * ```\n *\n * @example Customizing Column and Row schema\n *\n * ```typescript\n * const Cell = schemaFactory.string;\n *\n * class MyColumn extends TableSchema.column({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tprops: schemaFactory.object(\"TableColumnProps\", {\n * \t\tlabel: schemaFactory.string,\n * \t}),\n * }) {}\n *\n * class MyRow extends TableSchema.row({\n * \tschemaFactory,\n * \tcell: Cell,\n * }) {}\n *\n * class MyTable extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tcolumn: MyColumn,\n * \trow: MyRow,\n * }) {}\n *\n * const table = new MyTable({\n * \tcolumns: [\n * \t\tnew MyColumn({ props: { label: \"Entry\" } }),\n * \t\tnew MyColumn({ props: { label: \"Date\" } }),\n * \t\tnew MyColumn({ props: { label: \"Amount\" } }),\n * \t],\n * \trows: [],\n * });\n * ```\n *\n * @example Listening for changes in the table\n *\n * ```typescript\n * // Listen for any changes to the table and its children.\n * // The \"treeChanged\" event will fire when the associated node or any of its descendants change.\n * Tree.on(table, \"treeChanged\", () => {\n * \t// Respond to the change.\n * });\n * ```\n *\n * @example Listening for changes to the rows list only\n *\n * ```typescript\n * // Listen for any changes to the list of rows.\n * // The \"nodeChanged\" event will fire only when the specified node itself changes (i.e., its own properties change).\n * // In this case, the event will fire when a row is added or removed, or the order of the list is changed.\n * // But it won't fire when a row's properties change, or when the row's cells change, etc.\n * Tree.on(table.rows, \"nodeChanged\", () => {\n * \t// Respond to the change.\n * });\n * ```\n *\n * @privateRemarks\n * The above examples are backed by tests in `tableSchema.spec.ts`.\n * Those tests and these examples should be kept in-sync to ensure that the examples are correct.\n *\n * @alpha\n */\nexport namespace TableSchema {\n\t// #region Column\n\n\t/**\n\t * A column in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(column:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @sealed @alpha\n\t */\n\texport interface Column<\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Reserving this for future use.\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the column.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * The column's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createColumnSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<TProps>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<TProps>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @alpha\n\t */\n\texport function column<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t>,\n\t): System_TableSchema.ColumnSchemaBase<\n\t\tTUserScope,\n\t\tTCell,\n\t\tSystem_TableSchema.DefaultPropsType\n\t>;\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @alpha\n\t */\n\texport function column<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\t/**\n\t\t\t * Optional column properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.ColumnSchemaBase<TUserScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function column({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateColumnOptionsBase & {\n\t\treadonly props?: ImplicitFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createColumnSchema(schemaFactory, props);\n\t}\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * A row in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(row:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @sealed @alpha\n\t */\n\texport interface Row<\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Reserving this for future use.\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the row.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * The row's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the row.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createRowSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<TProps>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<TProps>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @alpha\n\t */\n\texport function row<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t>,\n\t): System_TableSchema.RowSchemaBase<TUserScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table row schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @alpha\n\t */\n\texport function row<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\t/**\n\t\t\t * Optional row properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.RowSchemaBase<TUserScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function row({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateRowOptionsBase & {\n\t\treadonly props?: ImplicitFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createRowSchema(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * A key to uniquely identify a cell within a table.\n\t * @input @alpha\n\t */\n\texport interface CellKey<\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * {@link TableSchema.Column}, {@link TableSchema.Column.id}, or column index at which the cell is located.\n\t\t */\n\t\treadonly column: string | number | TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * {@link TableSchema.Row}, {@link TableSchema.Row.id}, or row index at which the cell is located.\n\t\t */\n\t\treadonly row: string | number | TreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumns} parameters.\n\t * @input @alpha\n\t */\n\texport interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new columns.\n\t\t * @remarks If not provided, the columns will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The columns to insert.\n\t\t */\n\t\treadonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRows} parameters.\n\t * @input @alpha\n\t */\n\texport interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new rows.\n\t\t * @remarks If not provided, the rows will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The rows to insert.\n\t\t */\n\t\treadonly rows: InsertableTreeNodeFromImplicitAllowedTypes<TRow>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.setCell} parameters.\n\t * @input @alpha\n\t */\n\texport interface SetCellParameters<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The key to uniquely identify a cell in a table.\n\t\t */\n\t\treadonly key: CellKey<TColumn, TRow>;\n\n\t\t/**\n\t\t * The cell to set.\n\t\t */\n\t\treadonly cell: InsertableTreeNodeFromImplicitAllowedTypes<TCell>;\n\t}\n\n\t/**\n\t * A table.\n\t *\n\t * @remarks Table schema is created via the {@link TableSchema.(table:1)} factory.\n\t * Node instances of the schema type should be constructed via the static `create` method on the schema class.\n\t * E.g. `const table = MyTableSchema.create({ columns, rows});`\n\t *\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t *\n\t * @sealed @alpha\n\t */\n\texport interface Table<\n\t\tTUserScope extends string,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends System_TableSchema.ColumnSchemaBase<TUserScope, TCell>,\n\t\tTRow extends System_TableSchema.RowSchemaBase<TUserScope, TCell>,\n\t> {\n\t\t/**\n\t\t * The table's columns.\n\t\t */\n\t\treadonly columns: System_TableSchema.RearrangeableList<TColumn>;\n\n\t\t/**\n\t\t * The table's rows.\n\t\t */\n\t\treadonly rows: System_TableSchema.RearrangeableList<TRow>;\n\n\t\t/**\n\t\t * Gets a table column by its {@link TableSchema.Column.id}.\n\t\t * @returns The column, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;\n\t\t/**\n\t\t * Gets a table column by its index in the table.\n\t\t * @returns The column, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetColumn(index: number): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;\n\n\t\t/**\n\t\t * Gets a table row by its {@link TableSchema.Row.id}.\n\t\t * @returns The row, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;\n\t\t/**\n\t\t * Gets a table row by its index in the table.\n\t\t * @returns The row, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetRow(index: number): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;\n\n\t\t/**\n\t\t * Gets a cell in the table by corresponding column and row.\n\t\t * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.\n\t\t * @returns The cell, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Inserts 0 or more columns into the table.\n\t\t *\n\t\t * @throws Throws an error if the specified index is out of range.\n\t\t *\n\t\t * No columns are inserted in this case.\n\t\t */\n\t\tinsertColumns(\n\t\t\tparams: InsertColumnsParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Inserts 0 or more rows into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No rows are inserted in these cases.\n\t\t */\n\t\tinsertRows(params: InsertRowsParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Sets the cell at the specified location in the table.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Table.removeCell} instead.\n\t\t */\n\t\tsetCell(params: SetCellParameters<TCell, TColumn, TRow>): void;\n\n\t\t/**\n\t\t * Removes a range of columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t * @param index - The starting index of the range to remove. Default: `0`.\n\t\t * @param count - The number of columns to remove. Default: all remaining columns starting from `index`.\n\t\t * @throws Throws an error if the specified range is invalid. In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tindex?: number | undefined,\n\t\t\tcount?: number | undefined,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param columns - The columns to remove.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tcolumns: readonly TreeNodeFromImplicitAllowedTypes<TColumn>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param columns - The columns to remove, specified by their {@link TableSchema.Column.id}.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes a range of rows from the table.\n\t\t * @param index - The starting index of the range to remove. Default: `0`.\n\t\t * @param count - The number of rows to remove. Default: all remaining rows starting from `index`.\n\t\t * @throws Throws an error if the specified range is invalid. In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\tindex?: number | undefined,\n\t\t\tcount?: number | undefined,\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\trows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove, specified by their {@link TableSchema.Row.id}.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes the cell at the specified location in the table.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @throws Throws an error if the location does not exist in the table.\n\t\t */\n\t\tremoveCell(\n\t\t\tkey: CellKey<TColumn, TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t}\n\n\t/**\n\t * Input parameters for {@link TableSchema.Table}'s `create` factory method.\n\t * @input @alpha\n\t */\n\texport interface TableFactoryMethodParameters<\n\t\tTUserScope extends string,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends System_TableSchema.ColumnSchemaBase<TUserScope, TCell>,\n\t\tTRow extends System_TableSchema.RowSchemaBase<TUserScope, TCell>,\n\t> {\n\t\t/**\n\t\t * Initial columns for the table.\n\t\t */\n\t\treadonly columns?:\n\t\t\t| Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>>\n\t\t\t| undefined;\n\n\t\t/**\n\t\t * Initial rows for the table.\n\t\t * @remarks If any cells are specified, they will be validated against the IDs of the provided columns.\n\t\t */\n\t\treadonly rows?: Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>> | undefined;\n\t}\n\n\t/**\n\t * Factory for creating new table schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t>,\n\t): System_TableSchema.TableSchemaBase<\n\t\tTUserScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<\n\t\t\tTUserScope,\n\t\t\tTCell,\n\t\t\tSystem_TableSchema.DefaultPropsType\n\t\t>,\n\t\tSystem_TableSchema.RowSchemaBase<TUserScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TUserScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\treadonly column: TColumn;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTUserScope,\n\t\tTCell,\n\t\tTColumn,\n\t\tSystem_TableSchema.RowSchemaBase<TUserScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom row schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TUserScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTUserScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<\n\t\t\tTUserScope,\n\t\t\tTCell,\n\t\t\tSystem_TableSchema.DefaultPropsType\n\t\t>,\n\t\tTRow\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column and row schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @alpha\n\t */\n\texport function table<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TUserScope, TCell>,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TUserScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\treadonly column: TColumn;\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<TUserScope, TCell, TColumn, TRow>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function table({\n\t\tschemaFactory,\n\t\tcell: cellSchema,\n\t\tcolumn: columnSchema = column({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t\trow: rowSchema = row({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t}: System_TableSchema.TableFactoryOptionsBase & {\n\t\treadonly column?: System_TableSchema.ColumnSchemaBase;\n\t\treadonly row?: System_TableSchema.RowSchemaBase;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createTableSchema(\n\t\t\tschemaFactory,\n\t\t\tcellSchema,\n\t\t\tcolumnSchema,\n\t\t\trowSchema,\n\t\t);\n\t}\n\n\t// #endregion\n}\n"]}
1
+ {"version":3,"file":"tableSchema.js","sourceRoot":"","sources":["../src/tableSchema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;AAEH,kEAA2D;AAC3D,uEAAsE;AAEtE,8CAA2C;AAC3C,qDAAmD;AAEnD,qDA2BgC;AAChC,8CAAoE;AAgCpE;;;;;;;;;;;;;;;;GAgBG;AACH,IAAiB,kBAAkB,CAkrClC;AAlrCD,WAAiB,kBAAkB;IAkFlC;;;OAGG;IACH,sIAAsI;IACtI,SAAgB,kBAAkB,CAIhC,kBAAiD,EAAE,WAAyB;QAC7E,MAAM,aAAa,GAAG,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;QAGnE,gFAAgF;QAChF,yCAAyC;QACzC,kDAAkD;QAClD,MAAM,wBAAwB,GAAG;YAChC,EAAE,EAAE,aAAa,CAAC,UAAU;SACnB,CAAC;QACX,MAAM,qBAAqB,GAAG;YAC7B,KAAK,EAAE,WAAW;SACT,CAAC;QAEX;;;;;;;;;;WAUG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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiHG;AACH,IAAiB,WAAW,CAslB3B;AAtlBD,WAAiB,WAAW;IAC3B,iBAAiB;IA0EjB;;OAEG;IACH,SAAgB,MAAM,CAAC,EACtB,aAAa,EACb,IAAI,EACJ,KAAK,GAAG,wBAAa,CAAC,QAAQ,CAAC,wBAAa,CAAC,IAAI,CAAC,GAGlD;QACA,OAAO,kBAAkB,CAAC,kBAAkB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;IARe,kBAAM,SAQrB,CAAA;IA0ED;;OAEG;IACH,SAAgB,GAAG,CAAC,EACnB,aAAa,EACb,IAAI,EACJ,KAAK,GAAG,wBAAa,CAAC,QAAQ,CAAC,wBAAa,CAAC,IAAI,CAAC,GAGlD;QACA,OAAO,kBAAkB,CAAC,eAAe,CAAC,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,CAAC;IARe,eAAG,MAQlB,CAAA;IAgZD;;OAEG;IACH,SAAgB,KAAK,CAAC,EACrB,aAAa,EACb,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,YAAY,GAAG,MAAM,CAAC;QAC7B,aAAa;QACb,IAAI,EAAE,UAAU;KAChB,CAAC,EACF,GAAG,EAAE,SAAS,GAAG,GAAG,CAAC;QACpB,aAAa;QACb,IAAI,EAAE,UAAU;KAChB,CAAC,GAIF;QACA,OAAO,kBAAkB,CAAC,iBAAiB,CAC1C,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,CACT,CAAC;IACH,CAAC;IArBe,iBAAK,QAqBpB,CAAA;IAED,aAAa;AACd,CAAC,EAtlBgB,WAAW,2BAAX,WAAW,QAslB3B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fail } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey } from \"./core/index.js\";\nimport { TreeAlpha } from \"./shared-tree/index.js\";\nimport type { SchemaFactoryBeta } from \"./simple-tree/index.js\";\nimport {\n\ttype FieldHasDefault,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableObjectFromSchemaRecord,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeKind,\n\ttype ScopedSchemaName,\n\tTreeArrayNode,\n\ttype TreeNode,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\ttype TreeNodeSchema,\n\ttype TreeNodeSchemaClass,\n\ttype WithType,\n\ttype TreeFieldFromImplicitField,\n\ttype InsertableTreeFieldFromImplicitField,\n\ttype InternalTreeNode,\n\tSchemaFactory,\n\tscoped,\n\ttype ImplicitFieldSchema,\n\twithBufferedTreeEvents,\n\ttype TreeRecordNode,\n\tobjectSchema,\n\teraseSchemaDetailsSubclassable,\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-imports -- This makes the API report slightly cleaner.\n\tTreeNodeSchemaCore,\n\ttype TransactionConstraintAlpha,\n\tcreateCustomizedFluidFrameworkScopedFactory,\n} from \"./simple-tree/index.js\";\nimport { validateIndex, validateIndexRange } from \"./util/index.js\";\n\n// Future improvement TODOs:\n// - Omit `cells` property from Row insertion type.\n// - Record-like type parameters / input parameters?\n// - Omit `props` properties from Row and Column schemas when not provided?\n\n// Longer-term work:\n// - Use more focused constraint APIs to protect against leaked cells\n\n/**\n * A row in a table.\n * @typeParam TCellSchema - The type of the cells in the {@link TableSchema.Table}.\n * @typeParam TPropsSchema - Additional properties to associate with the row.\n * @privateRemarks Private counterpart to the {@link TableSchema.Row}.\n * Exposes internal properties needed for table operations (publicly exposed via {@link TableSchema.Table}).\n * @sealed\n */\nexport interface RowPrivate<\n\tTCellSchema extends ImplicitAllowedTypes,\n\tTPropsSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n> extends TableSchema.Row<TCellSchema, TPropsSchema> {\n\t/**\n\t * The row's cells.\n\t * @remarks This is a user-defined schema that can be used to store additional information about the row.\n\t * @privateRemarks\n\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createRowSchema}.\n\t * If you update the docs here, please also update the inline type definitions.\n\t */\n\treadonly cells: TreeRecordNode<TCellSchema>;\n}\n\n/**\n * Not intended for use outside of this package.\n *\n * @privateRemarks\n * This namespace is a collection of internal system types relate to {@link TableSchema}.\n * This namespace should be strictly type-exported by the package.\n * All members should be tagged with `@system`.\n *\n * Orphaned Cells:\n * Without safeguards, it is possible for cells to become \"orphaned\".\n * An orphaned cell is a cell that does not correspond to a valid row and column.\n * In order to preserve the invariant that all cells must have a valid row and column, table operations\n * (eg, inserting/removing rows/columns, or setting/removing a cell) will automatically include constraints that\n * guard transactions from producing orphaned cells.\n *\n * @system @beta\n */\nexport namespace System_TableSchema {\n\t/**\n\t * A list of items in a table whose elements may be rearranged, but not inserted or removed.\n\t *\n\t * @privateRemarks Used by {@link TableSchema.Table} for its `rows` and `columns` properties to allow basic rearrangement operations on the underlying sequences without permitting mutation operations that might violate table invariants.\n\t *\n\t * Note: this can't reasonably be implemented via `Pick<ArrayNode<...>>` because we only want to include the\n\t * subset of its method overloads which do not support moving items between lists.\n\t *\n\t * @beta @system\n\t */\n\texport type RearrangeableList<TItemSchema extends ImplicitAllowedTypes> = TreeNode &\n\t\treadonly TreeNodeFromImplicitAllowedTypes<TItemSchema>[] & {\n\t\t\t// #region Capture the subset of item rearrangement methods from `TreeArrayNode` that do not allow moving between lists.\n\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveToEnd:1)} */\n\t\t\tmoveToEnd(sourceIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveToStart:1)} */\n\t\t\tmoveToStart(sourceIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveToIndex:1)} */\n\t\t\tmoveToIndex(sourceIndex: number, destinationIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveRangeToEnd:1)} */\n\t\t\tmoveRangeToEnd(startIndex: number, endIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveRangeToStart:1)} */\n\t\t\tmoveRangeToStart(startIndex: number, endIndex: number): void;\n\t\t\t/** {@inheritDoc (TreeArrayNode:interface).(moveRangeToIndex:1)} */\n\t\t\tmoveRangeToIndex(startIndex: number, endIndex: number, destinationIndex: number): void;\n\n\t\t\t// #endregion\n\t\t};\n\n\t/**\n\t * Default type used for column and row \"props\" fields.\n\t * @privateRemarks\n\t * Longer term, it would be better to simply omit \"props\" altogether by default.\n\t * For now, this ensures that the user doesn't have to specify a \"props\" entry when initializing column/row nodes\n\t * and ensures that they cannot set anything that might conflict with future evolutions of the schema.\n\t * @system @beta\n\t */\n\texport type DefaultPropsType = ReturnType<typeof SchemaFactory.optional<[]>>;\n\n\t/**\n\t * A base interface for factory input options which include an schema factory.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @beta\n\t */\n\texport interface OptionsWithSchemaFactory<TSchemaFactory extends SchemaFactoryBeta> {\n\t\t/**\n\t\t * Schema factory with which the Column schema will be associated.\n\t\t * @remarks Can be used to associate the resulting schema with an existing {@link SchemaFactory.scope|scope}.\n\t\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.<Column|Row|Table>`.\n\t\t */\n\t\treadonly schemaFactory: TSchemaFactory;\n\t}\n\n\t/**\n\t * A base interface for factory input options which include the table cell schema.\n\t * @remarks This interface should not be referenced directly.\n\t * @privateRemarks This interface primarily exists to provide a single home for property documentation.\n\t * @system @beta\n\t */\n\texport interface OptionsWithCellSchema<TCellSchema extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * Schema for the table's cells.\n\t\t */\n\t\treadonly cell: TCellSchema;\n\t}\n\n\t// #region Column\n\n\t/**\n\t * Base options for creating table column schema.\n\t * @remarks Includes parameters common to all column factory overloads.\n\t * @system @beta\n\t */\n\texport type CreateColumnOptionsBase<\n\t\tTUserScope extends string = string,\n\t\tTSchemaFactory extends SchemaFactoryBeta<TUserScope> = SchemaFactoryBeta<TUserScope>,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCellSchema>;\n\n\t/**\n\t * Factory for creating column schema.\n\t * @system @beta\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createColumnSchema<\n\t\tconst TUserScope extends string,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitFieldSchema,\n\t>(inputSchemaFactory: SchemaFactoryBeta<TUserScope>, propsSchema: TPropsSchema) {\n\t\tconst schemaFactory = createTableScopedFactory(inputSchemaFactory);\n\t\ttype Scope = typeof schemaFactory.scope;\n\n\t\t// Note: `columnFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `ColumnInsertableType` below.\n\t\tconst columnFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t} as const;\n\t\tconst columnFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link Column} fields.\n\t\t *\n\t\t * @remarks\n\t\t * Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t *\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst columnFields = {\n\t\t\t...columnFieldsBuiltInParts,\n\t\t\t...columnFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * A column in a table.\n\t\t */\n\t\tclass Column\n\t\t\textends schemaFactory.object(\"Column\", columnFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements TableSchema.Column<TCellSchema, TPropsSchema> {}\n\n\t\ttype ColumnValueType = TreeNode &\n\t\t\tTableSchema.Column<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Column\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof columnFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around the issue.\n\t\t// type ColumnInsertableType = InsertableObjectFromSchemaRecord<typeof columnFields>;\n\t\ttype ColumnInsertableType = InsertableObjectFromSchemaRecord<\n\t\t\ttypeof columnFieldsBuiltInParts\n\t\t> &\n\t\t\t(FieldHasDefault<TPropsSchema> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IColumn.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<TPropsSchema>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The column's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<TPropsSchema>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Column` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype ColumnSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof Column]: (typeof Column)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | ColumnInsertableType,\n\t\t\t) => Column) & {\n\t\t\t\tcreateFromInsertable(parameters: ColumnInsertableType): Column;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst ColumnSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Column\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ ColumnValueType,\n\t\t\t/* TInsertable */ object & ColumnInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof columnFields\n\t\t> = Column as ColumnSchemaModifiedType;\n\n\t\treturn ColumnSchemaType;\n\t}\n\n\t/**\n\t * Base column schema type.\n\t * @sealed @system @beta\n\t */\n\texport type ColumnSchemaBase<\n\t\tTUserScope extends string = string,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t> = ReturnType<typeof createColumnSchema<TUserScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * Base options for creating table row schema.\n\t * @remarks Includes parameters common to all row factory overloads.\n\t * @system @beta\n\t */\n\texport type CreateRowOptionsBase<\n\t\tTUserScope extends string = string,\n\t\tTSchemaFactory extends SchemaFactoryBeta<TUserScope> = SchemaFactoryBeta<TUserScope>,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCellSchema>;\n\n\t/**\n\t * Factory for creating row schema.\n\t * @system @beta\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createRowSchema<\n\t\tconst TUserScope extends string,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TPropsSchema extends ImplicitFieldSchema,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryBeta<TUserScope>,\n\t\tcellSchema: TCellSchema,\n\t\tpropsSchema: TPropsSchema,\n\t) {\n\t\tconst schemaFactory = createTableScopedFactory(inputSchemaFactory);\n\t\ttype Scope = typeof schemaFactory.scope;\n\n\t\t// Note: `rowFields` is broken into two parts to work around a TypeScript bug\n\t\t// that results in broken `.d.ts` output.\n\t\t// See definition of `RowInsertableType` below.\n\t\tconst rowFieldsBuiltInParts = {\n\t\t\tid: schemaFactory.identifier,\n\t\t\t/**\n\t\t\t * The cells of the table row, keyed by column ID.\n\t\t\t * @remarks\n\t\t\t * The table row models its cells as a record, where each key is the ID of the column it belongs to. The choice of record (as opposed to a map) is intended to make interop with common table rendering libraries in TypeScript/JavaScript easier.\n\t\t\t */\n\t\t\tcells: schemaFactory.required(schemaFactory.record(\"Row.cells\", cellSchema), {\n\t\t\t\tmetadata: {\n\t\t\t\t\tdescription: \"The cells of the table row, keyed by column ID.\",\n\t\t\t\t},\n\t\t\t}),\n\t\t} as const;\n\t\tconst rowFieldsPropsPart = {\n\t\t\tprops: propsSchema,\n\t\t} as const;\n\n\t\t/**\n\t\t * {@link RowSchema} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t * Note: ideally we would add a satisfies clause here to ensure that this satisfies\n\t\t * `Record<string, ImplicitFieldSchema>`, but doing so causes TypeScript to prematurely and incorrectly evaluate the type of `propsSchema`.\n\t\t * Likely related to the following issue: https://github.com/microsoft/TypeScript/issues/52394\n\t\t */\n\t\tconst rowFields = {\n\t\t\t...rowFieldsBuiltInParts,\n\t\t\t...rowFieldsPropsPart,\n\t\t} as const; // satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * The Row schema - this is a map of Cells where the key is the column id\n\t\t */\n\t\tclass RowSchema\n\t\t\textends schemaFactory.object(\"Row\", rowFields, {\n\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t})\n\t\t\timplements RowPrivate<TCellSchema, TPropsSchema> {}\n\n\t\ttype RowValueType = TreeNode &\n\t\t\tTableSchema.Row<TCellSchema, TPropsSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"Row\">>;\n\n\t\t// Note: ideally this type would just leverage `InsertableObjectFromSchemaRecord<typeof rowFields>`,\n\t\t// but that results in broken `.d.ts` output due to a TypeScript bug.\n\t\t// See: https://github.com/microsoft/TypeScript/issues/58688.\n\t\t// Instead we extract and inline the typing of the \"props\" field here, which seems to sufficiently work around\n\t\t// the issue.\n\t\t// type RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFields>;\n\t\ttype RowInsertableType = InsertableObjectFromSchemaRecord<typeof rowFieldsBuiltInParts> &\n\t\t\t(FieldHasDefault<TPropsSchema> extends true\n\t\t\t\t? // Note: The docs on the below properties are copied from `IRow.props`' docs to ensure that the\n\t\t\t\t\t// documentation appears in the data insertion scenario.\n\t\t\t\t\t// The contents are duplicated instead of using `@inheritdoc`, as intellisense does not correctly\n\t\t\t\t\t// support `@inheritDoc`.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/31267\n\t\t\t\t\t{\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops?: InsertableTreeFieldFromImplicitField<TPropsSchema>;\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * The row's properties.\n\t\t\t\t\t\t * @remarks This is a user-defined schema that can be used to store additional information\n\t\t\t\t\t\t * about the row.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tprops: InsertableTreeFieldFromImplicitField<TPropsSchema>;\n\t\t\t\t\t});\n\n\t\t// Modified version of `Row` that ensures the constructor (and `createFromInsertable`) are\n\t\t// typed correctly in terms of our insertable type.\n\t\t// This lets us be selective in our type-cast for the value returned from this function,\n\t\t// preserving as much type-safety as we reasonably can.\n\t\ttype RowSchemaModifiedType = Omit<\n\t\t\t// Use mapped type to omit the constructor\n\t\t\t{\n\t\t\t\t[Property in keyof typeof RowSchema]: (typeof RowSchema)[Property];\n\t\t\t},\n\t\t\t\"createFromInsertable\"\n\t\t> &\n\t\t\t(new (\n\t\t\t\tparameters: InternalTreeNode | RowInsertableType,\n\t\t\t) => RowSchema) & {\n\t\t\t\tcreateFromInsertable(parameters: RowInsertableType): RowSchema;\n\t\t\t};\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via assignment instead of `as` to get stronger type safety.\n\t\tconst RowSchemaType: TreeNodeSchemaClass<\n\t\t\t/* Name */ ScopedSchemaName<Scope, \"Row\">,\n\t\t\t/* Kind */ NodeKind.Object,\n\t\t\t/* TNode */ RowValueType,\n\t\t\t/* TInsertable */ object & RowInsertableType,\n\t\t\t/* ImplicitlyConstructable */ true,\n\t\t\t/* Info */ typeof rowFields\n\t\t> = RowSchema as RowSchemaModifiedType;\n\n\t\treturn RowSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @beta\n\t */\n\texport type RowSchemaBase<\n\t\tTUserScope extends string = string,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t\tTPropsSchema extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t> = ReturnType<typeof createRowSchema<TUserScope, TCellSchema, TPropsSchema>>;\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * Base options for creating table schema.\n\t * @remarks Includes parameters common to all table factory overloads.\n\t * @system @beta\n\t */\n\texport type TableFactoryOptionsBase<\n\t\tTUserScope extends string = string,\n\t\tTSchemaFactory extends SchemaFactoryBeta<TUserScope> = SchemaFactoryBeta<TUserScope>,\n\t\tTCellSchema extends ImplicitAllowedTypes = ImplicitAllowedTypes,\n\t> = OptionsWithSchemaFactory<TSchemaFactory> & OptionsWithCellSchema<TCellSchema>;\n\n\t/**\n\t * Factory for creating table schema.\n\t * @system @beta\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type -- Return type is too complex to be reasonable to specify\n\texport function createTableSchema<\n\t\tconst TUserScope extends string,\n\t\tconst TCellSchema extends ImplicitAllowedTypes,\n\t\tconst TColumnSchema extends ColumnSchemaBase<TUserScope, TCellSchema>,\n\t\tconst TRowSchema extends RowSchemaBase<TUserScope, TCellSchema>,\n\t>(\n\t\tinputSchemaFactory: SchemaFactoryBeta<TUserScope>,\n\t\t_cellSchema: TCellSchema,\n\t\tcolumnSchema: TColumnSchema,\n\t\trowSchema: TRowSchema,\n\t) {\n\t\tconst schemaFactory = createTableScopedFactory(inputSchemaFactory);\n\t\ttype Scope = typeof schemaFactory.scope;\n\n\t\ttype CellValueType = TreeNodeFromImplicitAllowedTypes<TCellSchema>;\n\t\ttype ColumnValueType = TreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\t\ttype ColumnInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TColumnSchema>;\n\t\ttype RowValueType = TreeNodeFromImplicitAllowedTypes<TRowSchema>;\n\t\ttype RowInsertableType = InsertableTreeNodeFromImplicitAllowedTypes<TRowSchema>;\n\n\t\t// Internal version of RowValueType that exposes the `cells` property for use within Table methods.\n\t\ttype RowValueInternalType = RowValueType & RowPrivate<TCellSchema>;\n\n\t\t/**\n\t\t * {@link Table} inner fields.\n\t\t * @remarks Extracted for re-use as construction parameters.\n\t\t * @see {@link Table.create}.\n\t\t */\n\t\tconst tableInnerFields = {\n\t\t\trows: schemaFactory.array(\"Table.rows\", rowSchema),\n\t\t\tcolumns: schemaFactory.array(\"Table.columns\", columnSchema),\n\t\t} as const satisfies Record<string, ImplicitFieldSchema>;\n\n\t\t/**\n\t\t * {@link Table} fields.\n\t\t * @remarks Extracted for re-use in returned type signature defined later in this function.\n\t\t * The implicit typing is intentional.\n\t\t */\n\t\tconst tableFields = {\n\t\t\ttable: schemaFactory.required(schemaFactory.object(\"Table\", tableInnerFields), {\n\t\t\t\t// Use an empty key in the stored schema format to help prevent schema-unaware edits from being\n\t\t\t\t// made to the table, which may violate intended invariants.\n\t\t\t\tkey: EmptyKey,\n\t\t\t}),\n\t\t} as const satisfies Record<string, ImplicitFieldSchema>;\n\n\t\ttype TableValueType = TreeNode &\n\t\t\tTableSchema.Table<TUserScope, TCellSchema, TColumnSchema, TRowSchema> &\n\t\t\tWithType<ScopedSchemaName<Scope, \"TableRoot\">>;\n\t\ttype TableConstructorType = new (data?: InternalTreeNode | undefined) => TableValueType;\n\n\t\t/**\n\t\t * The Table schema\n\t\t */\n\t\tclass Table\n\t\t\t// Calling the objectSchema factory directly rather than using the schemaFactory so we can specify\n\t\t\t// `implicitlyConstructable: false`, which the SchemaFactory APIs do not yet support.\n\t\t\t// TODO: when support for configuring `implicitlyConstructable` is added to SchemaFactory, switch to\n\t\t\t// using that instead.\n\t\t\textends objectSchema(\n\t\t\t\t/* identifier: */ scoped(schemaFactory as SchemaFactory<Scope>, \"TableRoot\"),\n\t\t\t\t/* info: */ tableFields,\n\t\t\t\t/* implicitlyConstructable: */ false,\n\t\t\t\t/* nodeOptions: */ {\n\t\t\t\t\t// Will make it easier to evolve this schema in the future.\n\t\t\t\t\tallowUnknownOptionalFields: true,\n\t\t\t\t},\n\t\t\t)\n\t\t\timplements TableSchema.Table<TUserScope, TCellSchema, TColumnSchema, TRowSchema>\n\t\t{\n\t\t\tpublic constructor(node?: InternalTreeNode | undefined) {\n\t\t\t\tsuper(node ?? { table: { columns: [], rows: [] } });\n\t\t\t}\n\n\t\t\tpublic static create<TThis extends TableConstructorType>(\n\t\t\t\tthis: TThis,\n\t\t\t\tinitialContents?:\n\t\t\t\t\t| TableSchema.TableFactoryMethodParameters<\n\t\t\t\t\t\t\tTUserScope,\n\t\t\t\t\t\t\tTCellSchema,\n\t\t\t\t\t\t\tTColumnSchema,\n\t\t\t\t\t\t\tTRowSchema\n\t\t\t\t\t >\n\t\t\t\t\t| undefined,\n\t\t\t): InstanceType<TThis> {\n\t\t\t\t// #region Input validation\n\n\t\t\t\tconst columns =\n\t\t\t\t\t(initialContents?.columns as Iterable<ColumnInsertableType> | undefined) ?? [];\n\n\t\t\t\tconst columnIds = new Set<string>();\n\t\t\t\tfor (const column of columns) {\n\t\t\t\t\tcolumnIds.add((column as ColumnValueType).id);\n\t\t\t\t}\n\n\t\t\t\tconst rows = (initialContents?.rows as Iterable<RowInsertableType> | undefined) ?? [];\n\n\t\t\t\tTable._validateNewColumns(\n\t\t\t\t\tcolumns,\n\t\t\t\t\t// New table, so no existing columns to validate against\n\t\t\t\t\tnew Set(),\n\t\t\t\t);\n\n\t\t\t\tTable._validateNewRows(\n\t\t\t\t\trows,\n\t\t\t\t\t// New table, so no existing rows to validate against\n\t\t\t\t\tnew Set(),\n\t\t\t\t\t// No existing columns to validate cells against, but we do need to validate the new rows against the new columns\n\t\t\t\t\tcolumnIds,\n\t\t\t\t);\n\n\t\t\t\t// #endregion\n\t\t\t\treturn new this(\n\t\t\t\t\tinitialContents === undefined\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: ({\n\t\t\t\t\t\t\t\ttable: initialContents,\n\t\t\t\t\t\t\t\t// We have typed our constructor to prevent users from calling it directly with insertable contents.\n\t\t\t\t\t\t\t\t// But the base constructor still allows it. Cast to work around this.\n\t\t\t\t\t\t\t} as unknown as InternalTreeNode),\n\t\t\t\t) as InstanceType<TThis>;\n\t\t\t}\n\n\t\t\tpublic get columns(): RearrangeableList<TColumnSchema> {\n\t\t\t\treturn this.table.columns as RearrangeableList<TColumnSchema>;\n\t\t\t}\n\n\t\t\tpublic get rows(): RearrangeableList<TRowSchema> {\n\t\t\t\treturn this.table.rows as RearrangeableList<TRowSchema>;\n\t\t\t}\n\n\t\t\tpublic getColumn(indexOrId: number | string): ColumnValueType | undefined {\n\t\t\t\treturn this.#tryGetColumn(indexOrId);\n\t\t\t}\n\n\t\t\tpublic getRow(indexOrId: number | string): RowValueType | undefined {\n\t\t\t\treturn this.#tryGetRow(indexOrId);\n\t\t\t}\n\n\t\t\tpublic getCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrIdOrIndex, row: rowOrIdOrIndex } = key;\n\t\t\t\tconst row = this.#tryGetRow(rowOrIdOrIndex);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tconst column = this.#tryGetColumn(columnOrIdOrIndex);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn (row as RowValueInternalType).cells[column.id];\n\t\t\t}\n\n\t\t\tpublic insertColumns({\n\t\t\t\tcolumns,\n\t\t\t\tindex,\n\t\t\t}: TableSchema.InsertColumnsParameters<TColumnSchema>): ColumnValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure specified index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tvalidateIndex(index, this.table.columns, \"Table.insertColumns\", true);\n\t\t\t\t}\n\n\t\t\t\t// Ensure the new columns being inserted are valid\n\t\t\t\tthis.#validateNewColumns(columns);\n\n\t\t\t\t// #endregion\n\n\t\t\t\tthis.#applyEditsInBatch({\n\t\t\t\t\tapplyEdits: () => {\n\t\t\t\t\t\t// TypeScript is unable to narrow the column type correctly here, hence the casts below.\n\t\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t\tif (index === undefined) {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tthis.table.columns.insertAtEnd(TreeArrayNode.spread(columns) as any);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tthis.table.columns.insertAt(index, TreeArrayNode.spread(columns) as any);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t// Relevant invariant: each cell corresponds to an existing row and column\n\t\t\t\t\t// Scenarios that this constraint is intended to prevent:\n\t\t\t\t\t// * Client A inserts a column, then client B adds row with a cell for that column, then client A reverts the column insertion.\n\t\t\t\t\t// * Client A inserts a column, then client B populates a cell for that column within an existing row, then client A reverts the column insertion.\n\t\t\t\t\t// Notes:\n\t\t\t\t\t// * In either scenario, A and B may be the same client.\n\t\t\t\t\t// * In either scenario, B's edit and the revert may or may not be concurrent.\n\t\t\t\t\t// Collateral scenarios that this constraint also prevents:\n\t\t\t\t\t// * Any other scenario where client A inserts a column, then client B edits _any_ part of the tree, then client A reverts the column insertion.\n\t\t\t\t\t// Future improvements:\n\t\t\t\t\t// Use both...\n\t\t\t\t\t// * A \"no attach on revert\" constraint on the row array\n\t\t\t\t\t// * A \"no shallow change\" constraint on every cell that corresponds to the new column in every existing row\n\t\t\t\t\tpreconditionsOnRevert: [{ type: \"noChange\" }],\n\t\t\t\t});\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn columns as unknown as ColumnValueType[];\n\t\t\t}\n\n\t\t\tpublic insertRows({\n\t\t\t\tindex,\n\t\t\t\trows,\n\t\t\t}: TableSchema.InsertRowsParameters<TRowSchema>): RowValueType[] {\n\t\t\t\t// #region Input validation\n\n\t\t\t\t// Ensure specified index is valid\n\t\t\t\tif (index !== undefined) {\n\t\t\t\t\tvalidateIndex(index, this.table.rows, \"Table.insertRows\", true);\n\t\t\t\t}\n\n\t\t\t\t// Ensure the new rows being inserted are valid\n\t\t\t\tthis.#validateNewRows(rows);\n\n\t\t\t\t// #endregion\n\n\t\t\t\t// Relevant invariant: each cell corresponds to an existing row and column\n\t\t\t\t// Prevents cell leaks from concurrently removed columns.\n\t\t\t\t// Example scenario: Client A removes a column while concurrently Client B adds a row with cells for those columns (including the one A removed).\n\t\t\t\t// If client B is sequenced after A, then B's row could have cells that do not correspond to existing columns.\n\t\t\t\t// This constraint ensures all columns that existed when creating the row still exist when the row insertion is applied.\n\t\t\t\t// TODO: Replace with \"no detach\" constraint on the column array when available.\n\t\t\t\tconst columnConstraints: TransactionConstraintAlpha[] = this.table.columns.map(\n\t\t\t\t\t(column) => ({\n\t\t\t\t\t\ttype: \"nodeInDocument\",\n\t\t\t\t\t\tnode: column as ColumnValueType,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tthis.#applyEditsInBatch({\n\t\t\t\t\tapplyEdits: () => {\n\t\t\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the casts below.\n\t\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t\tif (index === undefined) {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tthis.table.rows.insertAtEnd(TreeArrayNode.spread(rows) as any);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tthis.table.rows.insertAt(index, TreeArrayNode.spread(rows) as any);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tpreconditions: columnConstraints.length > 0 ? columnConstraints : undefined,\n\t\t\t\t});\n\n\t\t\t\t// Inserting the input nodes into the tree hydrates them, making them usable as nodes.\n\t\t\t\treturn rows as unknown as RowValueType[];\n\t\t\t}\n\n\t\t\tpublic setCell({\n\t\t\t\tkey,\n\t\t\t\tcell,\n\t\t\t}: TableSchema.SetCellParameters<TCellSchema, TColumnSchema, TRowSchema>): void {\n\t\t\t\tconst { column: columnOrId, row: rowOrId } = key;\n\n\t\t\t\tconst row = this.#getRow(rowOrId);\n\t\t\t\tconst column = this.#getColumn(columnOrId);\n\n\t\t\t\tthis.#applyEditsInBatch({\n\t\t\t\t\tapplyEdits: () => {\n\t\t\t\t\t\t(row as RowValueInternalType).cells[column.id] = cell as CellValueType;\n\t\t\t\t\t},\n\t\t\t\t\t// Relevant invariant: each cell corresponds to an existing row and column\n\t\t\t\t\t// Prevents cell leaks from concurrently removed columns in earlier-sequenced edits.\n\t\t\t\t\t// Example scenario: Client A removes a column, then Client B concurrently sets a cell in that column (sequenced after A's edit).\n\t\t\t\t\t// If both edits are applied, B's cell would not correspond to an existing column.\n\t\t\t\t\tpreconditions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"nodeInDocument\",\n\t\t\t\t\t\t\tnode: column,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\t// Relevant invariant: each cell corresponds to an existing row and column\n\t\t\t\t\t// Example scenario: Client A overwrites a populated cell, then Client B removes the column associated with the A's cell (this clears the cell).\n\t\t\t\t\t// If Client A then reverts their edit, the overwritten value is restored in the cell despite the absence of column for that cell.\n\t\t\t\t\tpreconditionsOnRevert:\n\t\t\t\t\t\t(row as RowValueInternalType).cells[column.id] === undefined\n\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: \"nodeInDocument\",\n\t\t\t\t\t\t\t\t\t\tnode: column,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tpublic removeColumns(\n\t\t\t\tindexOrColumns: number | undefined | readonly string[] | readonly ColumnValueType[],\n\t\t\t\tcount: number | undefined = undefined,\n\t\t\t): ColumnValueType[] {\n\t\t\t\t// Relevant invariant: each cell corresponds to an existing row and column\n\t\t\t\t// Prevents cell leaks from concurrently added rows in earlier-sequenced edits.\n\t\t\t\t// Example scenario: Client A adds a row, Client B concurrently removes a column that is populated in A's row.\n\t\t\t\t// If Client A's edit is sequenced before Client B's edit, then B's removal would orphan the cell in A's row.\n\t\t\t\t// We have the same problem if Client A populates a cell for one of the columns removed by B\n\t\t\t\t// This constraint ensures no rows were added.\n\t\t\t\t// TODO: Replace with \"no attach\" constraint on the row array when available.\n\t\t\t\tconst preconditions: TransactionConstraintAlpha[] = [{ type: \"noChange\" }];\n\n\t\t\t\tif (typeof indexOrColumns === \"number\" || indexOrColumns === undefined) {\n\t\t\t\t\tlet removedColumns: ColumnValueType[] | undefined;\n\t\t\t\t\tconst startIndex = indexOrColumns ?? 0;\n\t\t\t\t\tconst endIndex =\n\t\t\t\t\t\tcount === undefined ? this.table.columns.length : startIndex + count;\n\n\t\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\t\tif (startIndex === endIndex) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\tvalidateIndexRange(startIndex, endIndex, this.table.columns, \"Table.removeColumns\");\n\n\t\t\t\t\tthis.#applyEditsInBatch({\n\t\t\t\t\t\tapplyEdits: () => {\n\t\t\t\t\t\t\tconst columnsToRemove = this.table.columns.slice(\n\t\t\t\t\t\t\t\tstartIndex,\n\t\t\t\t\t\t\t\tendIndex,\n\t\t\t\t\t\t\t) as ColumnValueType[];\n\n\t\t\t\t\t\t\t// First, remove all cells that correspond to each column from each row:\n\t\t\t\t\t\t\tfor (const column of columnsToRemove) {\n\t\t\t\t\t\t\t\tthis.#removeCells(column);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// Second, remove the column nodes:\n\t\t\t\t\t\t\tremoveRangeFromArray(\n\t\t\t\t\t\t\t\tstartIndex,\n\t\t\t\t\t\t\t\tendIndex,\n\t\t\t\t\t\t\t\tthis.table.columns,\n\t\t\t\t\t\t\t\t\"Table.removeColumns\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tremovedColumns = columnsToRemove;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpreconditions,\n\t\t\t\t\t});\n\t\t\t\t\treturn removedColumns ?? fail(0xc1f /* Transaction did not complete. */);\n\t\t\t\t} else {\n\t\t\t\t\t// If there are no columns to remove, do nothing\n\t\t\t\t\tif (indexOrColumns.length === 0) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\t// Resolve any IDs to actual nodes.\n\t\t\t\t\t// This validates that all of the rows exist before starting transaction.\n\t\t\t\t\t// This improves user-facing error experience.\n\t\t\t\t\tconst columnsToRemove: ColumnValueType[] = [];\n\t\t\t\t\tfor (const columnOrIdToRemove of indexOrColumns) {\n\t\t\t\t\t\tcolumnsToRemove.push(this.#getColumn(columnOrIdToRemove));\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.#applyEditsInBatch({\n\t\t\t\t\t\tapplyEdits: () => {\n\t\t\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t\t\t// So if we throw an error here for any column, no columns will be removed.\n\t\t\t\t\t\t\tfor (const columnToRemove of columnsToRemove) {\n\t\t\t\t\t\t\t\t// Remove the corresponding cell from all rows.\n\t\t\t\t\t\t\t\tfor (const row of this.table.rows) {\n\t\t\t\t\t\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\t\t\t\t\tthis.removeCell({\n\t\t\t\t\t\t\t\t\t\tcolumn: columnToRemove,\n\t\t\t\t\t\t\t\t\t\trow: row as RowValueType,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// We have already validated that all of the columns exist above, so this is safe.\n\t\t\t\t\t\t\t\tthis.table.columns.removeAt(this.table.columns.indexOf(columnToRemove));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpreconditions,\n\t\t\t\t\t});\n\t\t\t\t\treturn columnsToRemove;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tpublic removeRows(\n\t\t\t\tindexOrRows: number | undefined | readonly string[] | readonly RowValueType[],\n\t\t\t\tcount?: number | undefined,\n\t\t\t): RowValueType[] {\n\t\t\t\t// Relevant invariant: each cell corresponds to an existing row and column\n\t\t\t\t// Adding a constraint on columns here to prevent cells being orphaned. The relevant scenario is:\n\t\t\t\t// Client A removes rows\n\t\t\t\t// Client B (either concurrently or not, so long as B's edit is sequenced after A's edit) removes a column,\n\t\t\t\t// Client A reverts the removal of the rows\n\t\t\t\t// TODO: Replace with \"no detach on revert\" constraint on the column array when available.\n\t\t\t\tconst columnConstraints: TransactionConstraintAlpha[] = this.table.columns.map(\n\t\t\t\t\t(column) => ({\n\t\t\t\t\t\ttype: \"nodeInDocument\",\n\t\t\t\t\t\tnode: column as ColumnValueType,\n\t\t\t\t\t}),\n\t\t\t\t);\n\n\t\t\t\tif (typeof indexOrRows === \"number\" || indexOrRows === undefined) {\n\t\t\t\t\tlet removedRows: RowValueType[] | undefined;\n\t\t\t\t\tconst startIndex = indexOrRows ?? 0;\n\t\t\t\t\tconst endIndex = count === undefined ? this.table.rows.length : startIndex + count;\n\n\t\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\t\tif (startIndex === endIndex) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\tvalidateIndexRange(startIndex, endIndex, this.table.rows, \"Table.removeRows\");\n\t\t\t\t\tthis.#applyEditsInBatch({\n\t\t\t\t\t\tapplyEdits: () => {\n\t\t\t\t\t\t\tremovedRows = removeRangeFromArray(\n\t\t\t\t\t\t\t\tstartIndex,\n\t\t\t\t\t\t\t\tendIndex,\n\t\t\t\t\t\t\t\tthis.table.rows,\n\t\t\t\t\t\t\t\t\"Table.removeRows\",\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tpreconditionsOnRevert:\n\t\t\t\t\t\t\tcolumnConstraints.length > 0 ? columnConstraints : undefined,\n\t\t\t\t\t});\n\t\t\t\t\treturn removedRows ?? fail(0xccd /* Transaction did not complete */);\n\t\t\t\t}\n\n\t\t\t\t// If there are no rows to remove, do nothing\n\t\t\t\tif (indexOrRows.length === 0) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\t// Resolve any IDs to actual nodes.\n\t\t\t\t// This validates that all of the rows exist before starting transaction.\n\t\t\t\t// This improves user-facing error experience.\n\t\t\t\tconst rowsToRemove: RowValueType[] = [];\n\t\t\t\tfor (const rowToRemove of indexOrRows) {\n\t\t\t\t\trowsToRemove.push(this.#getRow(rowToRemove));\n\t\t\t\t}\n\t\t\t\tthis.#applyEditsInBatch({\n\t\t\t\t\tapplyEdits: () => {\n\t\t\t\t\t\t// Note, throwing an error within a transaction will abort the entire transaction.\n\t\t\t\t\t\t// So if we throw an error here for any row, no rows will be removed.\n\t\t\t\t\t\tfor (const rowToRemove of rowsToRemove) {\n\t\t\t\t\t\t\t// We have already validated that all of the rows exist above, so this is safe.\n\t\t\t\t\t\t\tconst index = this.table.rows.indexOf(rowToRemove);\n\t\t\t\t\t\t\tthis.table.rows.removeAt(index);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tpreconditionsOnRevert: columnConstraints.length > 0 ? columnConstraints : undefined,\n\t\t\t\t});\n\t\t\t\treturn rowsToRemove;\n\t\t\t}\n\n\t\t\tpublic removeCell(\n\t\t\t\tkey: TableSchema.CellKey<TColumnSchema, TRowSchema>,\n\t\t\t): CellValueType | undefined {\n\t\t\t\tconst { column: columnOrIdOrIndex, row: rowOrIdOrIndex } = key;\n\t\t\t\tconst row = this.#getRow(rowOrIdOrIndex) as RowValueInternalType;\n\t\t\t\tconst column = this.#getColumn(columnOrIdOrIndex);\n\n\t\t\t\tconst cell: CellValueType | undefined = row.cells[column.id];\n\t\t\t\tif (cell === undefined) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\tthis.#applyEditsInBatch({\n\t\t\t\t\tapplyEdits: () => {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\t\t\tdelete row.cells[column.id];\n\t\t\t\t\t},\n\t\t\t\t\t// Relevant invariant: each cell corresponds to an existing row and column\n\t\t\t\t\t// Prevents cell leaks from concurrently removed columns in earlier-sequenced edits when this cell removal is reverted.\n\t\t\t\t\t// Example scenario: Client A removes a cell, then Client B removes the column for that cell.\n\t\t\t\t\t// If A's cell removal is later reverted, the cell would be restored but B's column removal means there's no column for it.\n\t\t\t\t\t// This constraint on revert ensures the column still exists, ensuring restored cells correspond to existing columns.\n\t\t\t\t\tpreconditionsOnRevert: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: \"nodeInDocument\",\n\t\t\t\t\t\t\tnode: column,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t});\n\n\t\t\t\treturn cell;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Removes the cell corresponding with the specified column from each row in the table.\n\t\t\t */\n\t\t\t#removeCells(column: ColumnValueType): void {\n\t\t\t\tfor (const row of this.table.rows) {\n\t\t\t\t\t// TypeScript is unable to narrow the row type correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\tthis.removeCell({\n\t\t\t\t\t\tcolumn,\n\t\t\t\t\t\trow: row as RowValueType,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Applies the provided edits in a \"batch\".\n\t\t\t *\n\t\t\t * @remarks\n\t\t\t * For hydrated trees, this will be done in a transaction to ensure atomicity.\n\t\t\t *\n\t\t\t * Transactions are not supported for unhydrated trees, so we cannot run a transaction in that case.\n\t\t\t * But since there are no collaborators, this is not an issue.\n\t\t\t */\n\t\t\t#applyEditsInBatch(options: {\n\t\t\t\t/** The edits to apply. */\n\t\t\t\tapplyEdits: () => void;\n\t\t\t\t/** Optional constraints that must be satisfied for the transaction to proceed. */\n\t\t\t\tpreconditions?: readonly TransactionConstraintAlpha[];\n\t\t\t\t/** Optional constraints that must be satisfied on revert for the transaction to proceed. */\n\t\t\t\tpreconditionsOnRevert?: readonly TransactionConstraintAlpha[];\n\t\t\t}): void {\n\t\t\t\tconst { applyEdits, preconditions, preconditionsOnRevert } = options;\n\t\t\t\tconst branch = TreeAlpha.branch(this);\n\n\t\t\t\t// Ensure events are paused until all of the edits are applied.\n\t\t\t\t// This ensures that the user sees the corresponding table-level edit as atomic,\n\t\t\t\t// and ensures they are not spammed with intermediate events.\n\t\t\t\twithBufferedTreeEvents(() => {\n\t\t\t\t\tif (branch === undefined) {\n\t\t\t\t\t\t// If this node does not have a corresponding branch, then it is unhydrated.\n\t\t\t\t\t\t// I.e., it is not part of a collaborative session yet.\n\t\t\t\t\t\t// Therefore, we don't need to run the edits as a transaction.\n\t\t\t\t\t\tapplyEdits();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbranch.runTransaction(\n\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\tapplyEdits();\n\t\t\t\t\t\t\t\tif (preconditionsOnRevert !== undefined) {\n\t\t\t\t\t\t\t\t\treturn { preconditionsOnRevert };\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpreconditions === undefined ? undefined : { preconditions },\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Column node or ID to a Column node in the table.\n\t\t\t * Returns `undefined` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\t#tryGetColumn(\n\t\t\t\tcolumnOrIdOrIndex: ColumnValueType | string | number,\n\t\t\t): ColumnValueType | undefined {\n\t\t\t\tif (typeof columnOrIdOrIndex === \"number\") {\n\t\t\t\t\tif (columnOrIdOrIndex < 0 || columnOrIdOrIndex >= this.table.columns.length) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\treturn this.table.columns[columnOrIdOrIndex] as ColumnValueType;\n\t\t\t\t}\n\n\t\t\t\tif (typeof columnOrIdOrIndex === \"string\") {\n\t\t\t\t\tconst columnId = columnOrIdOrIndex;\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\treturn this.table.columns.find((col) => (col as ColumnValueType).id === columnId) as\n\t\t\t\t\t\t| ColumnValueType\n\t\t\t\t\t\t| undefined;\n\t\t\t\t}\n\n\t\t\t\t// If the user provided a node, ensure it actually exists in this table.\n\t\t\t\tif (!this.table.columns.includes(columnOrIdOrIndex)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn columnOrIdOrIndex;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Column node or ID to a Column node in the table.\n\t\t\t * @throws Throws a `UsageError` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\t#getColumn(columnOrIdOrIndex: ColumnValueType | string | number): ColumnValueType {\n\t\t\t\tconst column = this.#tryGetColumn(columnOrIdOrIndex);\n\t\t\t\tif (column === undefined) {\n\t\t\t\t\tTable._throwMissingColumnError(columnOrIdOrIndex);\n\t\t\t\t}\n\t\t\t\treturn column;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Throw a `UsageError` for a missing Column by its ID or index.\n\t\t\t */\n\t\t\tprivate static _throwMissingColumnError(\n\t\t\t\tcolumnOrIdOrIndex: ColumnValueType | string | number,\n\t\t\t): never {\n\t\t\t\tif (typeof columnOrIdOrIndex === \"number\") {\n\t\t\t\t\tthrow new UsageError(`No column exists at index ${columnOrIdOrIndex}.`);\n\t\t\t\t}\n\n\t\t\t\tif (typeof columnOrIdOrIndex === \"string\") {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`No column with ID \"${columnOrIdOrIndex}\" exists in the table.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`The specified column node with ID \"${columnOrIdOrIndex.id}\" does not exist in the table.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Row node or ID to a Row node in the table.\n\t\t\t * Returns `undefined` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\t#tryGetRow(rowOrIdOrIndex: RowValueType | string | number): RowValueType | undefined {\n\t\t\t\tif (typeof rowOrIdOrIndex === \"number\") {\n\t\t\t\t\tif (rowOrIdOrIndex < 0 || rowOrIdOrIndex >= this.table.rows.length) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the cast.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\treturn this.table.rows[rowOrIdOrIndex] as RowValueType;\n\t\t\t\t}\n\n\t\t\t\tif (typeof rowOrIdOrIndex === \"string\") {\n\t\t\t\t\tconst rowId = rowOrIdOrIndex;\n\t\t\t\t\t// TypeScript is unable to narrow the types correctly here, hence the casts.\n\t\t\t\t\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\t\t\t\t\treturn this.table.rows.find((row) => (row as RowValueType).id === rowId) as\n\t\t\t\t\t\t| RowValueType\n\t\t\t\t\t\t| undefined;\n\t\t\t\t}\n\n\t\t\t\t// If the user provided a node, ensure it actually exists in this table.\n\t\t\t\tif (!this.table.rows.includes(rowOrIdOrIndex)) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\n\t\t\t\treturn rowOrIdOrIndex;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Attempts to resolve the provided Row node, ID, or index to a Row node in the table.\n\t\t\t * @throws Throws a `UsageError` if there is no match.\n\t\t\t * @remarks Searches for a match based strictly on the ID and returns that result.\n\t\t\t */\n\t\t\t#getRow(rowOrIdOrIndex: RowValueType | string | number): RowValueType {\n\t\t\t\tconst row = this.#tryGetRow(rowOrIdOrIndex);\n\t\t\t\tif (row === undefined) {\n\t\t\t\t\tTable._throwMissingRowError(rowOrIdOrIndex);\n\t\t\t\t}\n\t\t\t\treturn row;\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Validates the provided list of new columns being inserted into the table.\n\t\t\t * @throws Throws a `UsageError` if any of the following conditions are met:\n\t\t\t * - A column with a duplicate ID is being inserted.\n\t\t\t */\n\t\t\t#validateNewColumns(newColumns: readonly ColumnInsertableType[]): void {\n\t\t\t\treturn Table._validateNewColumns(\n\t\t\t\t\tnewColumns,\n\t\t\t\t\tnew Set(this.table.columns.map((column) => (column as ColumnValueType).id)),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Validates the provided list of new rows being inserted into the table.\n\t\t\t * @throws Throws a `UsageError` if any of the following conditions are met:\n\t\t\t * - A row with a duplicate ID is being inserted.\n\t\t\t * - A row is being inserted that contains cells for columns that do not exist in the table.\n\t\t\t */\n\t\t\t#validateNewRows(newRows: readonly RowInsertableType[]): void {\n\t\t\t\treturn Table._validateNewRows(\n\t\t\t\t\tnewRows,\n\t\t\t\t\tnew Set(this.table.rows.map((row) => (row as RowValueType).id)),\n\t\t\t\t\tnew Set(this.table.columns.map((column) => (column as ColumnValueType).id)),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Validates the provided list of new columns being inserted into the table.\n\t\t\t * @throws Throws a `UsageError` if any of the following conditions are met:\n\t\t\t * - A column with a duplicate ID is being inserted.\n\t\t\t */\n\t\t\tprivate static _validateNewColumns(\n\t\t\t\tnewColumns: Iterable<ColumnInsertableType>,\n\t\t\t\texistingColumnIds: Set<string>,\n\t\t\t): void {\n\t\t\t\tconst newColumnIds = new Set<string>();\n\t\t\t\tfor (const newColumn of newColumns) {\n\t\t\t\t\t// #region Ensure each column ID is unique\n\t\t\t\t\tconst newColumnId = (newColumn as ColumnValueType).id;\n\t\t\t\t\tif (existingColumnIds.has(newColumnId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Attempted to insert a column with ID \"${newColumnId}\", but a column with that ID already exists in the table.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (newColumnIds.has(newColumnId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Attempted to insert multiple columns with ID \"${newColumnId}\". Column IDs must be unique.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tnewColumnIds.add(newColumnId);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Validates the provided list of new rows being inserted into the table.\n\t\t\t * @throws Throws a `UsageError` if any of the following conditions are met:\n\t\t\t * - A row with a duplicate ID is being inserted.\n\t\t\t * - A row is being inserted that contains cells for columns that do not exist in the table.\n\t\t\t */\n\t\t\tprivate static _validateNewRows(\n\t\t\t\tnewRows: Iterable<RowInsertableType>,\n\t\t\t\texistingRowIds: Set<string>,\n\t\t\t\tcolumnIds: Set<string>,\n\t\t\t): void {\n\t\t\t\tconst newRowIds = new Set<string>();\n\t\t\t\tfor (const newRow of newRows) {\n\t\t\t\t\t// #region Ensure each row ID is unique\n\n\t\t\t\t\tconst newRowId = (newRow as RowValueType).id;\n\t\t\t\t\tif (existingRowIds.has(newRowId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Attempted to insert a row with ID \"${newRowId}\", but a row with that ID already exists in the table.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tif (newRowIds.has(newRowId)) {\n\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t`Attempted to insert multiple rows with ID \"${newRowId}\". Row IDs must be unique.`,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tnewRowIds.add(newRowId);\n\n\t\t\t\t\t// #endregion\n\n\t\t\t\t\t// #region If the row contains cells, verify that the table contains the columns for those cells\n\n\t\t\t\t\t// Note: we intentionally hide `cells` on `IRow` to avoid leaking the internal data representation as much as possible, so we have to cast here.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\tif ((newRow as any).cells !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\t\tconst keys: string[] = Object.keys((newRow as any).cells);\n\t\t\t\t\t\tfor (const key of keys) {\n\t\t\t\t\t\t\tif (!columnIds.has(key)) {\n\t\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t\t`Attempted to insert a row containing a cell under column ID \"${key}\", but the table does not contain a column with that ID.`,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// #endregion\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * Throw a `UsageError` for a missing Row by its ID or index.\n\t\t\t */\n\t\t\tprivate static _throwMissingRowError(\n\t\t\t\trowOrIdOrIndex: RowValueType | string | number,\n\t\t\t): never {\n\t\t\t\tif (typeof rowOrIdOrIndex === \"number\") {\n\t\t\t\t\tthrow new UsageError(`No row exists at index ${rowOrIdOrIndex}.`);\n\t\t\t\t}\n\n\t\t\t\tif (typeof rowOrIdOrIndex === \"string\") {\n\t\t\t\t\tthrow new UsageError(`No row with ID \"${rowOrIdOrIndex}\" exists in the table.`);\n\t\t\t\t}\n\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t`The specified row node with ID \"${rowOrIdOrIndex.id}\" does not exist in the table.`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\t// Named interfaces here do not compile.\n\t\ttype Statics = {\n\t\t\t/**\n\t\t\t * Create a table with initial contents.\n\t\t\t * @param initialContents - The initial contents of the table.\n\t\t\t * If not provided, an empty table will be constructed.\n\t\t\t * @remarks Performs the following input validation:\n\t\t\t * - Ensures that any cells specified in the initial rows correspond to existing columns in the initial columns.\n\t\t\t * - Ensures that all column and row IDs are unique.\n\t\t\t */\n\t\t\tcreate<TThis extends TableConstructorType>(\n\t\t\t\tthis: TThis,\n\t\t\t\tinitialContents?:\n\t\t\t\t\t| TableSchema.TableFactoryMethodParameters<\n\t\t\t\t\t\t\tTUserScope,\n\t\t\t\t\t\t\tTCellSchema,\n\t\t\t\t\t\t\tTColumnSchema,\n\t\t\t\t\t\t\tTRowSchema\n\t\t\t\t\t >\n\t\t\t\t\t| undefined,\n\t\t\t): InstanceType<TThis>;\n\t\t} & TableConstructorType;\n\n\t\t// Returning SingletonSchema without a type conversion results in TypeScript generating something like `readonly \"__#124291@#brand\": unknown;`\n\t\t// for the private brand field of TreeNode.\n\t\t// This numeric id doesn't seem to be stable over incremental builds, and thus causes diffs in the API extractor reports.\n\t\t// This is avoided by doing this type conversion.\n\t\t// The conversion is done via eraseSubclassableSchemaDetails to erase internal details.\n\t\tconst TableSchemaType = eraseSchemaDetailsSubclassable<TableValueType, Statics>()(Table);\n\n\t\t// Return the table schema\n\t\treturn TableSchemaType;\n\t}\n\n\t/**\n\t * Base row schema type.\n\t * @sealed @system @beta\n\t */\n\texport type TableSchemaBase<\n\t\tTUserScope extends string,\n\t\tTCellSchema extends ImplicitAllowedTypes,\n\t\tTColumnSchema extends ColumnSchemaBase<TUserScope, TCellSchema>,\n\t\tTRowSchema extends RowSchemaBase<TUserScope, TCellSchema>,\n\t> = ReturnType<typeof createTableSchema<TUserScope, TCellSchema, TColumnSchema, TRowSchema>>;\n\n\t// #endregion\n}\n\n/**\n * Sets up scope for table schema built-in types.\n * @remarks User-provided factory scoping will be applied as `com.fluidframework.table<user-scope>`.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nfunction createTableScopedFactory<TUserScope extends string>(\n\tinputSchemaFactory: SchemaFactoryBeta<TUserScope>,\n) {\n\treturn createCustomizedFluidFrameworkScopedFactory(inputSchemaFactory, \"tableV2\");\n}\n\n/**\n * Removes the specified range of elements from the array.\n * @returns The removed elements.\n */\nfunction removeRangeFromArray<TNodeSchema extends ImplicitAllowedTypes>(\n\tstartIndex: number,\n\tendIndex: number,\n\tarray: TreeArrayNode<TNodeSchema>,\n\tmethodName: string,\n): TreeNodeFromImplicitAllowedTypes<TNodeSchema>[] {\n\tvalidateIndexRange(startIndex, endIndex, array, methodName);\n\n\t// TypeScript is unable to narrow the array element type correctly here, hence the cast.\n\t// See: https://github.com/microsoft/TypeScript/issues/52144\n\tconst removedRows = array.slice(\n\t\tstartIndex,\n\t\tendIndex,\n\t) as TreeNodeFromImplicitAllowedTypes<TNodeSchema>[];\n\tarray.removeRange(startIndex, endIndex);\n\n\treturn removedRows;\n}\n\n/**\n * Contains types and factories for creating schema to represent dynamic tabular data.\n *\n * @remarks\n *\n * Note: the APIs produced by this module ensure various tabular data invariants are maintained that the raw, underlying tree structures do not.\n * For example, they ensure that cells always correspond to existing rows and columns (and do not become \"orphaned\" due to row/column deletion, etc.).\n * For this reason, direct manipulation of the underlying tree structures is not supported.\n * To modify the data, only the APIs provided here may be used.\n *\n * Also note: these APIs leverage `SharedTree` functionality that was added in version `2.80.0`,\n * which is not compatible with previous versions of this library.\n * To ensure safe collaboration, you will need to configure the {@link @fluidframework/runtime-definitions#MinimumVersionForCollab}\n * for the Fluid Runtime and/or `SharedTree` to at least `2.80.0`.\n * To set this minimum version for `SharedTree`, use {@link configuredSharedTreeBeta}.\n *\n * The primary APIs for create tabular data schema are:\n *\n * - {@link TableSchema.(table:1)}\n *\n * - {@link TableSchema.(column:1)}\n *\n * - {@link TableSchema.(row:1)}\n *\n * Tables created using these APIs are...\n *\n * - sparse, meaning that cells may be omitted, and new rows are empty by default.\n *\n * - dynamic, meaning that their structure can be modified at runtime.\n * Columns and rows can be inserted, removed, modified, and reordered.\n * Cells can be inserted, removed, and modified.\n *\n * - row-major, meaning that operating on rows (including inserts, removal, moves, and traversal) is more efficient than operating on columns.\n *\n * Column and Row schema created using these APIs are extensible via the `props` field.\n * This allows association of additional properties with column and row nodes.\n *\n * @example Defining a Table schema\n *\n * ```typescript\n * class MyTable extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: schemaFactory.string,\n * }) {}\n *\n * const table = MyTable.create({\n * \tcolumns: [{ id: \"column-0\" }],\n * \trows: [{ id: \"row-0\", cells: { \"column-0\": \"Hello world!\" } }],\n * });\n * ```\n *\n * @example Customizing Column and Row schema\n *\n * ```typescript\n * const Cell = schemaFactory.string;\n *\n * class MyColumn extends TableSchema.column({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tprops: schemaFactory.object(\"TableColumnProps\", {\n * \t\tlabel: schemaFactory.string,\n * \t}),\n * }) {}\n *\n * class MyRow extends TableSchema.row({\n * \tschemaFactory,\n * \tcell: Cell,\n * }) {}\n *\n * class MyTable extends TableSchema.table({\n * \tschemaFactory,\n * \tcell: Cell,\n * \tcolumn: MyColumn,\n * \trow: MyRow,\n * }) {}\n *\n * const table = new MyTable({\n * \tcolumns: [\n * \t\tnew MyColumn({ props: { label: \"Entry\" } }),\n * \t\tnew MyColumn({ props: { label: \"Date\" } }),\n * \t\tnew MyColumn({ props: { label: \"Amount\" } }),\n * \t],\n * \trows: [],\n * });\n * ```\n *\n * @example Listening for changes in the table\n *\n * ```typescript\n * // Listen for any changes to the table and its children.\n * // The \"treeChanged\" event will fire when the associated node or any of its descendants change.\n * Tree.on(table, \"treeChanged\", () => {\n * \t// Respond to the change.\n * });\n * ```\n *\n * @example Listening for changes to the rows list only\n *\n * ```typescript\n * // Listen for any changes to the list of rows.\n * // The \"nodeChanged\" event will fire only when the specified node itself changes (i.e., its own properties change).\n * // In this case, the event will fire when a row is added or removed, or the order of the list is changed.\n * // But it won't fire when a row's properties change, or when the row's cells change, etc.\n * Tree.on(table.rows, \"nodeChanged\", () => {\n * \t// Respond to the change.\n * });\n * ```\n *\n * @privateRemarks\n * The above examples are backed by tests in `tableSchema.spec.ts`.\n * Those tests and these examples should be kept in-sync to ensure that the examples are correct.\n *\n * @beta\n */\nexport namespace TableSchema {\n\t// #region Column\n\n\t/**\n\t * A column in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(column:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @sealed @beta\n\t */\n\texport interface Column<\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Reserving this for future use.\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the column.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * The column's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the column.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createColumnSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<TProps>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<TProps>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @beta\n\t */\n\texport function column<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t>,\n\t): System_TableSchema.ColumnSchemaBase<\n\t\tTUserScope,\n\t\tTCell,\n\t\tSystem_TableSchema.DefaultPropsType\n\t>;\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the column.\n\t * @beta\n\t */\n\texport function column<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateColumnOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\t/**\n\t\t\t * Optional column properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.ColumnSchemaBase<TUserScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function column({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateColumnOptionsBase & {\n\t\treadonly props?: ImplicitFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createColumnSchema(schemaFactory, props);\n\t}\n\n\t// #endregion\n\n\t// #region Row\n\n\t/**\n\t * A row in a table.\n\t * @remarks Implemented by the schema class returned from {@link TableSchema.(row:2)}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @sealed @beta\n\t */\n\texport interface Row<\n\t\t// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Reserving this for future use.\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTProps extends ImplicitFieldSchema = ImplicitFieldSchema,\n\t> {\n\t\t/**\n\t\t * The unique identifier of the row.\n\t\t * @remarks Uniquely identifies the node within the entire tree, not just the table.\n\t\t */\n\t\treadonly id: string;\n\n\t\t/**\n\t\t * The row's properties.\n\t\t * @remarks This is a user-defined schema that can be used to store additional information about the row.\n\t\t * @privateRemarks\n\t\t * Note: these docs are duplicated on the inline type definitions in {@link System_TableSchema.createRowSchema}.\n\t\t * If you update the docs here, please also update the inline type definitions.\n\t\t */\n\t\tget props(): TreeFieldFromImplicitField<TProps>;\n\t\tset props(value: InsertableTreeFieldFromImplicitField<TProps>);\n\t}\n\n\t/**\n\t * Factory for creating new table column schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @beta\n\t */\n\texport function row<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t>,\n\t): System_TableSchema.RowSchemaBase<TUserScope, TCell, System_TableSchema.DefaultPropsType>;\n\t/**\n\t * Factory for creating new table row schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the {@link TableSchema.Table}.\n\t * @typeParam TProps - Additional properties to associate with the row.\n\t * @beta\n\t */\n\texport function row<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TProps extends ImplicitFieldSchema,\n\t>(\n\t\tparams: System_TableSchema.CreateRowOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\t/**\n\t\t\t * Optional row properties.\n\t\t\t */\n\t\t\treadonly props: TProps;\n\t\t},\n\t): System_TableSchema.RowSchemaBase<TUserScope, TCell, TProps>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function row({\n\t\tschemaFactory,\n\t\tcell,\n\t\tprops = SchemaFactory.optional(SchemaFactory.null),\n\t}: System_TableSchema.CreateRowOptionsBase & {\n\t\treadonly props?: ImplicitFieldSchema;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createRowSchema(schemaFactory, cell, props);\n\t}\n\n\t// #endregion\n\n\t// #region Table\n\n\t/**\n\t * A key to uniquely identify a cell within a table.\n\t *\n\t * @remarks\n\t * Note that edits to the table structure (including edits by collaborators) can cause indexes to refer to different cells over time.\n\t * Therefore, it is recommended to use IDs or node references whenever possible to identify cells.\n\t *\n\t * @input @beta\n\t */\n\texport interface CellKey<\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * {@link TableSchema.Column}, {@link TableSchema.Column.id}, or column index at which the cell is located.\n\t\t */\n\t\treadonly column: string | number | TreeNodeFromImplicitAllowedTypes<TColumn>;\n\n\t\t/**\n\t\t * {@link TableSchema.Row}, {@link TableSchema.Row.id}, or row index at which the cell is located.\n\t\t */\n\t\treadonly row: string | number | TreeNodeFromImplicitAllowedTypes<TRow>;\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertColumns} parameters.\n\t * @input @beta\n\t */\n\texport interface InsertColumnsParameters<TColumn extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new columns.\n\t\t * @remarks If not provided, the columns will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The columns to insert.\n\t\t */\n\t\treadonly columns: InsertableTreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.insertRows} parameters.\n\t * @input @beta\n\t */\n\texport interface InsertRowsParameters<TRow extends ImplicitAllowedTypes> {\n\t\t/**\n\t\t * The index at which to insert the new rows.\n\t\t * @remarks If not provided, the rows will be appended to the end of the table.\n\t\t */\n\t\treadonly index?: number | undefined;\n\n\t\t/**\n\t\t * The rows to insert.\n\t\t */\n\t\treadonly rows: InsertableTreeNodeFromImplicitAllowedTypes<TRow>[];\n\t}\n\n\t/**\n\t * {@link TableSchema.Table.setCell} parameters.\n\t * @input @beta\n\t */\n\texport interface SetCellParameters<\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends ImplicitAllowedTypes,\n\t\tTRow extends ImplicitAllowedTypes,\n\t> {\n\t\t/**\n\t\t * The key to uniquely identify a cell in a table.\n\t\t */\n\t\treadonly key: CellKey<TColumn, TRow>;\n\n\t\t/**\n\t\t * The cell to set.\n\t\t */\n\t\treadonly cell: InsertableTreeNodeFromImplicitAllowedTypes<TCell>;\n\t}\n\n\t/**\n\t * A table.\n\t *\n\t * @remarks Table schema is created via the {@link TableSchema.(table:1)} factory.\n\t * Node instances of the schema type should be constructed via the static `create` method on the schema class.\n\t * E.g. `const table = MyTableSchema.create({ columns, rows});`\n\t *\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t *\n\t * @sealed @beta\n\t */\n\texport interface Table<\n\t\tTUserScope extends string,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends System_TableSchema.ColumnSchemaBase<TUserScope, TCell>,\n\t\tTRow extends System_TableSchema.RowSchemaBase<TUserScope, TCell>,\n\t> {\n\t\t/**\n\t\t * The table's columns.\n\t\t */\n\t\treadonly columns: System_TableSchema.RearrangeableList<TColumn>;\n\n\t\t/**\n\t\t * The table's rows.\n\t\t */\n\t\treadonly rows: System_TableSchema.RearrangeableList<TRow>;\n\n\t\t/**\n\t\t * Gets a table column by its {@link TableSchema.Column.id}.\n\t\t * @returns The column, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetColumn(id: string): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;\n\t\t/**\n\t\t * Gets a table column by its index in the table.\n\t\t *\n\t\t * @remarks\n\t\t * Note that edits to the table structure (including edits by collaborators) can cause indexes to refer to different columns over time.\n\t\t * Therefore, it is recommended to use IDs whenever possible to identify columns.\n\t\t *\n\t\t * @returns The column, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetColumn(index: number): TreeNodeFromImplicitAllowedTypes<TColumn> | undefined;\n\n\t\t/**\n\t\t * Gets a table row by its {@link TableSchema.Row.id}.\n\t\t * @returns The row, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetRow(id: string): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;\n\t\t/**\n\t\t * Gets a table row by its index in the table.\n\t\t *\n\t\t * @remarks\n\t\t * Note that edits to the table structure (including edits by collaborators) can cause indexes to refer to different rows over time.\n\t\t * Therefore, it is recommended to use IDs whenever possible to identify rows.\n\t\t *\n\t\t * @returns The row, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetRow(index: number): TreeNodeFromImplicitAllowedTypes<TRow> | undefined;\n\n\t\t/**\n\t\t * Gets a cell in the table by corresponding column and row.\n\t\t * @param key - A key that uniquely distinguishes a cell in the table, represented as a combination of the column ID and row ID.\n\t\t * @returns The cell, if it exists. Otherwise, `undefined`.\n\t\t */\n\t\tgetCell(key: CellKey<TColumn, TRow>): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\n\t\t/**\n\t\t * Inserts 0 or more columns into the table.\n\t\t *\n\t\t * @throws Throws an error if the specified index is out of range.\n\t\t *\n\t\t * No columns are inserted in this case.\n\t\t */\n\t\tinsertColumns(\n\t\t\tparams: InsertColumnsParameters<TColumn>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Inserts 0 or more rows into the table.\n\t\t *\n\t\t * @throws\n\t\t * Throws an error in the following cases:\n\t\t *\n\t\t * - The row contains cells, but the table does not contain matching columns for one or more of those cells.\n\t\t *\n\t\t * - The specified index is out of range.\n\t\t *\n\t\t * No rows are inserted in these cases.\n\t\t */\n\t\tinsertRows(params: InsertRowsParameters<TRow>): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Sets the cell at the specified location in the table.\n\t\t * @remarks To remove a cell, call {@link TableSchema.Table.removeCell} instead.\n\t\t */\n\t\tsetCell(params: SetCellParameters<TCell, TColumn, TRow>): void;\n\n\t\t/**\n\t\t * Removes a range of columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t * @param index - The starting index of the range to remove. Default: `0`.\n\t\t * @param count - The number of columns to remove. Default: all remaining columns starting from `index`.\n\t\t * @throws Throws an error if the specified range is invalid. In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tindex?: number | undefined,\n\t\t\tcount?: number | undefined,\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param columns - The columns to remove.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(\n\t\t\tcolumns: readonly TreeNodeFromImplicitAllowedTypes<TColumn>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\t\t/**\n\t\t * Removes 0 or more columns from the table.\n\t\t *\n\t\t * @remarks\n\t\t * Also removes any corresponding cells from the table's rows.\n\t\t *\n\t\t * Note: this operation can be slow for tables with many rows.\n\t\t * We are actively working on improving the performance of this operation, but for now it may have a negative\n\t\t * impact on performance.\n\t\t *\n\t\t * @param columns - The columns to remove, specified by their {@link TableSchema.Column.id}.\n\t\t * @throws Throws an error if any of the columns are not in the table.\n\t\t * In this case, no columns are removed.\n\t\t */\n\t\tremoveColumns(columns: readonly string[]): TreeNodeFromImplicitAllowedTypes<TColumn>[];\n\n\t\t/**\n\t\t * Removes a range of rows from the table.\n\t\t * @param index - The starting index of the range to remove. Default: `0`.\n\t\t * @param count - The number of rows to remove. Default: all remaining rows starting from `index`.\n\t\t * @throws Throws an error if the specified range is invalid. In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\tindex?: number | undefined,\n\t\t\tcount?: number | undefined,\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(\n\t\t\trows: readonly TreeNodeFromImplicitAllowedTypes<TRow>[],\n\t\t): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\t\t/**\n\t\t * Removes 0 or more rows from the table.\n\t\t * @param rows - The rows to remove, specified by their {@link TableSchema.Row.id}.\n\t\t * @throws Throws an error if any of the rows are not in the table.\n\t\t * In this case, no rows are removed.\n\t\t */\n\t\tremoveRows(rows: readonly string[]): TreeNodeFromImplicitAllowedTypes<TRow>[];\n\n\t\t/**\n\t\t * Removes the cell at the specified location in the table.\n\t\t * @returns The cell if it exists, otherwise undefined.\n\t\t * @throws Throws an error if the location does not exist in the table.\n\t\t */\n\t\tremoveCell(\n\t\t\tkey: CellKey<TColumn, TRow>,\n\t\t): TreeNodeFromImplicitAllowedTypes<TCell> | undefined;\n\t}\n\n\t/**\n\t * Input parameters for {@link TableSchema.Table}'s `create` factory method.\n\t * @input @beta\n\t */\n\texport interface TableFactoryMethodParameters<\n\t\tTUserScope extends string,\n\t\tTCell extends ImplicitAllowedTypes,\n\t\tTColumn extends System_TableSchema.ColumnSchemaBase<TUserScope, TCell>,\n\t\tTRow extends System_TableSchema.RowSchemaBase<TUserScope, TCell>,\n\t> {\n\t\t/**\n\t\t * Initial columns for the table.\n\t\t */\n\t\treadonly columns?:\n\t\t\t| Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TColumn>>\n\t\t\t| undefined;\n\n\t\t/**\n\t\t * Initial rows for the table.\n\t\t * @remarks If any cells are specified, they will be validated against the IDs of the provided columns.\n\t\t */\n\t\treadonly rows?: Iterable<InsertableTreeNodeFromImplicitAllowedTypes<TRow>> | undefined;\n\t}\n\n\t/**\n\t * Factory for creating new table schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @beta\n\t */\n\texport function table<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t>,\n\t): System_TableSchema.TableSchemaBase<\n\t\tTUserScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<\n\t\t\tTUserScope,\n\t\t\tTCell,\n\t\t\tSystem_TableSchema.DefaultPropsType\n\t\t>,\n\t\tSystem_TableSchema.RowSchemaBase<TUserScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @beta\n\t */\n\texport function table<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TUserScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\treadonly column: TColumn;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTUserScope,\n\t\tTCell,\n\t\tTColumn,\n\t\tSystem_TableSchema.RowSchemaBase<TUserScope, TCell, System_TableSchema.DefaultPropsType>\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom row schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @beta\n\t */\n\texport function table<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TUserScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<\n\t\tTUserScope,\n\t\tTCell,\n\t\tSystem_TableSchema.ColumnSchemaBase<\n\t\t\tTUserScope,\n\t\t\tTCell,\n\t\t\tSystem_TableSchema.DefaultPropsType\n\t\t>,\n\t\tTRow\n\t>;\n\t/**\n\t * Factory for creating new table schema with custom column and row schema.\n\t * @typeParam TUserScope - The {@link SchemaFactory.scope | schema factory scope}.\n\t * The resulting schema will have an identifier of the form: `com.fluidframework.table<${TUserScope}>.Table`.\n\t * @typeParam TCell - The type of the cells in the table.\n\t * @typeParam TColumn - The type of the columns in the table.\n\t * @typeParam TRow - The type of the rows in the table.\n\t * @beta\n\t */\n\texport function table<\n\t\tconst TUserScope extends string,\n\t\tconst TCell extends ImplicitAllowedTypes,\n\t\tconst TColumn extends System_TableSchema.ColumnSchemaBase<TUserScope, TCell>,\n\t\tconst TRow extends System_TableSchema.RowSchemaBase<TUserScope, TCell>,\n\t>(\n\t\tparams: System_TableSchema.TableFactoryOptionsBase<\n\t\t\tTUserScope,\n\t\t\tSchemaFactoryBeta<TUserScope>,\n\t\t\tTCell\n\t\t> & {\n\t\t\treadonly column: TColumn;\n\t\t\treadonly row: TRow;\n\t\t},\n\t): System_TableSchema.TableSchemaBase<TUserScope, TCell, TColumn, TRow>;\n\t/**\n\t * Overload implementation\n\t */\n\texport function table({\n\t\tschemaFactory,\n\t\tcell: cellSchema,\n\t\tcolumn: columnSchema = column({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t\trow: rowSchema = row({\n\t\t\tschemaFactory,\n\t\t\tcell: cellSchema,\n\t\t}),\n\t}: System_TableSchema.TableFactoryOptionsBase & {\n\t\treadonly column?: System_TableSchema.ColumnSchemaBase;\n\t\treadonly row?: System_TableSchema.RowSchemaBase;\n\t}): TreeNodeSchema {\n\t\treturn System_TableSchema.createTableSchema(\n\t\t\tschemaFactory,\n\t\t\tcellSchema,\n\t\t\tcolumnSchema,\n\t\t\trowSchema,\n\t\t);\n\t}\n\n\t// #endregion\n}\n"]}
@@ -56,7 +56,7 @@ class TextNode extends sf.object("Text", {
56
56
  for (const [key, value] of Object.entries(format)) {
57
57
  // Object.entries should only return string keyed enumerable own properties.
58
58
  // The TypeScript typing does not account for this, and thus this assertion is necessary for this code to compile.
59
- (0, internal_1.assert)(typeof key === "string", "Object.entries returned a non-string key.");
59
+ (0, internal_1.assert)(typeof key === "string", 0xcc8 /* Object.entries returned a non-string key. */);
60
60
  const f = FormattedTextAsTree.CharacterFormat.fields.get(key);
61
61
  if (f === undefined) {
62
62
  throw new internal_2.UsageError(`Unknown format key: ${key}`);
@@ -1 +1 @@
1
- {"version":3,"file":"textDomainFormatted.js","sourceRoot":"","sources":["../../src/text/textDomainFormatted.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAA4C;AAC5C,sDAOiC;AAOjC,+CAA+C;AAE/C,mDAAwE;AAExE,MAAM,EAAE,GAAG,IAAI,6BAAkB,CAAC,mCAAmC,CAAC,CAAC;AAEvE,MAAM,QACL,SAAQ,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,wBAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,mBAAQ,EAAE,CAAC;CACvE,CAAC;IAHH;;QAMQ,kBAAa,GACnB,IAAI,mBAAmB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IAsEzD,CAAC;IApEO,QAAQ,CAAC,KAAa,EAAE,oBAA4B;QAC1D,IAAI,CAAC,OAAO,CAAC,QAAQ,CACpB,KAAK,EACL,wBAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CACnF,CAAC;IACH,CAAC;IACM,WAAW,CAAC,KAAa,EAAE,MAAc;QAC/C,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IACM,UAAU;QAChB,OAAO,IAAA,sBAAW,EAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;IACM,UAAU;QAChB,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACxC,CAAC;IAEM,MAAM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L;;;OAGG;IACH,MAAa,cAAe,SAAQ,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAE;QAC/D;;;;;;;;;;WAUG;QACH,OAAO,EAAE,wBAAa,CAAC,QAAQ,CAAC,CAAC,wBAAa,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,mBAAQ,EAAE,CAAC;KAC1E,CAAC;KAAG;IAbQ,kCAAc,iBAatB,CAAA;IAEL;;;OAGG;IACU,2BAAO,GAAG,IAAA,0BAAe,EAAC,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;QACnE,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;QACJ,IAAI;KACJ,CAAC,CAAC;IAOH;;;;;;;OAOG;IACH,MAAa,cAAe,SAAQ,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAE;QAC/D,GAAG,EAAE,oBAAA,OAAO,CAAC,MAAM;KACnB,CAAC;QAFF;;YAGiB,YAAO,GAAG,IAAI,CAAC;QAChC,CAAC;KAAA;IAJY,kCAAc,iBAI1B,CAAA;IAED;;;OAGG;IACU,qCAAiB,GAAG,CAAC,cAAc,EAAE,cAAc,CAAU,CAAC;IAO3E;;;OAGG;IACH,MAAa,UAAW,SAAQ,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE;QACvD,OAAO,EAAE,wBAAa,CAAC,QAAQ,CAAC,oBAAA,iBAAiB,EAAE,EAAE,GAAG,EAAE,mBAAQ,EAAE,CAAC;QACrE,MAAM,EAAE,eAAe;KACvB,CAAC;KAAG;IAHQ,8BAAU,aAGlB,CAAA;IA2EL;;;;;;OAMG;IACU,wBAAI,GAAG,IAAA,6BAAkB,GAAoB,CAAC,QAAQ,CAAC,CAAC;AAEtE,CAAC,EAtKgB,mBAAmB,mCAAnB,mBAAmB,QAsKnC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey } from \"../core/index.js\";\nimport {\n\tenumFromStrings,\n\teraseSchemaDetails,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\tTreeArrayNode,\n\tTreeBeta,\n} from \"../simple-tree/index.js\";\nimport type {\n\tInsertableTypedNode,\n\tTreeNode,\n\tTreeNodeFromImplicitAllowedTypes,\n\tWithType,\n} from \"../simple-tree/index.js\";\nimport { mapIterable } from \"../util/index.js\";\n\nimport { charactersFromString, type TextAsTree } from \"./textDomain.js\";\n\nconst sf = new SchemaFactoryAlpha(\"com.fluidframework.text.formatted\");\n\nclass TextNode\n\textends sf.object(\"Text\", {\n\t\tcontent: SchemaFactory.required([() => StringArray], { key: EmptyKey }),\n\t})\n\timplements FormattedTextAsTree.Members\n{\n\tpublic defaultFormat: FormattedTextAsTree.CharacterFormat =\n\t\tnew FormattedTextAsTree.CharacterFormat(defaultFormat);\n\n\tpublic insertAt(index: number, additionalCharacters: string): void {\n\t\tthis.content.insertAt(\n\t\t\tindex,\n\t\t\tTreeArrayNode.spread(textAtomsFromString(additionalCharacters, this.defaultFormat)),\n\t\t);\n\t}\n\tpublic removeRange(index: number, length: number): void {\n\t\tthis.content.removeRange(index, length);\n\t}\n\tpublic characters(): Iterable<string> {\n\t\treturn mapIterable(this.content, (atom) => atom.content.content);\n\t}\n\tpublic fullString(): string {\n\t\treturn [...this.characters()].join(\"\");\n\t}\n\n\tpublic static fromString(\n\t\tvalue: string,\n\t\tformat?: FormattedTextAsTree.CharacterFormat,\n\t): TextNode {\n\t\t// Constructing an ArrayNode from an iterator is supported, so creating an array from the iterable of characters seems like it's not necessary here,\n\t\t// but to reduce the risk of incorrect data interpretation, we actually ban this in the special case where the iterable is a string directly, which is the case here.\n\t\t// Thus the array construction here is necessary to avoid a runtime error.\n\t\treturn new TextNode({\n\t\t\tcontent: [\n\t\t\t\t...textAtomsFromString(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformat ?? new FormattedTextAsTree.CharacterFormat(defaultFormat),\n\t\t\t\t),\n\t\t\t],\n\t\t});\n\t}\n\n\tpublic charactersWithFormatting(): Iterable<FormattedTextAsTree.StringAtom> {\n\t\treturn this.content;\n\t}\n\tpublic insertWithFormattingAt(\n\t\tindex: number,\n\t\tadditionalCharacters: Iterable<InsertableTypedNode<typeof FormattedTextAsTree.StringAtom>>,\n\t): void {\n\t\tthis.content.insertAt(index, TreeArrayNode.spread(additionalCharacters));\n\t}\n\tpublic formatRange(\n\t\tstartIndex: number,\n\t\tlength: number,\n\t\tformat: Partial<FormattedTextAsTree.CharacterFormat>,\n\t): void {\n\t\tfor (let i = startIndex; i < startIndex + length; i++) {\n\t\t\tconst atom = this.content[i];\n\t\t\tif (atom === undefined) {\n\t\t\t\tthrow new UsageError(\"Index out of bounds while formatting text range.\");\n\t\t\t}\n\t\t\tfor (const [key, value] of Object.entries(format) as [\n\t\t\t\tkeyof FormattedTextAsTree.CharacterFormat,\n\t\t\t\tunknown,\n\t\t\t][]) {\n\t\t\t\t// Object.entries should only return string keyed enumerable own properties.\n\t\t\t\t// The TypeScript typing does not account for this, and thus this assertion is necessary for this code to compile.\n\t\t\t\tassert(typeof key === \"string\", \"Object.entries returned a non-string key.\");\n\t\t\t\tconst f = FormattedTextAsTree.CharacterFormat.fields.get(key);\n\t\t\t\tif (f === undefined) {\n\t\t\t\t\tthrow new UsageError(`Unknown format key: ${key}`);\n\t\t\t\t}\n\t\t\t\t// Ensures that if the input is a node, it is cloned before being inserted into the tree.\n\t\t\t\tatom.format[key] = TreeBeta.clone(TreeBeta.create(f, value as never)) as never;\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst defaultFormat = {\n\tbold: false,\n\titalic: false,\n\tunderline: false,\n\tsize: 12,\n\tfont: \"Arial\",\n} as const;\n\nfunction textAtomsFromString(\n\tvalue: string,\n\tformat: FormattedTextAsTree.CharacterFormat,\n): Iterable<FormattedTextAsTree.StringAtom> {\n\tconst result = mapIterable(\n\t\tcharactersFromString(value),\n\t\t(char) =>\n\t\t\tnew FormattedTextAsTree.StringAtom({\n\t\t\t\tcontent: { content: char },\n\t\t\t\tformat: TreeBeta.clone<typeof FormattedTextAsTree.CharacterFormat>(format),\n\t\t\t}),\n\t);\n\treturn result;\n}\n\nclass StringArray extends sf.array(\"StringArray\", [() => FormattedTextAsTree.StringAtom]) {}\n\n/**\n * A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.\n * @privateRemarks\n * This has hard-coded assumptions about what kind of embedded content and what kind of formatting is supported.\n * We will want to generalize this with a more generic schema factory function like with table.\n * Then either that and/or the output from it can be package exported.\n * This version is just an initial prototype.\n * @internal\n */\nexport namespace FormattedTextAsTree {\n\t/**\n\t * Formatting options for characters.\n\t * @internal\n\t */\n\texport class CharacterFormat extends sf.objectAlpha(\"CharacterFormat\", {\n\t\tbold: SchemaFactory.boolean,\n\t\titalic: SchemaFactory.boolean,\n\t\tunderline: SchemaFactory.boolean,\n\t\tsize: SchemaFactory.number,\n\t\tfont: SchemaFactory.string,\n\t}) {}\n\n\t/**\n\t * Unit in the string representing a single character.\n\t * @internal\n\t */\n\texport class StringTextAtom extends sf.object(\"StringTextAtom\", {\n\t\t/**\n\t\t * The underlying text content of this atom.\n\t\t * @remarks\n\t\t * This is typically a single unicode codepoint, and thus may contain multiple utf-16 surrogate pair code units.\n\t\t * Using longer strings is still valid. For example, so users might store whole grapheme clusters here, or even longer sections of text.\n\t\t * Anything combined into a single atom will be treated atomically, and can not be partially selected or formatted.\n\t\t * Using larger atoms and splitting them as needed is NOT a recommended approach, since this will result in poor merge behavior for concurrent edits.\n\t\t * Instead atoms should always be the smallest unit of text which will be independently selected, moved or formatted.\n\t\t * @privateRemarks\n\t\t * This content logically represents the whole atom's content, so using {@link EmptyKey} makes sense to help indicate that.\n\t\t */\n\t\tcontent: SchemaFactory.required([SchemaFactory.string], { key: EmptyKey }),\n\t}) {}\n\n\t/**\n\t * Tag with which a line in text can be formatted from HTML.\n\t * @internal\n\t */\n\texport const LineTag = enumFromStrings(sf.scopedFactory(\"lineTag\"), [\n\t\t\"h1\",\n\t\t\"h2\",\n\t\t\"h3\",\n\t\t\"h4\",\n\t\t\"h5\",\n\t\t\"li\",\n\t]);\n\t/**\n\t * {@inheritdoc FormattedTextAsTree.(LineTag:variable)}\n\t * @internal\n\t */\n\texport type LineTag = TreeNodeFromImplicitAllowedTypes<typeof LineTag.schema>;\n\n\t/**\n\t * Unit in the string representing a new line character with line formatting.\n\t * @remarks\n\t * This aligns with how Quill represents line formatting.\n\t * Note that not all new lines will use this,\n\t * but only ones using this can have line specific formatting.\n\t * @internal\n\t */\n\texport class StringLineAtom extends sf.object(\"StringLineAtom\", {\n\t\ttag: LineTag.schema,\n\t}) {\n\t\tpublic readonly content = \"\\n\";\n\t}\n\n\t/**\n\t * Types of \"atoms\" that make up the text.\n\t * @internal\n\t */\n\texport const StringAtomContent = [StringTextAtom, StringLineAtom] as const;\n\t/**\n\t * {@inheritdoc FormattedTextAsTree.(StringAtomContent:variable)}\n\t * @internal\n\t */\n\texport type StringAtomContent = TreeNodeFromImplicitAllowedTypes<typeof StringAtomContent>;\n\n\t/**\n\t * A unit of the text, with formatting.\n\t * @internal\n\t */\n\texport class StringAtom extends sf.object(\"StringAtom\", {\n\t\tcontent: SchemaFactory.required(StringAtomContent, { key: EmptyKey }),\n\t\tformat: CharacterFormat,\n\t}) {}\n\n\t/**\n\t * Statics for text nodes.\n\t * @internal\n\t */\n\texport interface Statics {\n\t\t/**\n\t\t * Construct a {@link FormattedTextAsTree.(Tree:type)} from a string, where each character (as defined by iterating over the string) becomes a single character in the text node.\n\t\t * @remarks This combines pairs of utf-16 surrogate code units into single characters as appropriate.\n\t\t */\n\t\tfromString(value: string): Tree;\n\t}\n\n\t/**\n\t * Interface for a text node.\n\t * @remarks\n\t * The string is broken up into substrings which are referred to as 'characters'.\n\t * Unlike with JavaScript strings, all indexes are by character, not UTF-16 code unit.\n\t * This avoids the problem JavaScript where it can split UTF-16 surrogate pairs producing invalid strings,\n\t * and avoids the issue where indexing a string and iterating it segment the string differently.\n\t * This does NOT mean the characters correspond to user perceived characters (like grapheme clusters try to do):\n\t * applications will likely want to include higher level segmentation logic\n\t * which might differ between operations like delete\n\t * (which often operates on something in between unicode code points and grapheme clusters)\n\t * and navigation/selection (which typically uses grapheme clusters).\n\t *\n\t * @see {@link FormattedTextAsTree.Statics.fromString} for construction.\n\t * @see {@link FormattedTextAsTree.(Tree:type)} for schema.\n\t * @internal\n\t */\n\texport interface Members extends TextAsTree.Members {\n\t\t/**\n\t\t * Format to use by default for text inserted with non-formatted APIs.\n\t\t * @remarks\n\t\t * This is not persisted in the tree, and observation of it is not tracked by the tree observation tracking.\n\t\t * @privateRemarks\n\t\t * Opt this into observation tracking.\n\t\t */\n\t\tdefaultFormat: CharacterFormat;\n\n\t\t/**\n\t\t * Gets an iterable over the characters currently in the text.\n\t\t * @remarks\n\t\t * This iterator matches the behavior of {@link (TreeArrayNode:interface)} with respect to edits during iteration.\n\t\t */\n\t\tcharactersWithFormatting(): Iterable<StringAtom>;\n\n\t\t/**\n\t\t * Insert a range of characters into the string based on character index.\n\t\t * @remarks\n\t\t * See {@link (TreeArrayNode:interface).insertAt} for more details on the behavior.\n\t\t * See {@link FormattedTextAsTree.Statics.fromString} for how the `additionalCharacters` string is broken into characters.\n\t\t * @privateRemarks\n\t\t * If we provide ways to customize character boundaries, that could be handled here by taking in an Iterable<string> instead of a string.\n\t\t * Doing this currently would enable insertion of text with different character boundaries than the existing text,\n\t\t * which would violate the currently documented character boundary invariants.\n\t\t *\n\t\t * Another option would be to take an approach like Table,\n\t\t * where the user of the API uses a factory function to generate the schema, and can inject custom logic, like a string character iterator.\n\t\t */\n\t\tinsertWithFormattingAt(\n\t\t\tindex: number,\n\t\t\tadditionalCharacters: Iterable<InsertableTypedNode<typeof StringAtom>>,\n\t\t): void;\n\n\t\t/**\n\t\t * Apply formatting to a range of characters based on character index.\n\t\t * @param startIndex - The starting index of the range to format.\n\t\t * @param length - The number of characters to format.\n\t\t * @param format - The formatting to apply to the specified range.\n\t\t */\n\t\tformatRange(startIndex: number, length: number, format: Partial<CharacterFormat>): void;\n\t}\n\n\t/**\n\t * Schema for a text node.\n\t * @remarks\n\t * See {@link FormattedTextAsTree.Members} for the API.\n\t * See {@link FormattedTextAsTree.Statics} for static APIs on this Schema, including construction.\n\t * @internal\n\t */\n\texport const Tree = eraseSchemaDetails<Members, Statics>()(TextNode);\n\texport type Tree = Members & TreeNode & WithType<\"com.fluidframework.text.formatted.Text\">;\n}\n"]}
1
+ {"version":3,"file":"textDomainFormatted.js","sourceRoot":"","sources":["../../src/text/textDomainFormatted.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAC7D,uEAAsE;AAEtE,+CAA4C;AAC5C,sDAOiC;AAOjC,+CAA+C;AAE/C,mDAAwE;AAExE,MAAM,EAAE,GAAG,IAAI,6BAAkB,CAAC,mCAAmC,CAAC,CAAC;AAEvE,MAAM,QACL,SAAQ,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,wBAAa,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,mBAAQ,EAAE,CAAC;CACvE,CAAC;IAHH;;QAMQ,kBAAa,GACnB,IAAI,mBAAmB,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;IAsEzD,CAAC;IApEO,QAAQ,CAAC,KAAa,EAAE,oBAA4B;QAC1D,IAAI,CAAC,OAAO,CAAC,QAAQ,CACpB,KAAK,EACL,wBAAa,CAAC,MAAM,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC,CACnF,CAAC;IACH,CAAC;IACM,WAAW,CAAC,KAAa,EAAE,MAAc;QAC/C,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC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vB,CAAC;KAAG;IAHQ,8BAAU,aAGlB,CAAA;IA2EL;;;;;;OAMG;IACU,wBAAI,GAAG,IAAA,6BAAkB,GAAoB,CAAC,QAAQ,CAAC,CAAC;AAEtE,CAAC,EAtKgB,mBAAmB,mCAAnB,mBAAmB,QAsKnC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey } from \"../core/index.js\";\nimport {\n\tenumFromStrings,\n\teraseSchemaDetails,\n\tSchemaFactory,\n\tSchemaFactoryAlpha,\n\tTreeArrayNode,\n\tTreeBeta,\n} from \"../simple-tree/index.js\";\nimport type {\n\tInsertableTypedNode,\n\tTreeNode,\n\tTreeNodeFromImplicitAllowedTypes,\n\tWithType,\n} from \"../simple-tree/index.js\";\nimport { mapIterable } from \"../util/index.js\";\n\nimport { charactersFromString, type TextAsTree } from \"./textDomain.js\";\n\nconst sf = new SchemaFactoryAlpha(\"com.fluidframework.text.formatted\");\n\nclass TextNode\n\textends sf.object(\"Text\", {\n\t\tcontent: SchemaFactory.required([() => StringArray], { key: EmptyKey }),\n\t})\n\timplements FormattedTextAsTree.Members\n{\n\tpublic defaultFormat: FormattedTextAsTree.CharacterFormat =\n\t\tnew FormattedTextAsTree.CharacterFormat(defaultFormat);\n\n\tpublic insertAt(index: number, additionalCharacters: string): void {\n\t\tthis.content.insertAt(\n\t\t\tindex,\n\t\t\tTreeArrayNode.spread(textAtomsFromString(additionalCharacters, this.defaultFormat)),\n\t\t);\n\t}\n\tpublic removeRange(index: number, length: number): void {\n\t\tthis.content.removeRange(index, length);\n\t}\n\tpublic characters(): Iterable<string> {\n\t\treturn mapIterable(this.content, (atom) => atom.content.content);\n\t}\n\tpublic fullString(): string {\n\t\treturn [...this.characters()].join(\"\");\n\t}\n\n\tpublic static fromString(\n\t\tvalue: string,\n\t\tformat?: FormattedTextAsTree.CharacterFormat,\n\t): TextNode {\n\t\t// Constructing an ArrayNode from an iterator is supported, so creating an array from the iterable of characters seems like it's not necessary here,\n\t\t// but to reduce the risk of incorrect data interpretation, we actually ban this in the special case where the iterable is a string directly, which is the case here.\n\t\t// Thus the array construction here is necessary to avoid a runtime error.\n\t\treturn new TextNode({\n\t\t\tcontent: [\n\t\t\t\t...textAtomsFromString(\n\t\t\t\t\tvalue,\n\t\t\t\t\tformat ?? new FormattedTextAsTree.CharacterFormat(defaultFormat),\n\t\t\t\t),\n\t\t\t],\n\t\t});\n\t}\n\n\tpublic charactersWithFormatting(): Iterable<FormattedTextAsTree.StringAtom> {\n\t\treturn this.content;\n\t}\n\tpublic insertWithFormattingAt(\n\t\tindex: number,\n\t\tadditionalCharacters: Iterable<InsertableTypedNode<typeof FormattedTextAsTree.StringAtom>>,\n\t): void {\n\t\tthis.content.insertAt(index, TreeArrayNode.spread(additionalCharacters));\n\t}\n\tpublic formatRange(\n\t\tstartIndex: number,\n\t\tlength: number,\n\t\tformat: Partial<FormattedTextAsTree.CharacterFormat>,\n\t): void {\n\t\tfor (let i = startIndex; i < startIndex + length; i++) {\n\t\t\tconst atom = this.content[i];\n\t\t\tif (atom === undefined) {\n\t\t\t\tthrow new UsageError(\"Index out of bounds while formatting text range.\");\n\t\t\t}\n\t\t\tfor (const [key, value] of Object.entries(format) as [\n\t\t\t\tkeyof FormattedTextAsTree.CharacterFormat,\n\t\t\t\tunknown,\n\t\t\t][]) {\n\t\t\t\t// Object.entries should only return string keyed enumerable own properties.\n\t\t\t\t// The TypeScript typing does not account for this, and thus this assertion is necessary for this code to compile.\n\t\t\t\tassert(typeof key === \"string\", 0xcc8 /* Object.entries returned a non-string key. */);\n\t\t\t\tconst f = FormattedTextAsTree.CharacterFormat.fields.get(key);\n\t\t\t\tif (f === undefined) {\n\t\t\t\t\tthrow new UsageError(`Unknown format key: ${key}`);\n\t\t\t\t}\n\t\t\t\t// Ensures that if the input is a node, it is cloned before being inserted into the tree.\n\t\t\t\tatom.format[key] = TreeBeta.clone(TreeBeta.create(f, value as never)) as never;\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst defaultFormat = {\n\tbold: false,\n\titalic: false,\n\tunderline: false,\n\tsize: 12,\n\tfont: \"Arial\",\n} as const;\n\nfunction textAtomsFromString(\n\tvalue: string,\n\tformat: FormattedTextAsTree.CharacterFormat,\n): Iterable<FormattedTextAsTree.StringAtom> {\n\tconst result = mapIterable(\n\t\tcharactersFromString(value),\n\t\t(char) =>\n\t\t\tnew FormattedTextAsTree.StringAtom({\n\t\t\t\tcontent: { content: char },\n\t\t\t\tformat: TreeBeta.clone<typeof FormattedTextAsTree.CharacterFormat>(format),\n\t\t\t}),\n\t);\n\treturn result;\n}\n\nclass StringArray extends sf.array(\"StringArray\", [() => FormattedTextAsTree.StringAtom]) {}\n\n/**\n * A collection of text related types, schema and utilities for working with text beyond the basic {@link SchemaStatics.string}.\n * @privateRemarks\n * This has hard-coded assumptions about what kind of embedded content and what kind of formatting is supported.\n * We will want to generalize this with a more generic schema factory function like with table.\n * Then either that and/or the output from it can be package exported.\n * This version is just an initial prototype.\n * @internal\n */\nexport namespace FormattedTextAsTree {\n\t/**\n\t * Formatting options for characters.\n\t * @internal\n\t */\n\texport class CharacterFormat extends sf.objectAlpha(\"CharacterFormat\", {\n\t\tbold: SchemaFactory.boolean,\n\t\titalic: SchemaFactory.boolean,\n\t\tunderline: SchemaFactory.boolean,\n\t\tsize: SchemaFactory.number,\n\t\tfont: SchemaFactory.string,\n\t}) {}\n\n\t/**\n\t * Unit in the string representing a single character.\n\t * @internal\n\t */\n\texport class StringTextAtom extends sf.object(\"StringTextAtom\", {\n\t\t/**\n\t\t * The underlying text content of this atom.\n\t\t * @remarks\n\t\t * This is typically a single unicode codepoint, and thus may contain multiple utf-16 surrogate pair code units.\n\t\t * Using longer strings is still valid. For example, so users might store whole grapheme clusters here, or even longer sections of text.\n\t\t * Anything combined into a single atom will be treated atomically, and can not be partially selected or formatted.\n\t\t * Using larger atoms and splitting them as needed is NOT a recommended approach, since this will result in poor merge behavior for concurrent edits.\n\t\t * Instead atoms should always be the smallest unit of text which will be independently selected, moved or formatted.\n\t\t * @privateRemarks\n\t\t * This content logically represents the whole atom's content, so using {@link EmptyKey} makes sense to help indicate that.\n\t\t */\n\t\tcontent: SchemaFactory.required([SchemaFactory.string], { key: EmptyKey }),\n\t}) {}\n\n\t/**\n\t * Tag with which a line in text can be formatted from HTML.\n\t * @internal\n\t */\n\texport const LineTag = enumFromStrings(sf.scopedFactory(\"lineTag\"), [\n\t\t\"h1\",\n\t\t\"h2\",\n\t\t\"h3\",\n\t\t\"h4\",\n\t\t\"h5\",\n\t\t\"li\",\n\t]);\n\t/**\n\t * {@inheritdoc FormattedTextAsTree.(LineTag:variable)}\n\t * @internal\n\t */\n\texport type LineTag = TreeNodeFromImplicitAllowedTypes<typeof LineTag.schema>;\n\n\t/**\n\t * Unit in the string representing a new line character with line formatting.\n\t * @remarks\n\t * This aligns with how Quill represents line formatting.\n\t * Note that not all new lines will use this,\n\t * but only ones using this can have line specific formatting.\n\t * @internal\n\t */\n\texport class StringLineAtom extends sf.object(\"StringLineAtom\", {\n\t\ttag: LineTag.schema,\n\t}) {\n\t\tpublic readonly content = \"\\n\";\n\t}\n\n\t/**\n\t * Types of \"atoms\" that make up the text.\n\t * @internal\n\t */\n\texport const StringAtomContent = [StringTextAtom, StringLineAtom] as const;\n\t/**\n\t * {@inheritdoc FormattedTextAsTree.(StringAtomContent:variable)}\n\t * @internal\n\t */\n\texport type StringAtomContent = TreeNodeFromImplicitAllowedTypes<typeof StringAtomContent>;\n\n\t/**\n\t * A unit of the text, with formatting.\n\t * @internal\n\t */\n\texport class StringAtom extends sf.object(\"StringAtom\", {\n\t\tcontent: SchemaFactory.required(StringAtomContent, { key: EmptyKey }),\n\t\tformat: CharacterFormat,\n\t}) {}\n\n\t/**\n\t * Statics for text nodes.\n\t * @internal\n\t */\n\texport interface Statics {\n\t\t/**\n\t\t * Construct a {@link FormattedTextAsTree.(Tree:type)} from a string, where each character (as defined by iterating over the string) becomes a single character in the text node.\n\t\t * @remarks This combines pairs of utf-16 surrogate code units into single characters as appropriate.\n\t\t */\n\t\tfromString(value: string): Tree;\n\t}\n\n\t/**\n\t * Interface for a text node.\n\t * @remarks\n\t * The string is broken up into substrings which are referred to as 'characters'.\n\t * Unlike with JavaScript strings, all indexes are by character, not UTF-16 code unit.\n\t * This avoids the problem JavaScript where it can split UTF-16 surrogate pairs producing invalid strings,\n\t * and avoids the issue where indexing a string and iterating it segment the string differently.\n\t * This does NOT mean the characters correspond to user perceived characters (like grapheme clusters try to do):\n\t * applications will likely want to include higher level segmentation logic\n\t * which might differ between operations like delete\n\t * (which often operates on something in between unicode code points and grapheme clusters)\n\t * and navigation/selection (which typically uses grapheme clusters).\n\t *\n\t * @see {@link FormattedTextAsTree.Statics.fromString} for construction.\n\t * @see {@link FormattedTextAsTree.(Tree:type)} for schema.\n\t * @internal\n\t */\n\texport interface Members extends TextAsTree.Members {\n\t\t/**\n\t\t * Format to use by default for text inserted with non-formatted APIs.\n\t\t * @remarks\n\t\t * This is not persisted in the tree, and observation of it is not tracked by the tree observation tracking.\n\t\t * @privateRemarks\n\t\t * Opt this into observation tracking.\n\t\t */\n\t\tdefaultFormat: CharacterFormat;\n\n\t\t/**\n\t\t * Gets an iterable over the characters currently in the text.\n\t\t * @remarks\n\t\t * This iterator matches the behavior of {@link (TreeArrayNode:interface)} with respect to edits during iteration.\n\t\t */\n\t\tcharactersWithFormatting(): Iterable<StringAtom>;\n\n\t\t/**\n\t\t * Insert a range of characters into the string based on character index.\n\t\t * @remarks\n\t\t * See {@link (TreeArrayNode:interface).insertAt} for more details on the behavior.\n\t\t * See {@link FormattedTextAsTree.Statics.fromString} for how the `additionalCharacters` string is broken into characters.\n\t\t * @privateRemarks\n\t\t * If we provide ways to customize character boundaries, that could be handled here by taking in an Iterable<string> instead of a string.\n\t\t * Doing this currently would enable insertion of text with different character boundaries than the existing text,\n\t\t * which would violate the currently documented character boundary invariants.\n\t\t *\n\t\t * Another option would be to take an approach like Table,\n\t\t * where the user of the API uses a factory function to generate the schema, and can inject custom logic, like a string character iterator.\n\t\t */\n\t\tinsertWithFormattingAt(\n\t\t\tindex: number,\n\t\t\tadditionalCharacters: Iterable<InsertableTypedNode<typeof StringAtom>>,\n\t\t): void;\n\n\t\t/**\n\t\t * Apply formatting to a range of characters based on character index.\n\t\t * @param startIndex - The starting index of the range to format.\n\t\t * @param length - The number of characters to format.\n\t\t * @param format - The formatting to apply to the specified range.\n\t\t */\n\t\tformatRange(startIndex: number, length: number, format: Partial<CharacterFormat>): void;\n\t}\n\n\t/**\n\t * Schema for a text node.\n\t * @remarks\n\t * See {@link FormattedTextAsTree.Members} for the API.\n\t * See {@link FormattedTextAsTree.Statics} for static APIs on this Schema, including construction.\n\t * @internal\n\t */\n\texport const Tree = eraseSchemaDetails<Members, Statics>()(TextNode);\n\texport type Tree = Members & TreeNode & WithType<\"com.fluidframework.text.formatted.Text\">;\n}\n"]}