@fluidframework/tree 2.114.0 → 2.115.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.
- package/CHANGELOG.md +191 -0
- package/api-report/tree.alpha.api.md +108 -39
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +3 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/rebase/index.d.ts +1 -1
- package/dist/core/rebase/index.d.ts.map +1 -1
- package/dist/core/rebase/index.js +2 -1
- package/dist/core/rebase/index.js.map +1 -1
- package/dist/core/rebase/types.d.ts +110 -0
- package/dist/core/rebase/types.d.ts.map +1 -1
- package/dist/core/rebase/types.js +47 -1
- package/dist/core/rebase/types.js.map +1 -1
- package/dist/entrypoints/alpha.d.ts +1 -1
- package/dist/entrypoints/alpha.d.ts.map +1 -1
- package/dist/entrypoints/alpha.js +6 -4
- package/dist/entrypoints/alpha.js.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -6
- package/dist/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/dist/feature-libraries/chunked-forest/codec/codecs.js +16 -13
- package/dist/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/shared-tree/sharedTree.d.ts +5 -0
- package/dist/shared-tree/sharedTree.d.ts.map +1 -1
- package/dist/shared-tree/sharedTree.js +1 -1
- package/dist/shared-tree/sharedTree.js.map +1 -1
- package/dist/shared-tree/treeCheckout.d.ts +5 -0
- package/dist/shared-tree/treeCheckout.d.ts.map +1 -1
- package/dist/shared-tree/treeCheckout.js +58 -12
- package/dist/shared-tree/treeCheckout.js.map +1 -1
- package/dist/shared-tree-core/branch.d.ts +1 -0
- package/dist/shared-tree-core/branch.d.ts.map +1 -1
- package/dist/shared-tree-core/branch.js.map +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js +1 -1
- package/dist/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/dist/simple-tree/api/index.d.ts +1 -1
- package/dist/simple-tree/api/index.d.ts.map +1 -1
- package/dist/simple-tree/api/index.js +2 -3
- package/dist/simple-tree/api/index.js.map +1 -1
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts +3 -3
- package/dist/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.d.ts +6 -7
- package/dist/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/dist/simple-tree/api/schemaStatics.js.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.d.ts +20 -24
- package/dist/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/dist/simple-tree/api/treeNodeApi.js +48 -49
- package/dist/simple-tree/api/treeNodeApi.js.map +1 -1
- package/dist/simple-tree/core/treeNode.d.ts +5 -6
- package/dist/simple-tree/core/treeNode.d.ts.map +1 -1
- package/dist/simple-tree/core/treeNode.js +2 -4
- package/dist/simple-tree/core/treeNode.js.map +1 -1
- package/dist/simple-tree/core/withType.d.ts +20 -7
- package/dist/simple-tree/core/withType.d.ts.map +1 -1
- package/dist/simple-tree/core/withType.js +4 -7
- package/dist/simple-tree/core/withType.js.map +1 -1
- package/dist/simple-tree/index.d.ts +2 -2
- package/dist/simple-tree/index.d.ts.map +1 -1
- package/dist/simple-tree/index.js +3 -4
- package/dist/simple-tree/index.js.map +1 -1
- package/dist/simple-tree/leafNodeSchema.d.ts +6 -1
- package/dist/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/dist/simple-tree/leafNodeSchema.js +0 -1
- package/dist/simple-tree/leafNodeSchema.js.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts +32 -3
- package/dist/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/array/arrayNode.js +91 -10
- package/dist/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts +77 -0
- package/dist/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js +17 -1
- package/dist/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/object/objectNode.js +2 -2
- package/dist/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/dist/simple-tree/node-kinds/record/recordNode.js +2 -2
- package/dist/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/dist/text/codePointUtils.d.ts +2 -2
- package/dist/text/codePointUtils.js +2 -2
- package/dist/text/codePointUtils.js.map +1 -1
- package/dist/text/index.d.ts +3 -3
- package/dist/text/index.d.ts.map +1 -1
- package/dist/text/index.js +4 -4
- package/dist/text/index.js.map +1 -1
- package/dist/text/textDomain.d.ts +18 -18
- package/dist/text/textDomain.d.ts.map +1 -1
- package/dist/text/textDomain.js +8 -8
- package/dist/text/textDomain.js.map +1 -1
- package/dist/text/textDomainFormatted.d.ts +46 -42
- package/dist/text/textDomainFormatted.d.ts.map +1 -1
- package/dist/text/textDomainFormatted.js +32 -28
- package/dist/text/textDomainFormatted.js.map +1 -1
- package/dist/text/textDomainFormattedDefault.d.ts +18 -18
- package/dist/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/dist/text/textDomainFormattedDefault.js +14 -17
- package/dist/text/textDomainFormattedDefault.js.map +1 -1
- package/dist/util/compressedIds.d.ts +22 -2
- package/dist/util/compressedIds.d.ts.map +1 -1
- package/dist/util/compressedIds.js +22 -1
- package/dist/util/compressedIds.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.d.ts.map +1 -1
- package/lib/core/index.js +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/core/rebase/index.d.ts +1 -1
- package/lib/core/rebase/index.d.ts.map +1 -1
- package/lib/core/rebase/index.js +1 -1
- package/lib/core/rebase/index.js.map +1 -1
- package/lib/core/rebase/types.d.ts +110 -0
- package/lib/core/rebase/types.d.ts.map +1 -1
- package/lib/core/rebase/types.js +46 -0
- package/lib/core/rebase/types.js.map +1 -1
- package/lib/entrypoints/alpha.d.ts +1 -1
- package/lib/entrypoints/alpha.d.ts.map +1 -1
- package/lib/entrypoints/alpha.js +1 -1
- package/lib/entrypoints/alpha.js.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts +9 -6
- package/lib/feature-libraries/chunked-forest/codec/codecs.d.ts.map +1 -1
- package/lib/feature-libraries/chunked-forest/codec/codecs.js +16 -13
- package/lib/feature-libraries/chunked-forest/codec/codecs.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/shared-tree/sharedTree.d.ts +5 -0
- package/lib/shared-tree/sharedTree.d.ts.map +1 -1
- package/lib/shared-tree/sharedTree.js +1 -1
- package/lib/shared-tree/sharedTree.js.map +1 -1
- package/lib/shared-tree/treeCheckout.d.ts +5 -0
- package/lib/shared-tree/treeCheckout.d.ts.map +1 -1
- package/lib/shared-tree/treeCheckout.js +60 -14
- package/lib/shared-tree/treeCheckout.js.map +1 -1
- package/lib/shared-tree-core/branch.d.ts +1 -0
- package/lib/shared-tree-core/branch.d.ts.map +1 -1
- package/lib/shared-tree-core/branch.js.map +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js +1 -1
- package/lib/shared-tree-core/sharedTreeCore.js.map +1 -1
- package/lib/simple-tree/api/index.d.ts +1 -1
- package/lib/simple-tree/api/index.d.ts.map +1 -1
- package/lib/simple-tree/api/index.js +1 -1
- package/lib/simple-tree/api/index.js.map +1 -1
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts +3 -3
- package/lib/simple-tree/api/schemaFactoryAlpha.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.d.ts +6 -7
- package/lib/simple-tree/api/schemaStatics.d.ts.map +1 -1
- package/lib/simple-tree/api/schemaStatics.js.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.d.ts +20 -24
- package/lib/simple-tree/api/treeNodeApi.d.ts.map +1 -1
- package/lib/simple-tree/api/treeNodeApi.js +46 -46
- package/lib/simple-tree/api/treeNodeApi.js.map +1 -1
- package/lib/simple-tree/core/treeNode.d.ts +5 -6
- package/lib/simple-tree/core/treeNode.d.ts.map +1 -1
- package/lib/simple-tree/core/treeNode.js +2 -4
- package/lib/simple-tree/core/treeNode.js.map +1 -1
- package/lib/simple-tree/core/withType.d.ts +20 -7
- package/lib/simple-tree/core/withType.d.ts.map +1 -1
- package/lib/simple-tree/core/withType.js +4 -7
- package/lib/simple-tree/core/withType.js.map +1 -1
- package/lib/simple-tree/index.d.ts +2 -2
- package/lib/simple-tree/index.d.ts.map +1 -1
- package/lib/simple-tree/index.js +1 -1
- package/lib/simple-tree/index.js.map +1 -1
- package/lib/simple-tree/leafNodeSchema.d.ts +6 -1
- package/lib/simple-tree/leafNodeSchema.d.ts.map +1 -1
- package/lib/simple-tree/leafNodeSchema.js +0 -1
- package/lib/simple-tree/leafNodeSchema.js.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts +32 -3
- package/lib/simple-tree/node-kinds/array/arrayNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/array/arrayNode.js +93 -12
- package/lib/simple-tree/node-kinds/array/arrayNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts +77 -0
- package/lib/simple-tree/node-kinds/map/mapNode.d.ts.map +1 -1
- package/lib/simple-tree/node-kinds/map/mapNode.js +18 -2
- package/lib/simple-tree/node-kinds/map/mapNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/object/objectNode.js +3 -3
- package/lib/simple-tree/node-kinds/object/objectNode.js.map +1 -1
- package/lib/simple-tree/node-kinds/record/recordNode.js +3 -3
- package/lib/simple-tree/node-kinds/record/recordNode.js.map +1 -1
- package/lib/text/codePointUtils.d.ts +2 -2
- package/lib/text/codePointUtils.js +2 -2
- package/lib/text/codePointUtils.js.map +1 -1
- package/lib/text/index.d.ts +3 -3
- package/lib/text/index.d.ts.map +1 -1
- package/lib/text/index.js +3 -3
- package/lib/text/index.js.map +1 -1
- package/lib/text/textDomain.d.ts +18 -18
- package/lib/text/textDomain.d.ts.map +1 -1
- package/lib/text/textDomain.js +7 -7
- package/lib/text/textDomain.js.map +1 -1
- package/lib/text/textDomainFormatted.d.ts +46 -42
- package/lib/text/textDomainFormatted.d.ts.map +1 -1
- package/lib/text/textDomainFormatted.js +31 -27
- package/lib/text/textDomainFormatted.js.map +1 -1
- package/lib/text/textDomainFormattedDefault.d.ts +18 -18
- package/lib/text/textDomainFormattedDefault.d.ts.map +1 -1
- package/lib/text/textDomainFormattedDefault.js +14 -17
- package/lib/text/textDomainFormattedDefault.js.map +1 -1
- package/lib/util/compressedIds.d.ts +22 -2
- package/lib/util/compressedIds.d.ts.map +1 -1
- package/lib/util/compressedIds.js +22 -1
- package/lib/util/compressedIds.js.map +1 -1
- package/package.json +29 -22
- package/src/core/index.ts +2 -0
- package/src/core/rebase/index.ts +2 -0
- package/src/core/rebase/types.ts +113 -0
- package/src/entrypoints/alpha.ts +10 -6
- package/src/feature-libraries/chunked-forest/codec/codecs.ts +17 -14
- package/src/index.ts +7 -4
- package/src/packageVersion.ts +1 -1
- package/src/shared-tree/sharedTree.ts +6 -1
- package/src/shared-tree/treeCheckout.ts +81 -14
- package/src/shared-tree-core/branch.ts +1 -0
- package/src/shared-tree-core/sharedTreeCore.ts +1 -1
- package/src/simple-tree/api/index.ts +0 -1
- package/src/simple-tree/api/schemaStatics.ts +2 -2
- package/src/simple-tree/api/treeNodeApi.ts +64 -48
- package/src/simple-tree/core/treeNode.ts +13 -10
- package/src/simple-tree/core/withType.ts +20 -7
- package/src/simple-tree/index.ts +1 -2
- package/src/simple-tree/leafNodeSchema.ts +6 -1
- package/src/simple-tree/node-kinds/array/arrayNode.ts +109 -14
- package/src/simple-tree/node-kinds/map/mapNode.ts +113 -3
- package/src/simple-tree/node-kinds/object/objectNode.ts +3 -3
- package/src/simple-tree/node-kinds/record/recordNode.ts +3 -3
- package/src/text/README.md +1 -1
- package/src/text/codePointUtils.ts +2 -2
- package/src/text/index.ts +3 -3
- package/src/text/textDomain.ts +21 -21
- package/src/text/textDomainFormatted.ts +56 -52
- package/src/text/textDomainFormattedDefault.ts +14 -23
- package/src/util/compressedIds.ts +36 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrayNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/array/arrayNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,kEAA8E;AAC9E,uEAAsE;AAEtE,qDAA0E;AAM1E,kEAA8E;AAC9E,qDAKgC;AAEhC,kDAiC6B;AAC7B,6DAGgC;AAChC,+DAAqD;AACrD,yEAA+E;AAE/E,mGAKmD;AA4gBnD;;;GAGG;AACU,QAAA,aAAa,GAAG;IAC5B;;;;;;;;;OASG;IACH,MAAM,EAAE,CAAI,OAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;CAC3C,CAAC;AAEX;;;GAGG;AACH,IAAI,MAAgE,CAAC;AAErE;;;;GAIG;AACH,MAAa,wBAAwB;IAKpC,YAAqC,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAE7D;;OAEG;IACI,CAAC,MAAM,CAAC,QAAQ,CAAC;QACvB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxC,CAAC;CACD;AAbD,4DAaC;AAZA;IACC,MAAM,GAAG,CAAK,OAAqB,EAAE,EAAE,CAAC,IAAI,wBAAwB,CAAC,OAAO,CAAC,CAA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,SAAgB,0BAA0B,CACzC,IAAmB,EACnB,YAAoB;IAEpB,MAAM,KAAK,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,mBAAQ,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAC1C,OAAO;QACN,IAAI,KAAK;YACR,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACzB,OAAO,KAAK,CAAC,MAAM,CAAC;YACrB,CAAC;YACD,IAAI,KAAK,CAAC,WAAW,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;gBACxC,OAAO,KAAK,CAAC,MAAM,CAAC;YACrB,CAAC;YACD,OAAO,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC;QAChC,CAAC;KACD,CAAC;AACH,CAAC;AAjBD,gEAiBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Lazy, oob, fail, assert } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey, ObjectNodeStoredSchema } from \"../../../core/index.js\";\nimport type {\n\tFlexibleFieldContent,\n\tFlexTreeNode,\n\tFlexTreeSequenceField,\n} from \"../../../feature-libraries/index.js\";\nimport { FieldKinds, isTreeValue } from \"../../../feature-libraries/index.js\";\nimport {\n\tbrand,\n\tvalidateIndex,\n\tvalidateIndexRange,\n\ttype JsonCompatibleReadOnlyObject,\n} from \"../../../util/index.js\";\nimport type { NodeSchemaOptionsAlpha, System_Unsafe } from \"../../api/index.js\";\nimport {\n\tCompatibilityLevel,\n\ttype WithType,\n\t// eslint-disable-next-line import-x/no-deprecated\n\ttypeNameSymbol,\n\tNodeKind,\n\ttype TreeNode,\n\ttype InternalTreeNode,\n\ttype TreeNodeSchema,\n\ttypeSchemaSymbol,\n\tgetOrCreateNodeFromInnerNode,\n\tgetSimpleNodeSchemaFromInnerNode,\n\tgetInnerNode,\n\ttype TreeNodeSchemaClass,\n\tgetKernel,\n\ttype UnhydratedFlexTreeNode,\n\tUnhydratedSequenceField,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n\tnormalizeAllowedTypes,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype TreeLeafValue,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\ttype TreeNodeSchemaPrivateData,\n\tAnnotatedAllowedTypesInternal,\n} from \"../../core/index.js\";\nimport {\n\tgetTreeNodeSchemaInitializedData,\n\tgetUnhydratedContext,\n} from \"../../createContext.js\";\nimport { nullSchema } from \"../../leafNodeSchema.js\";\nimport { prepareArrayContentForInsertion } from \"../../prepareForInsertion.js\";\nimport type { SchemaType, SimpleAllowedTypeAttributes } from \"../../simpleSchema.js\";\nimport {\n\ttype FactoryContent,\n\ttype InsertableContent,\n\tunhydratedFlexTreeFromInsertable,\n\tunhydratedFlexTreeFromInsertableNode,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\n\nimport type {\n\tArrayNodeCustomizableSchema,\n\tArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n} from \"./arrayNodeTypes.js\";\n\n/**\n * A covariant base type for {@link (TreeArrayNode:interface)}.\n *\n * This provides the readonly subset of TreeArrayNode functionality, and is used as the source interface for moves since that needs to be covariant.\n * @privateRemarks\n * Ideally this would just include `TreeNode, WithType<string, NodeKind.Array>` in the extends list but https://github.com/microsoft/TypeScript/issues/16936 prevents that from compiling.\n * As a workaround around for this TypeScript limitation, the conflicting type intersection is wrapped in `Awaited` (which has no effect on the type in this case) which allows it to compile.\n * @system @sealed @public\n */\nexport interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue>\n\textends ReadonlyArray<T>,\n\t\tAwaited<TreeNode & WithType<string, NodeKind.Array>> {}\n\n/**\n * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.\n *\n * @typeParam TAllowedTypes - Schema for types which are allowed as members of this array.\n * @typeParam T - Use Default: Do not specify. Type of values to read from the array.\n * @typeParam TNew - Use Default: Do not specify. Type of values to write into the array.\n * @typeParam TMoveFrom - Use Default: Do not specify. Type of node from which children can be moved into this array.\n *\n * @sealed @public\n */\nexport interface TreeArrayNode<\n\tTAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes,\n\tout T = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? TreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TNew = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TMoveFrom = ReadonlyArrayNode,\n> extends ReadonlyArrayNode<T> {\n\t/**\n\t * Inserts new item(s) at a specified location.\n\t *\n\t * @remarks\n\t * All items inserted by a single call to this method are inserted consecutively.\n\t * The order of the inserted items relative to other concurrently inserted items at the same location is only partially specified:\n\t * Concurrently inserting `[A, B]` and `[X, Y]` at the same location may yield\n\t * either `[A, B, X, Y]` or `[X, Y, A, B]`, regardless of the order in which those edits are sequenced.\n\t * No other interleavings are possible. (e.g. `[A, X, B, Y]` is not possible.)\n\t *\n\t * @param index - The index at which to insert `value`.\n\t * @param value - The content to insert.\n\t * @throws Throws if `index` is not in the range [0, `array.length`).\n\t */\n\tinsertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the start of the array.\n\t * @remarks\n\t * Equivalent to `insertAt(0, ...value)`:\n\t * see {@link (TreeArrayNode:interface).insertAt} for details, including merge semantics with concurrent edits.\n\t * @param value - The content to insert.\n\t */\n\tinsertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the end of the array.\n\t * @remarks\n\t * Equivalent to `insertAt(array.length, ...value)`:\n\t * see {@link (TreeArrayNode:interface).insertAt} for details, including merge semantics with concurrent edits.\n\t * @param value - The content to insert.\n\t */\n\tinsertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the end of the array.\n\t *\n\t * @remarks\n\t * Unlike `Array.prototype.push`, this method does not return the new length of the array.\n\t *\n\t * Equivalent to `insertAt(array.length, ...value)`:\n\t * see {@link (TreeArrayNode:interface).insertAt} for details, including merge semantics with concurrent edits.\n\t *\n\t * @param value - The content to insert.\n\t */\n\tpush(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Removes the item at the specified location.\n\t * @param index - The index at which to remove the item.\n\t * @throws Throws if `index` is not in the range [0, `array.length`).\n\t * @remarks\n\t * The item to remove is determined when this method is called, not when the resulting edit is sequenced.\n\t * This means that, once the edit is sequenced, the item being removed may no longer be at `index`,\n\t * and may in fact no longer be in this array at all (for example, if a concurrent edit moved it to another array).\n\t * This operation removes that item from wherever it then resides.\n\t */\n\tremoveAt(index: number): void;\n\n\t/**\n\t * Removes all items between the specified indices.\n\t * @param start - The starting index of the range to remove (inclusive). Defaults to the start of the array.\n\t * @param end - The ending index of the range to remove (exclusive). Defaults to `array.length`.\n\t * @throws Throws if `start` is not in the range [0, `array.length`].\n\t * @throws Throws if `end` is less than `start`.\n\t * If `end` is not supplied or is greater than the length of the array, all items after `start` are removed.\n\t *\n\t * @remarks\n\t * The default values for start and end are computed when this is called,\n\t * and thus the behavior is the same as providing them explicitly, even with respect to merge resolution with concurrent edits.\n\t * For example, two concurrent transactions both emptying the array with `node.removeRange()` then inserting an item,\n\t * will merge to result in the array having both inserted items.\n\t */\n\tremoveRange(start?: number, end?: number): void;\n\n\t/**\n\t * Moves the specified item to the start of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToStart(sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the start of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToStart(sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified item to the end of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToEnd(sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the end of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToEnd(sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified item to the desired location in the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if any of the input indices are not in the range [0, `array.length`).\n\t */\n\tmoveToIndex(destinationGap: number, sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the desired location in the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if any of the source index is not in the range [0, `array.length`),\n\t * or if the index is not in the range [0, `array.length`].\n\t */\n\tmoveToIndex(destinationGap: number, sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the start of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToStart(sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the start of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToStart(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the end of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToEnd(sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the end of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToEnd(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the desired location within the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if any of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the desired location within the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToIndex(\n\t\tdestinationGap: number,\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource: TMoveFrom,\n\t): void;\n\n\t/**\n\t * Returns a custom IterableIterator which throws usage errors if concurrent editing and iteration occurs.\n\t */\n\tvalues(): IterableIterator<T>;\n}\n\n/**\n * {@link (TreeArrayNode:interface)} with additional alpha APIs.\n * @alpha @sealed\n */\nexport interface TreeArrayNodeAlpha<\n\tTAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes,\n\tout T = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? TreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TNew = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n> extends TreeArrayNode<TAllowedTypes, T, TNew> {\n\t/**\n\t * Returns the item located at the specified index.\n\t * @param index - The zero-based index of the item to retrieve.\n\t * Negative indices count back from the last item in the array: for `index < 0`, `index + array.length` is used.\n\t * @returns The item at the specified index, or `undefined` if the index is out of bounds.\n\t */\n\tat(index: number): T | undefined;\n\n\t/**\n\t * Returns the last item in the array for which the given type guard returns `true`,\n\t * searching from the last item to the first.\n\t * @remarks\n\t * The array's length is captured when the search begins; items are read live as the search progresses.\n\t * If `predicate` edits the array, behavior matches {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast | Array.prototype.findLast}.\n\t * @typeParam S - The subtype of `T` asserted by the `predicate` type guard.\n\t * @param predicate - Evaluated once per item, starting from the last item and moving towards the first, until it returns `true`.\n\t * Receives the item, its index, and the array being searched.\n\t * @param thisArg - If provided, used as `this` when invoking `predicate`.\n\t * @returns The last item for which `predicate` returns `true` (narrowed to the guarded type), or `undefined` if there is no such item.\n\t */\n\tfindLast<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: unknown,\n\t): S | undefined;\n\n\t/**\n\t * Returns the last item in the array for which the given predicate returns a truthy value,\n\t * searching from the last item to the first.\n\t * @remarks\n\t * The array's length is captured when the search begins; items are read live as the search progresses.\n\t * If `predicate` edits the array, behavior matches {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast | Array.prototype.findLast}.\n\t * @param predicate - Evaluated once per item, starting from the last item and moving towards the first, until it returns a truthy value.\n\t * Receives the item, its index, and the array being searched.\n\t * @param thisArg - If provided, used as `this` when invoking `predicate`.\n\t * @returns The last item for which `predicate` returns a truthy value, or `undefined` if there is no such item.\n\t */\n\tfindLast(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: unknown,\n\t): T | undefined;\n\n\t/**\n\t * Returns the index of the last item in the array for which the given predicate returns a truthy value,\n\t * searching from the last item to the first.\n\t * @remarks\n\t * The array's length is captured when the search begins; items are read live as the search progresses.\n\t * If `predicate` edits the array, behavior matches {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex | Array.prototype.findLastIndex}.\n\t * @param predicate - Evaluated once per item, starting from the last item and moving towards the first, until it returns a truthy value.\n\t * Receives the item, its index, and the array being searched.\n\t * @param thisArg - If provided, used as `this` when invoking `predicate`.\n\t * @returns The index of the last item for which `predicate` returns a truthy value, or `-1` if there is no such item.\n\t */\n\tfindLastIndex(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: unknown,\n\t): number;\n\n\t/**\n\t * Removes the last item from the array and returns it.\n\t * @returns The removed item, or `undefined` if the array is empty (in which case the array is not modified).\n\t * @remarks\n\t * Equivalent to `removeAt(array.length - 1)`, additionally returning the removed item:\n\t * see {@link (TreeArrayNode:interface).removeAt} for details, including merge semantics with concurrent edits.\n\t * In particular, the item removed is the one that is last at the time this method is called,\n\t * not the one that is last at the time the resulting edit is sequenced.\n\t */\n\tpop(): T | undefined;\n\n\t/**\n\t * Removes the first item from the array and returns it.\n\t * @returns The removed item, or `undefined` if the array is empty (in which case the array is not modified).\n\t * @remarks\n\t * Equivalent to `removeAt(0)`, additionally returning the removed item:\n\t * see {@link (TreeArrayNode:interface).removeAt} for details, including merge semantics with concurrent edits.\n\t * In particular, the item removed is the one that is first at the time this method is called,\n\t * not the one that is first at the time the resulting edit is sequenced.\n\t */\n\tshift(): T | undefined;\n\n\t/**\n\t * Inserts new item(s) at the start of the array.\n\t *\n\t * @param value - The content to insert.\n\t * @remarks\n\t * Unlike `Array.prototype.unshift`, this method does not return the new length of the array.\n\t *\n\t * All items inserted by a single call to this method are inserted consecutively.\n\t * The order of the inserted items relative to other concurrently inserted items is fully specified:\n\t * Concurrently unshifting `[A, B]` and `[X, Y]` will yield `[A, B, X, Y]` if the edit unshifting `[A, B]`\n\t * is sequenced after the edit unshifting `[X, Y]`.\n\t */\n\tunshift(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Removes existing item(s) and/or adds new item(s).\n\t * @param start - The index at which to start changing the array. If negative, it is treated as `array.length + start`.\n\t * Must be a positive in bounds index or a negative index such that `array.length + start` is a positive in bounds index.\n\t * @param deleteCount - The number of item(s) to remove. If not provided, it defaults to the end of the array.\n\t * Must be a non-negative integer no greater than the number of items from `start` to the end of the array.\n\t * @param items - The item(s) to insert at `start`.\n\t * @returns An array containing the item(s) that were removed.\n\t * @remarks\n\t * See {@link (TreeArrayNode:interface).insertAt} for the merge semantics of the inserted items.\n\t */\n\tsplice(\n\t\tstart: number,\n\t\tdeleteCount?: number,\n\t\t...items: readonly (TNew | IterableTreeArrayContent<TNew>)[]\n\t): T[];\n}\n\n/**\n * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.\n * @public\n */\nexport const TreeArrayNode = {\n\t/**\n\t * Wrap an iterable of items to inserted as consecutive items in a array.\n\t * @remarks\n\t * The object returned by this function can be inserted into a {@link (TreeArrayNode:interface)}.\n\t * Its contents will be inserted consecutively in the corresponding location in the array.\n\t * @example\n\t * ```ts\n\t * array.insertAtEnd(TreeArrayNode.spread(iterable))\n\t * ```\n\t */\n\tspread: <T>(content: Iterable<T>) => create(content),\n} as const;\n\n/**\n * Package internal construction API.\n * Use {@link (TreeArrayNode:variable).spread} to create an instance of this type instead.\n */\nlet create: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;\n\n/**\n * Used to insert iterable content into a {@link (TreeArrayNode:interface)}.\n * Use {@link (TreeArrayNode:variable).spread} to create an instance of this type.\n * @sealed @public\n */\nexport class IterableTreeArrayContent<T> implements Iterable<T> {\n\tstatic {\n\t\tcreate = <T2>(content: Iterable<T2>) => new IterableTreeArrayContent(content);\n\t}\n\n\tprivate constructor(private readonly content: Iterable<T>) {}\n\n\t/**\n\t * Iterates over content for nodes to insert.\n\t */\n\tpublic [Symbol.iterator](): Iterator<T> {\n\t\treturn this.content[Symbol.iterator]();\n\t}\n}\n\n/**\n * Given a array node proxy, returns its underlying LazySequence field.\n */\nfunction getSequenceField(arrayNode: ReadonlyArrayNode): FlexTreeSequenceField {\n\treturn getInnerNode(arrayNode).getBoxed(EmptyKey) as FlexTreeSequenceField;\n}\n\n// For compatibility, we are initially implement 'readonly T[]' by applying the Array.prototype methods\n// to the array node proxy. Over time, we should replace these with efficient implementations on LazySequence\n// to avoid re-entering the proxy as these methods access 'length' and the indexed properties.\n//\n// For brevity, the current implementation dynamically builds a property descriptor map from a list of\n// Array functions we want to re-expose via the proxy.\n\nconst arrayPrototypeKeys = [\n\t\"concat\",\n\t\"entries\",\n\t\"every\",\n\t\"filter\",\n\t\"find\",\n\t\"findIndex\",\n\t\"flat\",\n\t\"flatMap\",\n\t\"forEach\",\n\t\"includes\",\n\t\"indexOf\",\n\t\"join\",\n\t\"keys\",\n\t\"lastIndexOf\",\n\t\"map\",\n\t\"reduce\",\n\t\"reduceRight\",\n\t\"slice\",\n\t\"some\",\n\t\"toLocaleString\",\n\t\"toString\",\n\n\t// \"copyWithin\",\n\t// \"fill\",\n\t// \"length\",\n\t// \"pop\",\n\t// \"push\",\n\t// \"reverse\",\n\t// \"shift\",\n\t// \"sort\",\n\t// \"splice\",\n\t// \"unshift\",\n] as const;\n\n/**\n * {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.\n * @privateRemarks\n * Since a lot of scratch types and values are involved with creating this,\n * it's generating using an immediately invoked function expression (IIFE).\n * This is a common JavaScript pattern for cases like this to avoid cluttering the scope.\n */\nconst TreeNodeWithArrayFeatures = (() => {\n\t/**\n\t * {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.\n\t */\n\tabstract class TreeNodeWithArrayFeaturesUntyped<\n\t\tconst T extends ImplicitAllowedTypes,\n\t> extends TreeNodeValid<Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>> {}\n\n\t// Modify TreeNodeWithArrayFeaturesUntyped to add the members from Array.prototype\n\tfor (const key of arrayPrototypeKeys) {\n\t\tObject.defineProperty(TreeNodeWithArrayFeaturesUntyped.prototype, key, {\n\t\t\tvalue: Array.prototype[key],\n\t\t});\n\t}\n\n\treturn TreeNodeWithArrayFeaturesUntyped as unknown as typeof NodeWithArrayFeatures;\n})();\n\n/**\n * Type of {@link TreeNodeValid}, but with array members added to the instance type.\n *\n * TypeScript has a rule that `Base constructors must all have the same return type.ts(2510)`.\n * This means that intersecting two types with different constructors to create a type with a more constrained constructor (ex: more specific return type)\n * is not supported.\n *\n * TypeScript also has a limitation that there is no way to replace or remove just the constructor of a type without losing all the private and protected members.\n * See https://github.com/microsoft/TypeScript/issues/35416 for details.\n *\n * TypeScript also does not support explicitly specifying the instance type in a class definition as the constructor return type.\n *\n * Thus to replace the instance type, while preserving the protected static members of TreeNodeValid,\n * the only option seems to be actually declaring a class with all the members explicitly inline.\n *\n * To avoid incurring any bundle size / runtime overhead from this and having to stub out the function bodies,\n * the class uses `declare`.\n * TypeScript does not support `declare` inside scopes, so this is not inside the function scope above.\n *\n * The members of this class were generated using the \"implement interface\" refactoring.\n * Since that refactoring does not add `public`, the lint to require it is disabled for this section of the file.\n * To update this class delete all members and reapply the \"implement interface\" refactoring.\n * As these signatures get formatted to be over three times as many lines with prettier (which is not helpful), it is also suppressed.\n */\n/* eslint-disable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */\n// prettier-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ndeclare abstract class NodeWithArrayFeatures<Input, T>\n\textends TreeNodeValid<Input>\n\timplements Pick<readonly T[], (typeof arrayPrototypeKeys)[number]>\n{\n\tconcat(...items: ConcatArray<T>[]): T[];\n\tconcat(...items: (T | ConcatArray<T>)[]): T[];\n\tentries(): IterableIterator<[number, T]>;\n\tevery<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): this is readonly S[];\n\tevery(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): boolean;\n\tfilter<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): S[];\n\tfilter(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): T[];\n\tfind<S extends T>(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): S | undefined;\n\tfind(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): T | undefined;\n\tfindIndex(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): number;\n\tflat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];\n\tflatMap<U, This = undefined>(\n\t\tcallback: (this: This, value: T, index: number, array: T[]) => U | readonly U[],\n\t\tthisArg?: This | undefined,\n\t): U[];\n\tforEach(\n\t\tcallbackfn: (value: T, index: number, array: readonly T[]) => void,\n\t\tthisArg?: any,\n\t): void;\n\tincludes(searchElement: T, fromIndex?: number | undefined): boolean;\n\tindexOf(searchElement: T, fromIndex?: number | undefined): number;\n\tjoin(separator?: string | undefined): string;\n\tkeys(): IterableIterator<number>;\n\tlastIndexOf(searchElement: T, fromIndex?: number | undefined): number;\n\tmap<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];\n\treduce(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t): T;\n\treduce(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t\tinitialValue: T,\n\t): T;\n\treduce<U>(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: U,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => U,\n\t\tinitialValue: U,\n\t): U;\n\treduceRight(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t): T;\n\treduceRight(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t\tinitialValue: T,\n\t): T;\n\treduceRight<U>(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: U,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => U,\n\t\tinitialValue: U,\n\t): U;\n\tslice(start?: number | undefined, end?: number | undefined): T[];\n\tsome(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): boolean;\n\ttoLocaleString(): string;\n\ttoString(): string;\n}\n/* eslint-enable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */\n\n/**\n * Attempts to coerce the given property key to an integer index property.\n * @param key - The property key to coerce.\n * @param exclusiveMax - This restricts the range in which the resulting index is allowed to be.\n * The coerced index of `key` must be less than `exclusiveMax` or else this function will return `undefined`.\n * This is useful for reading an array within the bounds of its length, e.g. `asIndex(key, array.length)`.\n */\nexport function asIndex(key: string | symbol, exclusiveMax: number): number | undefined {\n\tif (typeof key !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// TODO: It may be worth a '0' <= ch <= '9' check before calling 'Number' to quickly\n\t// reject 'length' as an index, or even parsing integers ourselves.\n\tconst asNumber = Number(key);\n\tif (!Number.isInteger(asNumber)) {\n\t\treturn undefined;\n\t}\n\n\t// Check that the original string is the same after converting to a number and back again.\n\t// This prevents keys like \"5.0\", \"0x5\", \" 5\" from coercing to 5, and keys like \" \" or \"\" from coercing to 0.\n\tconst asString = String(asNumber);\n\tif (asString !== key) {\n\t\treturn undefined;\n\t}\n\n\t// TODO: See 'matrix/range.ts' for fast integer coercing + range check.\n\treturn 0 <= asNumber && asNumber < exclusiveMax ? asNumber : undefined;\n}\n\n/**\n * Create a proxy which implements the {@link TreeArrayNode} API.\n * @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.\n * Otherwise setting of unexpected properties will error.\n * @param proxyTarget - Target object of the proxy. Must provide an own `length` value property\n * (which is not used but must exist for getOwnPropertyDescriptor invariants) and the array functionality from {@link arrayNodePrototype}.\n * Controls the prototype exposed by the produced proxy.\n * @param dispatchTarget - provides the functionally of the node, implementing all fields.\n */\nfunction createArrayNodeProxy(\n\tallowAdditionalProperties: boolean,\n\tproxyTarget: object,\n\tdispatchTarget: object,\n): TreeArrayNode {\n\t// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an array literal in order\n\t// to pass 'Object.getPrototypeOf'. It also satisfies 'Array.isArray' and 'Object.prototype.toString'\n\t// requirements without use of Array[Symbol.species], which is potentially on a path to deprecation.\n\tconst proxy: TreeArrayNode = new Proxy<TreeArrayNode>(proxyTarget as TreeArrayNode, {\n\t\tget: (target, key, receiver) => {\n\t\t\tconst field = getSequenceField(receiver);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\n\t\t\tif (maybeIndex === undefined) {\n\t\t\t\tif (key === \"length\") {\n\t\t\t\t\treturn field.length;\n\t\t\t\t}\n\n\t\t\t\t// In NodeJS 22, assert.strict.deepEqual started special casing well known constructors like Array.\n\t\t\t\t// That made this necessary, ensuring that in POJO mode, TreeArrayNode are still deepEqual to arrays.\n\t\t\t\tif (key === \"constructor\") {\n\t\t\t\t\treturn proxyTarget.constructor;\n\t\t\t\t}\n\n\t\t\t\t// Pass the proxy as the receiver here, so that any methods on\n\t\t\t\t// the prototype receive `proxy` as `this`.\n\t\t\t\treturn Reflect.get(dispatchTarget, key, receiver) as unknown;\n\t\t\t}\n\n\t\t\tconst maybeContent = field.at(maybeIndex);\n\t\t\treturn maybeContent === undefined\n\t\t\t\t? undefined\n\t\t\t\t: getOrCreateNodeFromInnerUnboxedNode(maybeContent);\n\t\t},\n\t\tset: (target, key, newValue, receiver) => {\n\t\t\tif (key === \"length\") {\n\t\t\t\t// To allow \"length\" to look like \"length\" on an array, getOwnPropertyDescriptor has to report it as a writable value.\n\t\t\t\t// This means the proxy target must provide a length value, but since it can't use getters and setters, it can't be correct.\n\t\t\t\t// Therefor length has to be handled in this proxy.\n\t\t\t\t// Since it's not actually mutable, return false so setting it will produce a type error.\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// 'Symbol.isConcatSpreadable' may be set on an Array instance to modify the behavior of\n\t\t\t// the concat method. We allow this property to be added to the dispatch object.\n\t\t\tif (key === Symbol.isConcatSpreadable) {\n\t\t\t\treturn Reflect.set(dispatchTarget, key, newValue, receiver);\n\t\t\t}\n\n\t\t\t// Array nodes treat all non-negative integer indexes as array access.\n\t\t\t// Using Infinity here (rather than length) ensures that indexing past the end doesn't create additional session local properties.\n\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\t// For MVP, we otherwise disallow setting properties (mutation is only available via the array node mutation APIs).\n\t\t\t\t// To ensure a clear and actionable error experience, we will throw explicitly here, rather than just returning false.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot set indexed properties on array nodes. Use array node mutation APIs to alter the array.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn allowAdditionalProperties ? Reflect.set(target, key, newValue, receiver) : false;\n\t\t},\n\t\thas: (target, key) => {\n\t\t\tconst field = getSequenceField(proxy);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\t\t\treturn maybeIndex !== undefined || Reflect.has(dispatchTarget, key);\n\t\t},\n\t\townKeys: (target) => {\n\t\t\tconst field = getSequenceField(proxy);\n\n\t\t\t// TODO: Would a lazy iterator to produce the indexes work / be more efficient?\n\t\t\t// TODO: Need to surface 'Symbol.isConcatSpreadable' as an own key.\n\t\t\tconst keys: (string | symbol)[] = Array.from(\n\t\t\t\t{ length: field.length },\n\t\t\t\t(_, index) => `${index}`,\n\t\t\t);\n\n\t\t\tif (allowAdditionalProperties) {\n\t\t\t\tkeys.push(...Reflect.ownKeys(target));\n\t\t\t} else {\n\t\t\t\tkeys.push(\"length\");\n\t\t\t}\n\t\t\treturn keys;\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, key) => {\n\t\t\tconst field = getSequenceField(proxy);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\tconst val = field.at(maybeIndex);\n\t\t\t\t// To satisfy 'deepEquals' level scrutiny, the property descriptor for indexed properties must\n\t\t\t\t// be a simple value property (as opposed to using getter) and declared writable/enumerable/configurable.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: val === undefined ? undefined : getOrCreateNodeFromInnerUnboxedNode(val),\n\t\t\t\t\twritable: true, // For MVP, setting indexed properties is reported as allowed here (for deep equals compatibility noted above), but not actually supported.\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t};\n\t\t\t} else if (key === \"length\") {\n\t\t\t\t// To satisfy 'deepEquals' level scrutiny, the property descriptor for 'length' must be a simple\n\t\t\t\t// value property (as opposed to using getter) and be declared writable / non-configurable.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: field.length,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn Reflect.getOwnPropertyDescriptor(dispatchTarget, key);\n\t\t},\n\t\tdefineProperty(target, key, attributes) {\n\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\tthrow new UsageError(\"Shadowing of array indices is not permitted.\");\n\t\t\t}\n\t\t\treturn Reflect.defineProperty(dispatchTarget, key, attributes);\n\t\t},\n\t});\n\treturn proxy;\n}\n\ntype Insertable<T extends ImplicitAllowedTypes> = readonly (\n\t| InsertableTreeNodeFromImplicitAllowedTypes<T>\n\t| IterableTreeArrayContent<InsertableTreeNodeFromImplicitAllowedTypes<T>>\n)[];\n\nabstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>\n\textends TreeNodeWithArrayFeatures<\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNodeFromImplicitAllowedTypes<T>\n\t>\n\timplements TreeArrayNode<T>\n{\n\t// Indexing must be provided by subclass.\n\t[k: number]: TreeNodeFromImplicitAllowedTypes<T>;\n\n\tpublic static readonly kind = NodeKind.Array;\n\n\tprotected abstract get childSchema(): ImplicitAllowedTypes;\n\tprotected abstract get allowedTypes(): ReadonlySet<TreeNodeSchema>;\n\n\tpublic abstract override get [typeSchemaSymbol](): TreeNodeSchemaClass<\n\t\tstring,\n\t\tNodeKind.Array\n\t>;\n\n\tpublic constructor(\n\t\tinput?: Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>> | InternalTreeNode,\n\t) {\n\t\tsuper(input ?? []);\n\t}\n\n\t#mapTreesFromFieldData(value: Insertable<T>): FlexibleFieldContent {\n\t\tconst sequenceField = getSequenceField(this);\n\t\tconst content = value as readonly (\n\t\t\t| InsertableContent\n\t\t\t| IterableTreeArrayContent<InsertableContent>\n\t\t)[];\n\n\t\tconst contentArray = content.flatMap((c): InsertableContent[] =>\n\t\t\tc instanceof IterableTreeArrayContent ? [...c] : [c],\n\t\t);\n\n\t\tconst kernel = getKernel(this);\n\t\tconst flexContext = kernel.getInnerNode().context;\n\t\tassert(\n\t\t\tflexContext === kernel.context.flexContext,\n\t\t\t0xc14 /* Expected flexContext to match */,\n\t\t);\n\t\tconst innerSchema = kernel.context.flexContext.schema.nodeSchema.get(\n\t\t\tbrand(kernel.schema.identifier),\n\t\t);\n\t\tassert(\n\t\t\tinnerSchema instanceof ObjectNodeStoredSchema,\n\t\t\t0xc15 /* Expected ObjectNodeStoredSchema */,\n\t\t);\n\t\tconst fieldSchema = innerSchema.getFieldSchema(EmptyKey);\n\n\t\tconst mapTrees = prepareArrayContentForInsertion(\n\t\t\tcontentArray,\n\t\t\tthis.childSchema,\n\t\t\tsequenceField.context,\n\t\t\tfieldSchema.types,\n\t\t);\n\n\t\treturn mapTrees;\n\t}\n\n\tpublic toJSON(): unknown {\n\t\t// This override causes the class instance to `JSON.stringify` as `[a, b]` rather than `{0: a, 1: b}`.\n\t\treturn [...(this as unknown as TreeArrayNode)];\n\t}\n\n\t// Instances of this class are used as the dispatch object for the proxy,\n\t// and thus its set of keys is used to implement `has` (for the `in` operator) for the non-numeric cases.\n\t// Therefore it must include `length`,\n\t// even though this \"length\" is never invoked (due to being shadowed by the proxy provided own property).\n\tpublic get length(): number {\n\t\treturn fail(0xadb /* Proxy should intercept length */);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\treturn this.values();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic get [Symbol.unscopables]() {\n\t\t// This might not be the exact right set of values, but it only matters for `with` clauses which are deprecated and are banned in strict mode, so it shouldn't matter much.\n\t\t// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with for details.\n\t\treturn Array.prototype[Symbol.unscopables];\n\t}\n\n\tpublic at(\n\t\tthis: TreeArrayNode<T>,\n\t\tindex: number,\n\t): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst field = getSequenceField(this);\n\t\tconst val = field.boxedAt(index);\n\n\t\tif (val === undefined) {\n\t\t\treturn val;\n\t\t}\n\n\t\treturn getOrCreateNodeFromInnerNode(val) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic findLast<S extends TreeNodeFromImplicitAllowedTypes<T>>(\n\t\tpredicate: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tindex: number,\n\t\t\tarray: readonly TreeNodeFromImplicitAllowedTypes<T>[],\n\t\t) => value is S,\n\t\tthisArg?: unknown,\n\t): S | undefined;\n\tpublic findLast(\n\t\tpredicate: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tindex: number,\n\t\t\tarray: readonly TreeNodeFromImplicitAllowedTypes<T>[],\n\t\t) => unknown,\n\t\tthisArg?: unknown,\n\t): TreeNodeFromImplicitAllowedTypes<T> | undefined;\n\tpublic findLast(\n\t\tpredicate: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tindex: number,\n\t\t\tarray: readonly TreeNodeFromImplicitAllowedTypes<T>[],\n\t\t) => unknown,\n\t\tthisArg?: unknown,\n\t): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst array = this as readonly TreeNodeFromImplicitAllowedTypes<T>[];\n\t\tfor (let index = this.length - 1; index >= 0; index--) {\n\t\t\tconst value = this.at(index) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tconst matched = Boolean(predicate.call(thisArg, value, index, array));\n\t\t\tif (matched) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\tpublic findLastIndex(\n\t\tpredicate: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tindex: number,\n\t\t\tarray: readonly TreeNodeFromImplicitAllowedTypes<T>[],\n\t\t) => unknown,\n\t\tthisArg?: unknown,\n\t): number {\n\t\tconst array = this as readonly TreeNodeFromImplicitAllowedTypes<T>[];\n\t\tfor (let index = this.length - 1; index >= 0; index--) {\n\t\t\tconst value = this.at(index) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tconst matched = Boolean(predicate.call(thisArg, value, index, array));\n\t\t\tif (matched) {\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\tpublic insertAt(index: number, ...value: Insertable<T>): void {\n\t\tconst field = getSequenceField(this);\n\t\tvalidateIndex(index, field, \"TreeArrayNode.insertAt\", true);\n\t\tconst content = this.#mapTreesFromFieldData(value);\n\t\tfield.editor.insert(index, content);\n\t}\n\tpublic insertAtStart(...value: Insertable<T>): void {\n\t\tthis.insertAt(0, ...value);\n\t}\n\tpublic insertAtEnd(...value: Insertable<T>): void {\n\t\tthis.insertAt(this.length, ...value);\n\t}\n\tpublic push(...value: Insertable<T>): void {\n\t\tthis.insertAt(this.length, ...value);\n\t}\n\tpublic unshift(...value: Insertable<T>): void {\n\t\tthis.insertAt(0, ...value);\n\t}\n\tpublic pop(): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst value = this.at(-1);\n\t\tif (value !== undefined) {\n\t\t\tthis.removeAt(this.length - 1);\n\t\t}\n\t\treturn value;\n\t}\n\tpublic shift(): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst value = this.at(0);\n\t\tif (value !== undefined) {\n\t\t\tthis.removeAt(0);\n\t\t}\n\t\treturn value;\n\t}\n\tpublic removeAt(index: number): void {\n\t\tconst field = getSequenceField(this);\n\t\tvalidateIndex(index, field, \"TreeArrayNode.removeAt\");\n\t\tfield.editor.remove(index, 1);\n\t}\n\tpublic removeRange(start?: number, end?: number): void {\n\t\tconst field = getSequenceField(this);\n\t\tconst { length, editor } = field;\n\t\tconst removeStart = start ?? 0;\n\t\tvalidateIndex(removeStart, field, \"TreeArrayNode.removeRange\", true);\n\n\t\tconst removeEnd = Math.min(length, end ?? length);\n\t\tvalidateIndexRange(removeStart, removeEnd, field, \"TreeArrayNode.removeRange\");\n\n\t\teditor.remove(removeStart, removeEnd - removeStart);\n\t}\n\tpublic splice(\n\t\tstart: number,\n\t\tdeleteCount?: number,\n\t\t...items: Insertable<T>\n\t): TreeNodeFromImplicitAllowedTypes<T>[] {\n\t\tconst length = this.length;\n\t\tconst actualStart = start < 0 ? Math.max(length + start, 0) : Math.min(start, length);\n\t\tconst actualDeleteCount =\n\t\t\tdeleteCount === undefined\n\t\t\t\t? length - actualStart\n\t\t\t\t: Math.min(Math.max(deleteCount, 0), length - actualStart);\n\t\tvalidateIndexRange(\n\t\t\tactualStart,\n\t\t\tactualStart + actualDeleteCount,\n\t\t\tgetSequenceField(this),\n\t\t\t\"TreeArrayNode.splice\",\n\t\t);\n\t\tconst removed: TreeNodeFromImplicitAllowedTypes<T>[] = [];\n\t\tfor (let index = actualStart; index < actualStart + actualDeleteCount; index++) {\n\t\t\tremoved.push(this.at(index) ?? oob());\n\t\t}\n\n\t\tconst innerNode = getInnerNode(this);\n\t\tconst transaction = innerNode.isHydrated()\n\t\t\t? innerNode.context.checkout.transaction\n\t\t\t: undefined;\n\t\ttransaction?.start();\n\t\tthis.removeRange(actualStart, actualStart + actualDeleteCount);\n\t\tif (items.length > 0) {\n\t\t\tthis.insertAt(actualStart, ...items);\n\t\t}\n\t\ttransaction?.commit();\n\t\treturn removed;\n\t}\n\n\tpublic moveToStart(sourceIndex: number, source?: ReadonlyArrayNode): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tvalidateIndex(sourceIndex, sourceField, \"TreeArrayNode.moveToStart\");\n\t\tthis.moveRangeToIndex(0, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveToEnd(sourceIndex: number, source?: ReadonlyArrayNode): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tvalidateIndex(sourceIndex, sourceField, \"TreeArrayNode.moveToEnd\");\n\t\tthis.moveRangeToIndex(this.length, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveToIndex(\n\t\tdestinationGap: number,\n\t\tsourceIndex: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tconst destinationField = getSequenceField(this);\n\t\tvalidateIndex(destinationGap, destinationField, \"TreeArrayNode.moveToIndex\", true);\n\t\tvalidateIndex(sourceIndex, sourceField, \"TreeArrayNode.moveToIndex\");\n\t\tthis.moveRangeToIndex(destinationGap, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveRangeToStart(\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? getSequenceField(this),\n\t\t\t\"TreeArrayNode.moveRangeToStart\",\n\t\t);\n\t\tthis.moveRangeToIndex(0, sourceStart, sourceEnd, source);\n\t}\n\tpublic moveRangeToEnd(\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? getSequenceField(this),\n\t\t\t\"TreeArrayNode.moveRangeToEnd\",\n\t\t);\n\t\tthis.moveRangeToIndex(this.length, sourceStart, sourceEnd, source);\n\t}\n\tpublic moveRangeToIndex(\n\t\tdestinationGap: number,\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tconst destinationField = getSequenceField(this);\n\t\tconst destinationSchema = this.allowedTypes;\n\t\tconst kernel = getKernel(this);\n\t\tconst destinationStored = (\n\t\t\tkernel.context.flexContext.schema.nodeSchema.get(brand(kernel.schema.identifier)) ??\n\t\t\tfail(0xc16 /* missing schema for array node */)\n\t\t).getFieldSchema(EmptyKey).types;\n\t\tconst sourceField = source === undefined ? destinationField : getSequenceField(source);\n\n\t\tvalidateIndex(destinationGap, destinationField, \"TreeArrayNode.moveRangeToIndex\", true);\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? destinationField,\n\t\t\t\"TreeArrayNode.moveRangeToIndex\",\n\t\t);\n\n\t\t// TODO: determine support for move across different sequence types\n\t\tif (sourceField !== destinationField) {\n\t\t\tfor (let i = sourceStart; i < sourceEnd; i++) {\n\t\t\t\tconst sourceNode = sourceField.boxedAt(i) ?? oob();\n\t\t\t\tconst sourceSchema = getSimpleNodeSchemaFromInnerNode(sourceNode);\n\t\t\t\tif (!destinationSchema.has(sourceSchema)) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Type ${sourceNode.type} in source sequence is not allowed in destination.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (!destinationStored.has(sourceNode.type)) {\n\t\t\t\t\t// TODO: better and centralized messages for missing staged schema updates.\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Type ${sourceNode.type} in source sequence is not allowed in destination's stored schema: this would likely require upgrading the document to permit a staged schema.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst movedCount = sourceEnd - sourceStart;\n\t\tif (destinationField.context.isHydrated()) {\n\t\t\tif (!sourceField.context.isHydrated()) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from an unhydrated array to a hydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (sourceField.context !== destinationField.context) {\n\t\t\t\tthrow new UsageError(\"Cannot move elements between two different TreeViews.\");\n\t\t\t}\n\n\t\t\tdestinationField.context.checkout.editor.move(\n\t\t\t\tsourceField.getFieldPath(),\n\t\t\t\tsourceStart,\n\t\t\t\tmovedCount,\n\t\t\t\tdestinationField.getFieldPath(),\n\t\t\t\tdestinationGap,\n\t\t\t);\n\t\t} else {\n\t\t\tif (!(sourceField instanceof UnhydratedSequenceField)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from a hydrated array to an unhydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (sourceField.context.isHydrated()) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from an unhydrated array to a hydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tassert(\n\t\t\t\tdestinationField instanceof UnhydratedSequenceField,\n\t\t\t\t0xcd5 /* destinationField should be unhydrated since we're in the else branch of isHydrated() check */,\n\t\t\t);\n\n\t\t\t// Use native move which handles the operation atomically for within-field moves\n\t\t\t// to ensure only a single event is emitted per affected field.\n\t\t\tdestinationField.editor.move(\n\t\t\t\tsourceStart,\n\t\t\t\tmovedCount,\n\t\t\t\tdestinationGap,\n\t\t\t\tsourceField === destinationField ? undefined : sourceField,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\treturn this.generateValues(getKernel(this).generationNumber);\n\t}\n\tprivate *generateValues(\n\t\tinitialLastUpdatedStamp: number,\n\t): Generator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tconst kernel = getKernel(this);\n\t\tif (initialLastUpdatedStamp !== kernel.generationNumber) {\n\t\t\tthrow new UsageError(`Concurrent editing and iteration is not allowed.`);\n\t\t}\n\t\tfor (let i = 0; i < this.length; i++) {\n\t\t\tyield this.at(i) ?? fail(0xadc /* Index is out of bounds */);\n\t\t\tif (initialLastUpdatedStamp !== kernel.generationNumber) {\n\t\t\t\tthrow new UsageError(`Concurrent editing and iteration is not allowed.`);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param name - Unique identifier for this schema including the factory's scope.\n * @param persistedMetadata - Optional persisted metadata for the object node schema.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function arraySchema<\n\tTName extends string,\n\tconst T extends ImplicitAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tcustomizable: boolean,\n\tnodeOptions: NodeSchemaOptionsAlpha<TCustomMetadata>,\n) {\n\ttype Output = ArrayNodeCustomizableSchema<\n\t\tTName,\n\t\tT,\n\t\tImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tArrayNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &\n\t\tTreeNodeSchemaCorePrivate;\n\n\tconst persistedMetadata = nodeOptions?.persistedMetadata;\n\tconst normalizedTypes = normalizeAllowedTypes(info);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)),\n\t);\n\tconst lazySimpleAllowedTypes = new Lazy(() => {\n\t\treturn AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);\n\t});\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\n\t// This class returns a proxy from its constructor to handle numeric indexing.\n\t// Alternatively it could extend a normal class which gets tons of numeric properties added.\n\tclass Schema extends CustomArrayNodeBase<T> {\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tconst proxyTarget = customizable ? instance : [];\n\n\t\t\tif (customizable) {\n\t\t\t\t// Since proxy reports this as a \"non-configurable\" property, it must exist on the underlying object used as the proxy target, not as an inherited property.\n\t\t\t\t// This should not get used as the proxy should intercept all use.\n\t\t\t\tObject.defineProperty(instance, \"length\", {\n\t\t\t\t\tvalue: Number.NaN,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn createArrayNodeProxy(customizable, proxyTarget, instance) as unknown as Schema;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as object, this as typeof Schema);\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tpublic static get simpleAllowedTypes(): ReadonlyMap<\n\t\t\tstring,\n\t\t\tSimpleAllowedTypeAttributes<SchemaType.View>\n\t\t> {\n\t\t\treturn lazySimpleAllowedTypes.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== Schema.prototype) {\n\t\t\t\t\t// Search prototype keys and check for positive integers. Throw if any are found.\n\t\t\t\t\t// Shadowing of index properties on array nodes is not supported.\n\t\t\t\t\tfor (const key of Object.getOwnPropertyNames(prototype)) {\n\t\t\t\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\t\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited index property \"${key.toString()}\" which shadows a possible array index. Shadowing of array indices is not permitted.`,\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// Since this stops at the array node base schema, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that the array base schema is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst schema = this as ArrayNodeSchema;\n\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest: (data: FactoryContent): CompatibilityLevel =>\n\t\t\t\t\tshallowCompatibilityTest(data, schema),\n\t\t\t\ttoFlexContent: (\n\t\t\t\t\tdata: FactoryContent,\n\t\t\t\t\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\t\t\t\t): FlexContent => arrayToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> =\n\t\t\tnodeOptions.metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import-x/no-deprecated\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as Output;\n\t\t}\n\n\t\tprotected get childSchema(): T {\n\t\t\treturn info;\n\t\t}\n\t\tprotected get allowedTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [normalizedTypes]));\n\t\t}\n\t}\n\n\tconst output: Output = Schema;\n\treturn output;\n}\n\n/**\n * Transforms data for a child of an array.\n * @param child - The tree data to be transformed.\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n */\nfunction arrayChildToFlexTree(\n\tchild: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): UnhydratedFlexTreeNode {\n\t// We do not support undefined sequence entries.\n\t// If we encounter an undefined entry, use null instead if supported by the schema, otherwise throw.\n\tlet childWithFallback = child;\n\tif (child === undefined) {\n\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\tchildWithFallback = null;\n\t\t} else {\n\t\t\tthrow new TypeError(`Received unsupported array entry value: ${child}.`);\n\t\t}\n\t}\n\treturn unhydratedFlexTreeFromInsertableNode(childWithFallback, allowedTypes);\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Array nodes.\n *\n * @param data - The tree data to be transformed. Must be an iterable.\n * @param schema - The schema to comply with.\n */\nfunction arrayToFlexContent(data: FactoryContent, schema: ArrayNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null && Symbol.iterator in data)) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\tthrow new UsageError(`Input data is incompatible with Array schema: ${data}`);\n\t}\n\n\tconst allowedChildTypes = normalizeAllowedTypes(schema.info);\n\n\tconst mappedData = Array.from(data, (child) =>\n\t\tarrayChildToFlexTree(child, allowedChildTypes.evaluateSet()),\n\t);\n\n\tconst context = getUnhydratedContext(schema).flexContext;\n\n\t// Array nodes have a single `EmptyKey` field:\n\tconst fieldsEntries =\n\t\tmappedData.length === 0\n\t\t\t? []\n\t\t\t: ([\n\t\t\t\t\t[\n\t\t\t\t\t\tEmptyKey,\n\t\t\t\t\t\tnew UnhydratedSequenceField(\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tFieldKinds.sequence.identifier,\n\t\t\t\t\t\t\tEmptyKey,\n\t\t\t\t\t\t\tmappedData,\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t] as const);\n\n\treturn [\n\t\t{\n\t\t\ttype: brand(schema.identifier),\n\t\t},\n\t\tnew Map(fieldsEntries),\n\t];\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Array nodes.\n */\nfunction shallowCompatibilityTest(\n\tdata: FactoryContent,\n\tschema: ArrayNodeSchema,\n): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (data instanceof Map) {\n\t\t// Maps are iterable, so type checking does allow constructing an ArrayNode from a map if the ArrayNode's type is an array that includes the key and value types of the map.\n\t\treturn CompatibilityLevel.Low;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.Normal;\n\t}\n\n\treturn CompatibilityLevel.None;\n}\n\n/**\n * A location in a {@link (TreeArrayNode:interface)}.\n * @remarks\n * Tracks a location even as the array is mutated.\n * How this is adjusted for edits depends on the specific anchor being used.\n * See {@link createArrayInsertionAnchor} for one way to create such an anchor.\n * @privateRemarks\n * This being sealed is not important for its current behaviors as nothing downcasts this,\n * however it is possible we might want to add additional members in the future:\n * sealing this ensures that such additions are a non-breaking change.\n * Things we might want to add include status (for example if its deleted) or events (for example to notify when its index changes).\n * Some specific anchors might even want to add additional method members for things like confidence\n * (so we can indicate when the anchor goes from being truly robust to a heuristic guess due to an edit).\n * @alpha\n * @sealed\n */\nexport interface ArrayPlaceAnchor {\n\t/**\n\t * The current index within the array that this anchor refers to.\n\t * @remarks\n\t * This value is updated as the array is edited in a way that depends on the specific anchor implementation.\n\t * This index may take on a value from 0 to the length of the array (inclusive).\n\t * If used as the index to insert content into the array, this means it can point to any location in the array,\n\t * including just after the last child.\n\t */\n\tget index(): number;\n}\n\n/**\n * Create an {@link ArrayPlaceAnchor} tracking an insertion point in the array which is currently at the provided index.\n *\n * @param node - The array node to anchor into.\n * @param currentIndex - The current index of the place to track.\n * @remarks\n * This anchor will track the logical position in the array across changes.\n * As long as the subsection of the array surrounding the anchor point is not edited,\n * this anchor will move with them, keeping its relative position to those children fixed.\n * How exactly it behaves when the adjacent portion of the array is modified is subject to change,\n * but this will always report a valid index to insert content at (which can be the index after the last item in the array).\n *\n * This is intended to track a location that might be used for an insertion point (for example in a text editor): future changes to its details should\n * make it behave better for such uses.\n *\n * The current implementation is known to behave particularly poorly if the child which was at the original anchor point's index is removed\n * (jumps to the end of the array): this behavior is subject to change.\n * @privateRemarks\n * When stabilized, this should probably become a method on {@link (TreeArrayNode:interface)}.\n * Future versions of this should use rebaser / changeset logic to do a better job of tracking a location across removals or reinsertion.\n * How this would work, especially for unhydrated nodes is not yet clear.\n * @alpha\n */\nexport function createArrayInsertionAnchor(\n\tnode: TreeArrayNode,\n\tcurrentIndex: number,\n): ArrayPlaceAnchor {\n\tconst field = getInnerNode(node).getBoxed(EmptyKey);\n\tconst child = field.boxedAt(currentIndex);\n\treturn {\n\t\tget index() {\n\t\t\tif (child === undefined) {\n\t\t\t\treturn field.length;\n\t\t\t}\n\t\t\tif (child.parentField.parent !== field) {\n\t\t\t\treturn field.length;\n\t\t\t}\n\t\t\treturn child.parentField.index;\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"arrayNode.js","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/array/arrayNode.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,kEAAqF;AACrF,uEAAsE;AAEtE,qDAA0F;AAM1F,kEAA8E;AAC9E,qDAKgC;AAEhC,kDAiC6B;AAC7B,6DAGgC;AAChC,+DAAqD;AACrD,yEAA+E;AAE/E,mGAKmD;AA4gBnD;;;GAGG;AACU,QAAA,aAAa,GAAG;IAC5B;;;;;;;;;OASG;IACH,MAAM,EAAE,CAAI,OAAoB,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;CAC3C,CAAC;AAEX;;;GAGG;AACH,IAAI,MAAgE,CAAC;AAErE;;;;GAIG;AACH,MAAa,wBAAwB;IAKpC,YAAqC,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAE7D;;OAEG;IACI,CAAC,MAAM,CAAC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IACF,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Lazy, oob, fail, assert, clamp } from \"@fluidframework/core-utils/internal\";\nimport { UsageError } from \"@fluidframework/telemetry-utils/internal\";\n\nimport { EmptyKey, ObjectNodeStoredSchema, type DeltaMark } from \"../../../core/index.js\";\nimport type {\n\tFlexibleFieldContent,\n\tFlexTreeNode,\n\tFlexTreeSequenceField,\n} from \"../../../feature-libraries/index.js\";\nimport { FieldKinds, isTreeValue } from \"../../../feature-libraries/index.js\";\nimport {\n\tbrand,\n\tvalidateIndex,\n\tvalidateIndexRange,\n\ttype JsonCompatibleReadOnlyObject,\n} from \"../../../util/index.js\";\nimport type { NodeSchemaOptionsAlpha, System_Unsafe } from \"../../api/index.js\";\nimport {\n\tCompatibilityLevel,\n\ttype WithType,\n\t// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.\n\ttypeNameSymbol,\n\tNodeKind,\n\ttype TreeNode,\n\ttype InternalTreeNode,\n\ttype TreeNodeSchema,\n\ttypeSchemaSymbol,\n\tgetOrCreateNodeFromInnerNode,\n\tgetSimpleNodeSchemaFromInnerNode,\n\tgetInnerNode,\n\ttype TreeNodeSchemaClass,\n\tgetKernel,\n\ttype UnhydratedFlexTreeNode,\n\tUnhydratedSequenceField,\n\tgetOrCreateNodeFromInnerUnboxedNode,\n\tnormalizeAllowedTypes,\n\ttype ImplicitAllowedTypes,\n\ttype InsertableTreeNodeFromImplicitAllowedTypes,\n\ttype NodeSchemaMetadata,\n\ttype TreeLeafValue,\n\ttype TreeNodeFromImplicitAllowedTypes,\n\tTreeNodeValid,\n\ttype MostDerivedData,\n\ttype TreeNodeSchemaInitializedData,\n\ttype TreeNodeSchemaCorePrivate,\n\tprivateDataSymbol,\n\tcreateTreeNodeSchemaPrivateData,\n\ttype FlexContent,\n\ttype TreeNodeSchemaPrivateData,\n\tAnnotatedAllowedTypesInternal,\n} from \"../../core/index.js\";\nimport {\n\tgetTreeNodeSchemaInitializedData,\n\tgetUnhydratedContext,\n} from \"../../createContext.js\";\nimport { nullSchema } from \"../../leafNodeSchema.js\";\nimport { prepareArrayContentForInsertion } from \"../../prepareForInsertion.js\";\nimport type { SchemaType, SimpleAllowedTypeAttributes } from \"../../simpleSchema.js\";\nimport {\n\ttype FactoryContent,\n\ttype InsertableContent,\n\tunhydratedFlexTreeFromInsertable,\n\tunhydratedFlexTreeFromInsertableNode,\n} from \"../../unhydratedFlexTreeFromInsertable.js\";\n\nimport type {\n\tArrayNodeCustomizableSchema,\n\tArrayNodePojoEmulationSchema,\n\tArrayNodeSchema,\n} from \"./arrayNodeTypes.js\";\n\n/**\n * A covariant base type for {@link (TreeArrayNode:interface)}.\n *\n * This provides the readonly subset of TreeArrayNode functionality, and is used as the source interface for moves since that needs to be covariant.\n * @privateRemarks\n * Ideally this would just include `TreeNode, WithType<string, NodeKind.Array>` in the extends list but https://github.com/microsoft/TypeScript/issues/16936 prevents that from compiling.\n * As a workaround around for this TypeScript limitation, the conflicting type intersection is wrapped in `Awaited` (which has no effect on the type in this case) which allows it to compile.\n * @system @sealed @public\n */\nexport interface ReadonlyArrayNode<out T = TreeNode | TreeLeafValue>\n\textends ReadonlyArray<T>,\n\t\tAwaited<TreeNode & WithType<string, NodeKind.Array>> {}\n\n/**\n * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.\n *\n * @typeParam TAllowedTypes - Schema for types which are allowed as members of this array.\n * @typeParam T - Use Default: Do not specify. Type of values to read from the array.\n * @typeParam TNew - Use Default: Do not specify. Type of values to write into the array.\n * @typeParam TMoveFrom - Use Default: Do not specify. Type of node from which children can be moved into this array.\n *\n * @sealed @public\n */\nexport interface TreeArrayNode<\n\tTAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes,\n\tout T = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? TreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TNew = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TMoveFrom = ReadonlyArrayNode,\n> extends ReadonlyArrayNode<T> {\n\t/**\n\t * Inserts new item(s) at a specified location.\n\t *\n\t * @remarks\n\t * All items inserted by a single call to this method are inserted consecutively.\n\t * The order of the inserted items relative to other concurrently inserted items at the same location is only partially specified:\n\t * Concurrently inserting `[A, B]` and `[X, Y]` at the same location may yield\n\t * either `[A, B, X, Y]` or `[X, Y, A, B]`, regardless of the order in which those edits are sequenced.\n\t * No other interleavings are possible. (e.g. `[A, X, B, Y]` is not possible.)\n\t *\n\t * @param index - The index at which to insert `value`.\n\t * @param value - The content to insert.\n\t * @throws Throws if `index` is not in the range [0, `array.length`).\n\t */\n\tinsertAt(index: number, ...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the start of the array.\n\t * @remarks\n\t * Equivalent to `insertAt(0, ...value)`:\n\t * see {@link (TreeArrayNode:interface).insertAt} for details, including merge semantics with concurrent edits.\n\t * @param value - The content to insert.\n\t */\n\tinsertAtStart(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the end of the array.\n\t * @remarks\n\t * Equivalent to `insertAt(array.length, ...value)`:\n\t * see {@link (TreeArrayNode:interface).insertAt} for details, including merge semantics with concurrent edits.\n\t * @param value - The content to insert.\n\t */\n\tinsertAtEnd(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Inserts new item(s) at the end of the array.\n\t *\n\t * @remarks\n\t * Unlike `Array.prototype.push`, this method does not return the new length of the array.\n\t *\n\t * Equivalent to `insertAt(array.length, ...value)`:\n\t * see {@link (TreeArrayNode:interface).insertAt} for details, including merge semantics with concurrent edits.\n\t *\n\t * @param value - The content to insert.\n\t */\n\tpush(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Removes the item at the specified location.\n\t * @param index - The index at which to remove the item.\n\t * @throws Throws if `index` is not in the range [0, `array.length`).\n\t * @remarks\n\t * The item to remove is determined when this method is called, not when the resulting edit is sequenced.\n\t * This means that, once the edit is sequenced, the item being removed may no longer be at `index`,\n\t * and may in fact no longer be in this array at all (for example, if a concurrent edit moved it to another array).\n\t * This operation removes that item from wherever it then resides.\n\t */\n\tremoveAt(index: number): void;\n\n\t/**\n\t * Removes all items between the specified indices.\n\t * @param start - The starting index of the range to remove (inclusive). Defaults to the start of the array.\n\t * @param end - The ending index of the range to remove (exclusive). Defaults to `array.length`.\n\t * @throws Throws if `start` is not in the range [0, `array.length`].\n\t * @throws Throws if `end` is less than `start`.\n\t * If `end` is not supplied or is greater than the length of the array, all items after `start` are removed.\n\t *\n\t * @remarks\n\t * The default values for start and end are computed when this is called,\n\t * and thus the behavior is the same as providing them explicitly, even with respect to merge resolution with concurrent edits.\n\t * For example, two concurrent transactions both emptying the array with `node.removeRange()` then inserting an item,\n\t * will merge to result in the array having both inserted items.\n\t */\n\tremoveRange(start?: number, end?: number): void;\n\n\t/**\n\t * Moves the specified item to the start of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToStart(sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the start of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToStart(sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified item to the end of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToEnd(sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the end of the array.\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if `sourceIndex` is not in the range [0, `array.length`).\n\t */\n\tmoveToEnd(sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified item to the desired location in the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceIndex - The index of the item to move.\n\t * @throws Throws if any of the input indices are not in the range [0, `array.length`).\n\t */\n\tmoveToIndex(destinationGap: number, sourceIndex: number): void;\n\n\t/**\n\t * Moves the specified item to the desired location in the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceIndex - The index of the item to move.\n\t * @param source - The source array to move the item out of.\n\t * @throws Throws if any of the source index is not in the range [0, `array.length`),\n\t * or if the index is not in the range [0, `array.length`].\n\t */\n\tmoveToIndex(destinationGap: number, sourceIndex: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the start of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToStart(sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the start of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToStart(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the end of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToEnd(sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the end of the array.\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if either of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToEnd(sourceStart: number, sourceEnd: number, source: TMoveFrom): void;\n\n\t/**\n\t * Moves the specified items to the desired location within the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @throws Throws if any of the input indices are not in the range [0, `array.length`) or if `sourceStart` is greater than `sourceEnd`.\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToIndex(destinationGap: number, sourceStart: number, sourceEnd: number): void;\n\n\t/**\n\t * Moves the specified items to the desired location within the array.\n\t *\n\t * WARNING - This API is easily misused.\n\t * Please read the documentation for the `destinationGap` parameter carefully.\n\t *\n\t * @param destinationGap - The location *between* existing items that the moved item should be moved to.\n\t *\n\t * WARNING - `destinationGap` describes a location between existing items *prior to applying the move operation*.\n\t *\n\t * For example, if the array contains items `[A, B, C]` before the move, the `destinationGap` must be one of the following:\n\t *\n\t * - `0` (between the start of the array and `A`'s original position)\n\t *\n\t * - `1` (between `A`'s original position and `B`'s original position)\n\t *\n\t * - `2` (between `B`'s original position and `C`'s original position)\n\t *\n\t * - `3` (between `C`'s original position and the end of the array)\n\t *\n\t * So moving `A` between `B` and `C` would require `destinationGap` to be `2`.\n\t *\n\t * This interpretation of `destinationGap` makes it easy to specify the desired destination relative to a sibling item that is not being moved,\n\t * or relative to the start or end of the array:\n\t *\n\t * - Move to the start of the array: `array.moveToIndex(0, ...)` (see also `moveToStart`)\n\t *\n\t * - Move to before some item X: `array.moveToIndex(indexOfX, ...)`\n\t *\n\t * - Move to after some item X: `array.moveToIndex(indexOfX + 1`, ...)\n\t *\n\t * - Move to the end of the array: `array.moveToIndex(array.length, ...)` (see also `moveToEnd`)\n\t *\n\t * This interpretation of `destinationGap` does however make it less obvious how to move an item relative to its current position:\n\t *\n\t * - Move item B before its predecessor: `array.moveToIndex(indexOfB - 1, ...)`\n\t *\n\t * - Move item B after its successor: `array.moveToIndex(indexOfB + 2, ...)`\n\t *\n\t * Notice the asymmetry between `-1` and `+2` in the above examples.\n\t * In such scenarios, it can often be easier to approach such edits by swapping adjacent items:\n\t * If items A and B are adjacent, such that A precedes B,\n\t * then they can be swapped with `array.moveToIndex(indexOfA, indexOfB)`.\n\t *\n\t * @param sourceStart - The starting index of the range to move (inclusive).\n\t * @param sourceEnd - The ending index of the range to move (exclusive)\n\t * @param source - The source array to move items out of.\n\t * @throws Throws if the types of any of the items being moved are not allowed in the destination array,\n\t * if any of the input indices are not in the range [0, `array.length`], or if `sourceStart` is greater than `sourceEnd`.\n\t */\n\tmoveRangeToIndex(\n\t\tdestinationGap: number,\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource: TMoveFrom,\n\t): void;\n\n\t/**\n\t * Returns a custom IterableIterator which throws usage errors if concurrent editing and iteration occurs.\n\t */\n\tvalues(): IterableIterator<T>;\n}\n\n/**\n * {@link (TreeArrayNode:interface)} with additional alpha APIs.\n * @alpha @sealed\n */\nexport interface TreeArrayNodeAlpha<\n\tTAllowedTypes extends System_Unsafe.ImplicitAllowedTypesUnsafe = ImplicitAllowedTypes,\n\tout T = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? TreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: TreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n\tin TNew = [TAllowedTypes] extends [ImplicitAllowedTypes]\n\t\t? InsertableTreeNodeFromImplicitAllowedTypes<TAllowedTypes>\n\t\t: InsertableTreeNodeFromImplicitAllowedTypes<ImplicitAllowedTypes>,\n> extends TreeArrayNode<TAllowedTypes, T, TNew> {\n\t/**\n\t * Returns the item located at the specified index.\n\t * @param index - The zero-based index of the item to retrieve.\n\t * Negative indices count back from the last item in the array: for `index < 0`, `index + array.length` is used.\n\t * @returns The item at the specified index, or `undefined` if the index is out of bounds.\n\t */\n\tat(index: number): T | undefined;\n\n\t/**\n\t * Returns the last item in the array for which the given type guard returns `true`,\n\t * searching from the last item to the first.\n\t * @remarks\n\t * The array's length is captured when the search begins; items are read live as the search progresses.\n\t * If `predicate` edits the array, behavior matches {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast | Array.prototype.findLast}.\n\t * @typeParam S - The subtype of `T` asserted by the `predicate` type guard.\n\t * @param predicate - Evaluated once per item, starting from the last item and moving towards the first, until it returns `true`.\n\t * Receives the item, its index, and the array being searched.\n\t * @param thisArg - If provided, used as `this` when invoking `predicate`.\n\t * @returns The last item for which `predicate` returns `true` (narrowed to the guarded type), or `undefined` if there is no such item.\n\t */\n\tfindLast<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: unknown,\n\t): S | undefined;\n\n\t/**\n\t * Returns the last item in the array for which the given predicate returns a truthy value,\n\t * searching from the last item to the first.\n\t * @remarks\n\t * The array's length is captured when the search begins; items are read live as the search progresses.\n\t * If `predicate` edits the array, behavior matches {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast | Array.prototype.findLast}.\n\t * @param predicate - Evaluated once per item, starting from the last item and moving towards the first, until it returns a truthy value.\n\t * Receives the item, its index, and the array being searched.\n\t * @param thisArg - If provided, used as `this` when invoking `predicate`.\n\t * @returns The last item for which `predicate` returns a truthy value, or `undefined` if there is no such item.\n\t */\n\tfindLast(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: unknown,\n\t): T | undefined;\n\n\t/**\n\t * Returns the index of the last item in the array for which the given predicate returns a truthy value,\n\t * searching from the last item to the first.\n\t * @remarks\n\t * The array's length is captured when the search begins; items are read live as the search progresses.\n\t * If `predicate` edits the array, behavior matches {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex | Array.prototype.findLastIndex}.\n\t * @param predicate - Evaluated once per item, starting from the last item and moving towards the first, until it returns a truthy value.\n\t * Receives the item, its index, and the array being searched.\n\t * @param thisArg - If provided, used as `this` when invoking `predicate`.\n\t * @returns The index of the last item for which `predicate` returns a truthy value, or `-1` if there is no such item.\n\t */\n\tfindLastIndex(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: unknown,\n\t): number;\n\n\t/**\n\t * Removes the last item from the array and returns it.\n\t * @returns The removed item, or `undefined` if the array is empty (in which case the array is not modified).\n\t * @remarks\n\t * Equivalent to `removeAt(array.length - 1)`, additionally returning the removed item:\n\t * see {@link (TreeArrayNode:interface).removeAt} for details, including merge semantics with concurrent edits.\n\t * In particular, the item removed is the one that is last at the time this method is called,\n\t * not the one that is last at the time the resulting edit is sequenced.\n\t */\n\tpop(): T | undefined;\n\n\t/**\n\t * Removes the first item from the array and returns it.\n\t * @returns The removed item, or `undefined` if the array is empty (in which case the array is not modified).\n\t * @remarks\n\t * Equivalent to `removeAt(0)`, additionally returning the removed item:\n\t * see {@link (TreeArrayNode:interface).removeAt} for details, including merge semantics with concurrent edits.\n\t * In particular, the item removed is the one that is first at the time this method is called,\n\t * not the one that is first at the time the resulting edit is sequenced.\n\t */\n\tshift(): T | undefined;\n\n\t/**\n\t * Inserts new item(s) at the start of the array.\n\t *\n\t * @param value - The content to insert.\n\t * @remarks\n\t * Unlike `Array.prototype.unshift`, this method does not return the new length of the array.\n\t *\n\t * All items inserted by a single call to this method are inserted consecutively.\n\t * The order of the inserted items relative to other concurrently inserted items is fully specified:\n\t * Concurrently unshifting `[A, B]` and `[X, Y]` will yield `[A, B, X, Y]` if the edit unshifting `[A, B]`\n\t * is sequenced after the edit unshifting `[X, Y]`.\n\t */\n\tunshift(...value: readonly (TNew | IterableTreeArrayContent<TNew>)[]): void;\n\n\t/**\n\t * Removes existing item(s) and/or adds new item(s).\n\t * @param start - The index at which to start changing the array. If negative, it is treated as `array.length + start`.\n\t * Must be a positive in bounds index or a negative index such that `array.length + start` is a positive in bounds index.\n\t * @param deleteCount - The number of item(s) to remove. If not provided, it defaults to the end of the array.\n\t * Must be a non-negative integer no greater than the number of items from `start` to the end of the array.\n\t * @param items - The item(s) to insert at `start`.\n\t * @returns An array containing the item(s) that were removed.\n\t * @remarks\n\t * See {@link (TreeArrayNode:interface).insertAt} for the merge semantics of the inserted items.\n\t */\n\tsplice(\n\t\tstart: number,\n\t\tdeleteCount?: number,\n\t\t...items: readonly (TNew | IterableTreeArrayContent<TNew>)[]\n\t): T[];\n}\n\n/**\n * A {@link TreeNode} which implements 'readonly T[]' and the array mutation APIs.\n * @public\n */\nexport const TreeArrayNode = {\n\t/**\n\t * Wrap an iterable of items to inserted as consecutive items in a array.\n\t * @remarks\n\t * The object returned by this function can be inserted into a {@link (TreeArrayNode:interface)}.\n\t * Its contents will be inserted consecutively in the corresponding location in the array.\n\t * @example\n\t * ```ts\n\t * array.insertAtEnd(TreeArrayNode.spread(iterable))\n\t * ```\n\t */\n\tspread: <T>(content: Iterable<T>) => create(content),\n} as const;\n\n/**\n * Package internal construction API.\n * Use {@link (TreeArrayNode:variable).spread} to create an instance of this type instead.\n */\nlet create: <T>(content: Iterable<T>) => IterableTreeArrayContent<T>;\n\n/**\n * Used to insert iterable content into a {@link (TreeArrayNode:interface)}.\n * Use {@link (TreeArrayNode:variable).spread} to create an instance of this type.\n * @sealed @public\n */\nexport class IterableTreeArrayContent<T> implements Iterable<T> {\n\tstatic {\n\t\tcreate = <T2>(content: Iterable<T2>) => new IterableTreeArrayContent(content);\n\t}\n\n\tprivate constructor(private readonly content: Iterable<T>) {}\n\n\t/**\n\t * Iterates over content for nodes to insert.\n\t */\n\tpublic [Symbol.iterator](): Iterator<T> {\n\t\treturn this.content[Symbol.iterator]();\n\t}\n}\n\n/**\n * Given a array node proxy, returns its underlying LazySequence field.\n */\nfunction getSequenceField(arrayNode: ReadonlyArrayNode): FlexTreeSequenceField {\n\treturn getInnerNode(arrayNode).getBoxed(EmptyKey) as FlexTreeSequenceField;\n}\n\n// For compatibility, we are initially implement 'readonly T[]' by applying the Array.prototype methods\n// to the array node proxy. Over time, we should replace these with efficient implementations on LazySequence\n// to avoid re-entering the proxy as these methods access 'length' and the indexed properties.\n//\n// For brevity, the current implementation dynamically builds a property descriptor map from a list of\n// Array functions we want to re-expose via the proxy.\n\nconst arrayPrototypeKeys = [\n\t\"concat\",\n\t\"entries\",\n\t\"every\",\n\t\"filter\",\n\t\"find\",\n\t\"findIndex\",\n\t\"flat\",\n\t\"flatMap\",\n\t\"forEach\",\n\t\"includes\",\n\t\"indexOf\",\n\t\"join\",\n\t\"keys\",\n\t\"lastIndexOf\",\n\t\"map\",\n\t\"reduce\",\n\t\"reduceRight\",\n\t\"slice\",\n\t\"some\",\n\t\"toLocaleString\",\n\t\"toString\",\n\n\t// \"copyWithin\",\n\t// \"fill\",\n\t// \"length\",\n\t// \"pop\",\n\t// \"push\",\n\t// \"reverse\",\n\t// \"shift\",\n\t// \"sort\",\n\t// \"splice\",\n\t// \"unshift\",\n] as const;\n\n/**\n * {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.\n * @privateRemarks\n * Since a lot of scratch types and values are involved with creating this,\n * it's generating using an immediately invoked function expression (IIFE).\n * This is a common JavaScript pattern for cases like this to avoid cluttering the scope.\n */\nconst TreeNodeWithArrayFeatures = (() => {\n\t/**\n\t * {@link TreeNodeValid}, but modified to add members from Array.prototype named in {@link arrayPrototypeKeys}.\n\t */\n\tabstract class TreeNodeWithArrayFeaturesUntyped<\n\t\tconst T extends ImplicitAllowedTypes,\n\t> extends TreeNodeValid<Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>> {}\n\n\t// Modify TreeNodeWithArrayFeaturesUntyped to add the members from Array.prototype\n\tfor (const key of arrayPrototypeKeys) {\n\t\tObject.defineProperty(TreeNodeWithArrayFeaturesUntyped.prototype, key, {\n\t\t\tvalue: Array.prototype[key],\n\t\t});\n\t}\n\n\treturn TreeNodeWithArrayFeaturesUntyped as unknown as typeof NodeWithArrayFeatures;\n})();\n\n/**\n * Type of {@link TreeNodeValid}, but with array members added to the instance type.\n *\n * TypeScript has a rule that `Base constructors must all have the same return type.ts(2510)`.\n * This means that intersecting two types with different constructors to create a type with a more constrained constructor (ex: more specific return type)\n * is not supported.\n *\n * TypeScript also has a limitation that there is no way to replace or remove just the constructor of a type without losing all the private and protected members.\n * See https://github.com/microsoft/TypeScript/issues/35416 for details.\n *\n * TypeScript also does not support explicitly specifying the instance type in a class definition as the constructor return type.\n *\n * Thus to replace the instance type, while preserving the protected static members of TreeNodeValid,\n * the only option seems to be actually declaring a class with all the members explicitly inline.\n *\n * To avoid incurring any bundle size / runtime overhead from this and having to stub out the function bodies,\n * the class uses `declare`.\n * TypeScript does not support `declare` inside scopes, so this is not inside the function scope above.\n *\n * The members of this class were generated using the \"implement interface\" refactoring.\n * Since that refactoring does not add `public`, the lint to require it is disabled for this section of the file.\n * To update this class delete all members and reapply the \"implement interface\" refactoring.\n * As these signatures get formatted to be over three times as many lines with prettier (which is not helpful), it is also suppressed.\n */\n/* eslint-disable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */\n// prettier-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\ndeclare abstract class NodeWithArrayFeatures<Input, T>\n\textends TreeNodeValid<Input>\n\timplements Pick<readonly T[], (typeof arrayPrototypeKeys)[number]>\n{\n\tconcat(...items: ConcatArray<T>[]): T[];\n\tconcat(...items: (T | ConcatArray<T>)[]): T[];\n\tentries(): IterableIterator<[number, T]>;\n\tevery<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): this is readonly S[];\n\tevery(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): boolean;\n\tfilter<S extends T>(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): S[];\n\tfilter(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): T[];\n\tfind<S extends T>(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => value is S,\n\t\tthisArg?: any,\n\t): S | undefined;\n\tfind(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): T | undefined;\n\tfindIndex(\n\t\tpredicate: (value: T, index: number, obj: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): number;\n\tflat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];\n\tflatMap<U, This = undefined>(\n\t\tcallback: (this: This, value: T, index: number, array: T[]) => U | readonly U[],\n\t\tthisArg?: This | undefined,\n\t): U[];\n\tforEach(\n\t\tcallbackfn: (value: T, index: number, array: readonly T[]) => void,\n\t\tthisArg?: any,\n\t): void;\n\tincludes(searchElement: T, fromIndex?: number | undefined): boolean;\n\tindexOf(searchElement: T, fromIndex?: number | undefined): number;\n\tjoin(separator?: string | undefined): string;\n\tkeys(): IterableIterator<number>;\n\tlastIndexOf(searchElement: T, fromIndex?: number | undefined): number;\n\tmap<U>(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[];\n\treduce(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t): T;\n\treduce(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t\tinitialValue: T,\n\t): T;\n\treduce<U>(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: U,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => U,\n\t\tinitialValue: U,\n\t): U;\n\treduceRight(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t): T;\n\treduceRight(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: T,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => T,\n\t\tinitialValue: T,\n\t): T;\n\treduceRight<U>(\n\t\tcallbackfn: (\n\t\t\tpreviousValue: U,\n\t\t\tcurrentValue: T,\n\t\t\tcurrentIndex: number,\n\t\t\tarray: readonly T[],\n\t\t) => U,\n\t\tinitialValue: U,\n\t): U;\n\tslice(start?: number | undefined, end?: number | undefined): T[];\n\tsome(\n\t\tpredicate: (value: T, index: number, array: readonly T[]) => unknown,\n\t\tthisArg?: any,\n\t): boolean;\n\ttoLocaleString(): string;\n\ttoString(): string;\n}\n/* eslint-enable @typescript-eslint/explicit-member-accessibility, @typescript-eslint/no-explicit-any */\n\n/**\n * Attempts to coerce the given property key to an integer index property.\n * @param key - The property key to coerce.\n * @param exclusiveMax - This restricts the range in which the resulting index is allowed to be.\n * The coerced index of `key` must be less than `exclusiveMax` or else this function will return `undefined`.\n * This is useful for reading an array within the bounds of its length, e.g. `asIndex(key, array.length)`.\n */\nexport function asIndex(key: string | symbol, exclusiveMax: number): number | undefined {\n\tif (typeof key !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\t// TODO: It may be worth a '0' <= ch <= '9' check before calling 'Number' to quickly\n\t// reject 'length' as an index, or even parsing integers ourselves.\n\tconst asNumber = Number(key);\n\tif (!Number.isInteger(asNumber)) {\n\t\treturn undefined;\n\t}\n\n\t// Check that the original string is the same after converting to a number and back again.\n\t// This prevents keys like \"5.0\", \"0x5\", \" 5\" from coercing to 5, and keys like \" \" or \"\" from coercing to 0.\n\tconst asString = String(asNumber);\n\tif (asString !== key) {\n\t\treturn undefined;\n\t}\n\n\t// TODO: See 'matrix/range.ts' for fast integer coercing + range check.\n\treturn 0 <= asNumber && asNumber < exclusiveMax ? asNumber : undefined;\n}\n\n/**\n * Create a proxy which implements the {@link TreeArrayNode} API.\n * @param allowAdditionalProperties - If true, setting of unexpected properties will be forwarded to the target object.\n * Otherwise setting of unexpected properties will error.\n * @param proxyTarget - Target object of the proxy. Must provide an own `length` value property\n * (which is not used but must exist for getOwnPropertyDescriptor invariants) and the array functionality from {@link arrayNodePrototype}.\n * Controls the prototype exposed by the produced proxy.\n * @param dispatchTarget - provides the functionally of the node, implementing all fields.\n */\nfunction createArrayNodeProxy(\n\tallowAdditionalProperties: boolean,\n\tproxyTarget: object,\n\tdispatchTarget: object,\n): TreeArrayNode {\n\t// To satisfy 'deepEquals' level scrutiny, the target of the proxy must be an array literal in order\n\t// to pass 'Object.getPrototypeOf'. It also satisfies 'Array.isArray' and 'Object.prototype.toString'\n\t// requirements without use of Array[Symbol.species], which is potentially on a path to deprecation.\n\tconst proxy: TreeArrayNode = new Proxy<TreeArrayNode>(proxyTarget as TreeArrayNode, {\n\t\tget: (target, key, receiver) => {\n\t\t\tconst field = getSequenceField(receiver);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\n\t\t\tif (maybeIndex === undefined) {\n\t\t\t\tif (key === \"length\") {\n\t\t\t\t\treturn field.length;\n\t\t\t\t}\n\n\t\t\t\t// In NodeJS 22, assert.strict.deepEqual started special casing well known constructors like Array.\n\t\t\t\t// That made this necessary, ensuring that in POJO mode, TreeArrayNode are still deepEqual to arrays.\n\t\t\t\tif (key === \"constructor\") {\n\t\t\t\t\treturn proxyTarget.constructor;\n\t\t\t\t}\n\n\t\t\t\t// Pass the proxy as the receiver here, so that any methods on\n\t\t\t\t// the prototype receive `proxy` as `this`.\n\t\t\t\treturn Reflect.get(dispatchTarget, key, receiver) as unknown;\n\t\t\t}\n\n\t\t\tconst maybeContent = field.at(maybeIndex);\n\t\t\treturn maybeContent === undefined\n\t\t\t\t? undefined\n\t\t\t\t: getOrCreateNodeFromInnerUnboxedNode(maybeContent);\n\t\t},\n\t\tset: (target, key, newValue, receiver) => {\n\t\t\tif (key === \"length\") {\n\t\t\t\t// To allow \"length\" to look like \"length\" on an array, getOwnPropertyDescriptor has to report it as a writable value.\n\t\t\t\t// This means the proxy target must provide a length value, but since it can't use getters and setters, it can't be correct.\n\t\t\t\t// Therefor length has to be handled in this proxy.\n\t\t\t\t// Since it's not actually mutable, return false so setting it will produce a type error.\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// 'Symbol.isConcatSpreadable' may be set on an Array instance to modify the behavior of\n\t\t\t// the concat method. We allow this property to be added to the dispatch object.\n\t\t\tif (key === Symbol.isConcatSpreadable) {\n\t\t\t\treturn Reflect.set(dispatchTarget, key, newValue, receiver);\n\t\t\t}\n\n\t\t\t// Array nodes treat all non-negative integer indexes as array access.\n\t\t\t// Using Infinity here (rather than length) ensures that indexing past the end doesn't create additional session local properties.\n\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\t// For MVP, we otherwise disallow setting properties (mutation is only available via the array node mutation APIs).\n\t\t\t\t// To ensure a clear and actionable error experience, we will throw explicitly here, rather than just returning false.\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot set indexed properties on array nodes. Use array node mutation APIs to alter the array.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn allowAdditionalProperties ? Reflect.set(target, key, newValue, receiver) : false;\n\t\t},\n\t\thas: (target, key) => {\n\t\t\tconst field = getSequenceField(proxy);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\t\t\treturn maybeIndex !== undefined || Reflect.has(dispatchTarget, key);\n\t\t},\n\t\townKeys: (target) => {\n\t\t\tconst field = getSequenceField(proxy);\n\n\t\t\t// TODO: Would a lazy iterator to produce the indexes work / be more efficient?\n\t\t\t// TODO: Need to surface 'Symbol.isConcatSpreadable' as an own key.\n\t\t\tconst keys: (string | symbol)[] = Array.from(\n\t\t\t\t{ length: field.length },\n\t\t\t\t(_, index) => `${index}`,\n\t\t\t);\n\n\t\t\tif (allowAdditionalProperties) {\n\t\t\t\tkeys.push(...Reflect.ownKeys(target));\n\t\t\t} else {\n\t\t\t\tkeys.push(\"length\");\n\t\t\t}\n\t\t\treturn keys;\n\t\t},\n\t\tgetOwnPropertyDescriptor: (target, key) => {\n\t\t\tconst field = getSequenceField(proxy);\n\t\t\tconst maybeIndex = asIndex(key, field.length);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\tconst val = field.at(maybeIndex);\n\t\t\t\t// To satisfy 'deepEquals' level scrutiny, the property descriptor for indexed properties must\n\t\t\t\t// be a simple value property (as opposed to using getter) and declared writable/enumerable/configurable.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: val === undefined ? undefined : getOrCreateNodeFromInnerUnboxedNode(val),\n\t\t\t\t\twritable: true, // For MVP, setting indexed properties is reported as allowed here (for deep equals compatibility noted above), but not actually supported.\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tconfigurable: true,\n\t\t\t\t};\n\t\t\t} else if (key === \"length\") {\n\t\t\t\t// To satisfy 'deepEquals' level scrutiny, the property descriptor for 'length' must be a simple\n\t\t\t\t// value property (as opposed to using getter) and be declared writable / non-configurable.\n\t\t\t\treturn {\n\t\t\t\t\tvalue: field.length,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn Reflect.getOwnPropertyDescriptor(dispatchTarget, key);\n\t\t},\n\t\tdefineProperty(target, key, attributes) {\n\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\tthrow new UsageError(\"Shadowing of array indices is not permitted.\");\n\t\t\t}\n\t\t\treturn Reflect.defineProperty(dispatchTarget, key, attributes);\n\t\t},\n\t});\n\treturn proxy;\n}\n\ntype Insertable<T extends ImplicitAllowedTypes> = readonly (\n\t| InsertableTreeNodeFromImplicitAllowedTypes<T>\n\t| IterableTreeArrayContent<InsertableTreeNodeFromImplicitAllowedTypes<T>>\n)[];\n\nabstract class CustomArrayNodeBase<const T extends ImplicitAllowedTypes>\n\textends TreeNodeWithArrayFeatures<\n\t\tIterable<InsertableTreeNodeFromImplicitAllowedTypes<T>>,\n\t\tTreeNodeFromImplicitAllowedTypes<T>\n\t>\n\timplements TreeArrayNode<T>\n{\n\t// Indexing must be provided by subclass.\n\t[k: number]: TreeNodeFromImplicitAllowedTypes<T>;\n\n\tpublic static readonly kind = NodeKind.Array;\n\n\tprotected abstract get childSchema(): ImplicitAllowedTypes;\n\tprotected abstract get allowedTypes(): ReadonlySet<TreeNodeSchema>;\n\n\tpublic abstract override get [typeSchemaSymbol](): TreeNodeSchemaClass<\n\t\tstring,\n\t\tNodeKind.Array\n\t>;\n\n\tpublic constructor(\n\t\tinput?: Iterable<InsertableTreeNodeFromImplicitAllowedTypes<T>> | InternalTreeNode,\n\t) {\n\t\tsuper(input ?? []);\n\t}\n\n\t#mapTreesFromFieldData(value: Insertable<T>): FlexibleFieldContent {\n\t\tconst sequenceField = getSequenceField(this);\n\t\tconst content = value as readonly (\n\t\t\t| InsertableContent\n\t\t\t| IterableTreeArrayContent<InsertableContent>\n\t\t)[];\n\n\t\tconst contentArray = content.flatMap((c): InsertableContent[] =>\n\t\t\tc instanceof IterableTreeArrayContent ? [...c] : [c],\n\t\t);\n\n\t\tconst kernel = getKernel(this);\n\t\tconst flexContext = kernel.getInnerNode().context;\n\t\tassert(\n\t\t\tflexContext === kernel.context.flexContext,\n\t\t\t0xc14 /* Expected flexContext to match */,\n\t\t);\n\t\tconst innerSchema = kernel.context.flexContext.schema.nodeSchema.get(\n\t\t\tbrand(kernel.schema.identifier),\n\t\t);\n\t\tassert(\n\t\t\tinnerSchema instanceof ObjectNodeStoredSchema,\n\t\t\t0xc15 /* Expected ObjectNodeStoredSchema */,\n\t\t);\n\t\tconst fieldSchema = innerSchema.getFieldSchema(EmptyKey);\n\n\t\tconst mapTrees = prepareArrayContentForInsertion(\n\t\t\tcontentArray,\n\t\t\tthis.childSchema,\n\t\t\tsequenceField.context,\n\t\t\tfieldSchema.types,\n\t\t);\n\n\t\treturn mapTrees;\n\t}\n\n\tpublic toJSON(): unknown {\n\t\t// This override causes the class instance to `JSON.stringify` as `[a, b]` rather than `{0: a, 1: b}`.\n\t\treturn [...(this as unknown as TreeArrayNode)];\n\t}\n\n\t// Instances of this class are used as the dispatch object for the proxy,\n\t// and thus its set of keys is used to implement `has` (for the `in` operator) for the non-numeric cases.\n\t// Therefore it must include `length`,\n\t// even though this \"length\" is never invoked (due to being shadowed by the proxy provided own property).\n\tpublic get length(): number {\n\t\treturn fail(0xadb /* Proxy should intercept length */);\n\t}\n\n\tpublic [Symbol.iterator](): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\treturn this.values();\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n\tpublic get [Symbol.unscopables]() {\n\t\t// This might not be the exact right set of values, but it only matters for `with` clauses which are deprecated and are banned in strict mode, so it shouldn't matter much.\n\t\t// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with for details.\n\t\treturn Array.prototype[Symbol.unscopables];\n\t}\n\n\tpublic at(\n\t\tthis: TreeArrayNode<T>,\n\t\tindex: number,\n\t): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst field = getSequenceField(this);\n\t\tconst val = field.boxedAt(index);\n\n\t\tif (val === undefined) {\n\t\t\treturn val;\n\t\t}\n\n\t\treturn getOrCreateNodeFromInnerNode(val) as TreeNodeFromImplicitAllowedTypes<T>;\n\t}\n\tpublic findLast<S extends TreeNodeFromImplicitAllowedTypes<T>>(\n\t\tpredicate: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tindex: number,\n\t\t\tarray: readonly TreeNodeFromImplicitAllowedTypes<T>[],\n\t\t) => value is S,\n\t\tthisArg?: unknown,\n\t): S | undefined;\n\tpublic findLast(\n\t\tpredicate: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tindex: number,\n\t\t\tarray: readonly TreeNodeFromImplicitAllowedTypes<T>[],\n\t\t) => unknown,\n\t\tthisArg?: unknown,\n\t): TreeNodeFromImplicitAllowedTypes<T> | undefined;\n\tpublic findLast(\n\t\tpredicate: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tindex: number,\n\t\t\tarray: readonly TreeNodeFromImplicitAllowedTypes<T>[],\n\t\t) => unknown,\n\t\tthisArg?: unknown,\n\t): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst array = this as readonly TreeNodeFromImplicitAllowedTypes<T>[];\n\t\tfor (let index = this.length - 1; index >= 0; index--) {\n\t\t\tconst value = this.at(index) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tconst matched = Boolean(predicate.call(thisArg, value, index, array));\n\t\t\tif (matched) {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\tpublic findLastIndex(\n\t\tpredicate: (\n\t\t\tvalue: TreeNodeFromImplicitAllowedTypes<T>,\n\t\t\tindex: number,\n\t\t\tarray: readonly TreeNodeFromImplicitAllowedTypes<T>[],\n\t\t) => unknown,\n\t\tthisArg?: unknown,\n\t): number {\n\t\tconst array = this as readonly TreeNodeFromImplicitAllowedTypes<T>[];\n\t\tfor (let index = this.length - 1; index >= 0; index--) {\n\t\t\tconst value = this.at(index) as TreeNodeFromImplicitAllowedTypes<T>;\n\t\t\tconst matched = Boolean(predicate.call(thisArg, value, index, array));\n\t\t\tif (matched) {\n\t\t\t\treturn index;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\tpublic insertAt(index: number, ...value: Insertable<T>): void {\n\t\tconst field = getSequenceField(this);\n\t\tvalidateIndex(index, field, \"TreeArrayNode.insertAt\", true);\n\t\tconst content = this.#mapTreesFromFieldData(value);\n\t\tfield.editor.insert(index, content);\n\t}\n\tpublic insertAtStart(...value: Insertable<T>): void {\n\t\tthis.insertAt(0, ...value);\n\t}\n\tpublic insertAtEnd(...value: Insertable<T>): void {\n\t\tthis.insertAt(this.length, ...value);\n\t}\n\tpublic push(...value: Insertable<T>): void {\n\t\tthis.insertAt(this.length, ...value);\n\t}\n\tpublic unshift(...value: Insertable<T>): void {\n\t\tthis.insertAt(0, ...value);\n\t}\n\tpublic pop(): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst value = this.at(-1);\n\t\tif (value !== undefined) {\n\t\t\tthis.removeAt(this.length - 1);\n\t\t}\n\t\treturn value;\n\t}\n\tpublic shift(): TreeNodeFromImplicitAllowedTypes<T> | undefined {\n\t\tconst value = this.at(0);\n\t\tif (value !== undefined) {\n\t\t\tthis.removeAt(0);\n\t\t}\n\t\treturn value;\n\t}\n\tpublic removeAt(index: number): void {\n\t\tconst field = getSequenceField(this);\n\t\tvalidateIndex(index, field, \"TreeArrayNode.removeAt\");\n\t\tfield.editor.remove(index, 1);\n\t}\n\tpublic removeRange(start?: number, end?: number): void {\n\t\tconst field = getSequenceField(this);\n\t\tconst { length, editor } = field;\n\t\tconst removeStart = start ?? 0;\n\t\tvalidateIndex(removeStart, field, \"TreeArrayNode.removeRange\", true);\n\n\t\tconst removeEnd = Math.min(length, end ?? length);\n\t\tvalidateIndexRange(removeStart, removeEnd, field, \"TreeArrayNode.removeRange\");\n\n\t\teditor.remove(removeStart, removeEnd - removeStart);\n\t}\n\tpublic splice(\n\t\tstart: number,\n\t\tdeleteCount?: number,\n\t\t...items: Insertable<T>\n\t): TreeNodeFromImplicitAllowedTypes<T>[] {\n\t\tconst length = this.length;\n\t\tconst actualStart = start < 0 ? Math.max(length + start, 0) : Math.min(start, length);\n\t\tconst actualDeleteCount =\n\t\t\tdeleteCount === undefined\n\t\t\t\t? length - actualStart\n\t\t\t\t: Math.min(Math.max(deleteCount, 0), length - actualStart);\n\t\tvalidateIndexRange(\n\t\t\tactualStart,\n\t\t\tactualStart + actualDeleteCount,\n\t\t\tgetSequenceField(this),\n\t\t\t\"TreeArrayNode.splice\",\n\t\t);\n\t\tconst removed: TreeNodeFromImplicitAllowedTypes<T>[] = [];\n\t\tfor (let index = actualStart; index < actualStart + actualDeleteCount; index++) {\n\t\t\tremoved.push(this.at(index) ?? oob());\n\t\t}\n\n\t\tconst innerNode = getInnerNode(this);\n\t\tconst transaction = innerNode.isHydrated()\n\t\t\t? innerNode.context.checkout.transaction\n\t\t\t: undefined;\n\t\ttransaction?.start();\n\t\tthis.removeRange(actualStart, actualStart + actualDeleteCount);\n\t\tif (items.length > 0) {\n\t\t\tthis.insertAt(actualStart, ...items);\n\t\t}\n\t\ttransaction?.commit();\n\t\treturn removed;\n\t}\n\n\tpublic moveToStart(sourceIndex: number, source?: ReadonlyArrayNode): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tvalidateIndex(sourceIndex, sourceField, \"TreeArrayNode.moveToStart\");\n\t\tthis.moveRangeToIndex(0, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveToEnd(sourceIndex: number, source?: ReadonlyArrayNode): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tvalidateIndex(sourceIndex, sourceField, \"TreeArrayNode.moveToEnd\");\n\t\tthis.moveRangeToIndex(this.length, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveToIndex(\n\t\tdestinationGap: number,\n\t\tsourceIndex: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tconst sourceArray = source ?? this;\n\t\tconst sourceField = getSequenceField(sourceArray);\n\t\tconst destinationField = getSequenceField(this);\n\t\tvalidateIndex(destinationGap, destinationField, \"TreeArrayNode.moveToIndex\", true);\n\t\tvalidateIndex(sourceIndex, sourceField, \"TreeArrayNode.moveToIndex\");\n\t\tthis.moveRangeToIndex(destinationGap, sourceIndex, sourceIndex + 1, source);\n\t}\n\tpublic moveRangeToStart(\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? getSequenceField(this),\n\t\t\t\"TreeArrayNode.moveRangeToStart\",\n\t\t);\n\t\tthis.moveRangeToIndex(0, sourceStart, sourceEnd, source);\n\t}\n\tpublic moveRangeToEnd(\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? getSequenceField(this),\n\t\t\t\"TreeArrayNode.moveRangeToEnd\",\n\t\t);\n\t\tthis.moveRangeToIndex(this.length, sourceStart, sourceEnd, source);\n\t}\n\tpublic moveRangeToIndex(\n\t\tdestinationGap: number,\n\t\tsourceStart: number,\n\t\tsourceEnd: number,\n\t\tsource?: ReadonlyArrayNode,\n\t): void {\n\t\tconst destinationField = getSequenceField(this);\n\t\tconst destinationSchema = this.allowedTypes;\n\t\tconst kernel = getKernel(this);\n\t\tconst destinationStored = (\n\t\t\tkernel.context.flexContext.schema.nodeSchema.get(brand(kernel.schema.identifier)) ??\n\t\t\tfail(0xc16 /* missing schema for array node */)\n\t\t).getFieldSchema(EmptyKey).types;\n\t\tconst sourceField = source === undefined ? destinationField : getSequenceField(source);\n\n\t\tvalidateIndex(destinationGap, destinationField, \"TreeArrayNode.moveRangeToIndex\", true);\n\t\tvalidateIndexRange(\n\t\t\tsourceStart,\n\t\t\tsourceEnd,\n\t\t\tsource ?? destinationField,\n\t\t\t\"TreeArrayNode.moveRangeToIndex\",\n\t\t);\n\n\t\t// TODO: determine support for move across different sequence types\n\t\tif (sourceField !== destinationField) {\n\t\t\tfor (let i = sourceStart; i < sourceEnd; i++) {\n\t\t\t\tconst sourceNode = sourceField.boxedAt(i) ?? oob();\n\t\t\t\tconst sourceSchema = getSimpleNodeSchemaFromInnerNode(sourceNode);\n\t\t\t\tif (!destinationSchema.has(sourceSchema)) {\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Type ${sourceNode.type} in source sequence is not allowed in destination.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (!destinationStored.has(sourceNode.type)) {\n\t\t\t\t\t// TODO: better and centralized messages for missing staged schema updates.\n\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t`Type ${sourceNode.type} in source sequence is not allowed in destination's stored schema: this would likely require upgrading the document to permit a staged schema.`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst movedCount = sourceEnd - sourceStart;\n\t\tif (destinationField.context.isHydrated()) {\n\t\t\tif (!sourceField.context.isHydrated()) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from an unhydrated array to a hydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (sourceField.context !== destinationField.context) {\n\t\t\t\tthrow new UsageError(\"Cannot move elements between two different TreeViews.\");\n\t\t\t}\n\n\t\t\tdestinationField.context.checkout.editor.move(\n\t\t\t\tsourceField.getFieldPath(),\n\t\t\t\tsourceStart,\n\t\t\t\tmovedCount,\n\t\t\t\tdestinationField.getFieldPath(),\n\t\t\t\tdestinationGap,\n\t\t\t);\n\t\t} else {\n\t\t\tif (!(sourceField instanceof UnhydratedSequenceField)) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from a hydrated array to an unhydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (sourceField.context.isHydrated()) {\n\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\"Cannot move elements from an unhydrated array to a hydrated array.\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tassert(\n\t\t\t\tdestinationField instanceof UnhydratedSequenceField,\n\t\t\t\t0xcd5 /* destinationField should be unhydrated since we're in the else branch of isHydrated() check */,\n\t\t\t);\n\n\t\t\t// Use native move which handles the operation atomically for within-field moves\n\t\t\t// to ensure only a single event is emitted per affected field.\n\t\t\tdestinationField.editor.move(\n\t\t\t\tsourceStart,\n\t\t\t\tmovedCount,\n\t\t\t\tdestinationGap,\n\t\t\t\tsourceField === destinationField ? undefined : sourceField,\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic values(): IterableIterator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\treturn this.generateValues(getKernel(this).generationNumber);\n\t}\n\tprivate *generateValues(\n\t\tinitialLastUpdatedStamp: number,\n\t): Generator<TreeNodeFromImplicitAllowedTypes<T>> {\n\t\tconst kernel = getKernel(this);\n\t\tif (initialLastUpdatedStamp !== kernel.generationNumber) {\n\t\t\tthrow new UsageError(`Concurrent editing and iteration is not allowed.`);\n\t\t}\n\t\tfor (let i = 0; i < this.length; i++) {\n\t\t\tyield this.at(i) ?? fail(0xadc /* Index is out of bounds */);\n\t\t\tif (initialLastUpdatedStamp !== kernel.generationNumber) {\n\t\t\t\tthrow new UsageError(`Concurrent editing and iteration is not allowed.`);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.\n *\n * @param name - Unique identifier for this schema including the factory's scope.\n * @param persistedMetadata - Optional persisted metadata for the object node schema.\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function arraySchema<\n\tTName extends string,\n\tconst T extends ImplicitAllowedTypes,\n\tconst ImplicitlyConstructable extends boolean,\n\tconst TCustomMetadata = unknown,\n>(\n\tidentifier: TName,\n\tinfo: T,\n\timplicitlyConstructable: ImplicitlyConstructable,\n\tcustomizable: boolean,\n\tnodeOptions: NodeSchemaOptionsAlpha<TCustomMetadata>,\n) {\n\ttype Output = ArrayNodeCustomizableSchema<\n\t\tTName,\n\t\tT,\n\t\tImplicitlyConstructable,\n\t\tTCustomMetadata\n\t> &\n\t\tArrayNodePojoEmulationSchema<TName, T, ImplicitlyConstructable, TCustomMetadata> &\n\t\tTreeNodeSchemaCorePrivate;\n\n\tconst persistedMetadata = nodeOptions?.persistedMetadata;\n\tconst normalizedTypes = normalizeAllowedTypes(info);\n\tconst lazyAllowedTypesIdentifiers = new Lazy(\n\t\t() => new Set(normalizedTypes.evaluate().map((type) => type.identifier)),\n\t);\n\tconst lazySimpleAllowedTypes = new Lazy(() => {\n\t\treturn AnnotatedAllowedTypesInternal.evaluateSimpleAllowedTypes(normalizedTypes);\n\t});\n\n\tlet privateData: TreeNodeSchemaPrivateData | undefined;\n\n\t// This class returns a proxy from its constructor to handle numeric indexing.\n\t// Alternatively it could extend a normal class which gets tons of numeric properties added.\n\tclass Schema extends CustomArrayNodeBase<T> {\n\t\tpublic static override prepareInstance<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tflexNode: FlexTreeNode,\n\t\t): TreeNodeValid<T2> {\n\t\t\tconst proxyTarget = customizable ? instance : [];\n\n\t\t\tif (customizable) {\n\t\t\t\t// Since proxy reports this as a \"non-configurable\" property, it must exist on the underlying object used as the proxy target, not as an inherited property.\n\t\t\t\t// This should not get used as the proxy should intercept all use.\n\t\t\t\tObject.defineProperty(instance, \"length\", {\n\t\t\t\t\tvalue: Number.NaN,\n\t\t\t\t\twritable: true,\n\t\t\t\t\tenumerable: false,\n\t\t\t\t\tconfigurable: false,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn createArrayNodeProxy(customizable, proxyTarget, instance) as unknown as Schema;\n\t\t}\n\n\t\tpublic static override buildRawNode<T2>(\n\t\t\tthis: typeof TreeNodeValid<T2>,\n\t\t\tinstance: TreeNodeValid<T2>,\n\t\t\tinput: T2,\n\t\t): UnhydratedFlexTreeNode {\n\t\t\treturn unhydratedFlexTreeFromInsertable(input as object, this as typeof Schema);\n\t\t}\n\n\t\tpublic static get allowedTypesIdentifiers(): ReadonlySet<string> {\n\t\t\treturn lazyAllowedTypesIdentifiers.value;\n\t\t}\n\n\t\tpublic static get simpleAllowedTypes(): ReadonlyMap<\n\t\t\tstring,\n\t\t\tSimpleAllowedTypeAttributes<SchemaType.View>\n\t\t> {\n\t\t\treturn lazySimpleAllowedTypes.value;\n\t\t}\n\n\t\tprotected static override constructorCached: MostDerivedData | undefined = undefined;\n\n\t\tprotected static override oneTimeSetup(): TreeNodeSchemaInitializedData {\n\t\t\t// First run, do extra validation.\n\t\t\t// TODO: provide a way for TreeConfiguration to trigger this same validation to ensure it gets run early.\n\t\t\t// Scan for shadowing inherited members which won't work, but stop scan early to allow shadowing built in (which seems to work ok).\n\t\t\t{\n\t\t\t\tlet prototype: object = this.prototype;\n\t\t\t\t// There isn't a clear cleaner way to author this loop.\n\t\t\t\twhile (prototype !== Schema.prototype) {\n\t\t\t\t\t// Search prototype keys and check for positive integers. Throw if any are found.\n\t\t\t\t\t// Shadowing of index properties on array nodes is not supported.\n\t\t\t\t\tfor (const key of Object.getOwnPropertyNames(prototype)) {\n\t\t\t\t\t\tconst maybeIndex = asIndex(key, Number.POSITIVE_INFINITY);\n\t\t\t\t\t\tif (maybeIndex !== undefined) {\n\t\t\t\t\t\t\tthrow new UsageError(\n\t\t\t\t\t\t\t\t`Schema ${identifier} defines an inherited index property \"${key.toString()}\" which shadows a possible array index. Shadowing of array indices is not permitted.`,\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// Since this stops at the array node base schema, it should never see a null prototype, so this case is safe.\n\t\t\t\t\t// Additionally, if the prototype chain is ever messed up such that the array base schema is not in it,\n\t\t\t\t\t// the null that would show up here does at least ensure this code throws instead of hanging.\n\t\t\t\t\tprototype = Reflect.getPrototypeOf(prototype) as object;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst schema = this as ArrayNodeSchema;\n\n\t\t\treturn getTreeNodeSchemaInitializedData(this, {\n\t\t\t\tshallowCompatibilityTest: (data: FactoryContent): CompatibilityLevel =>\n\t\t\t\t\tshallowCompatibilityTest(data, schema),\n\t\t\t\ttoFlexContent: (\n\t\t\t\t\tdata: FactoryContent,\n\t\t\t\t\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n\t\t\t\t): FlexContent => arrayToFlexContent(data, schema),\n\t\t\t});\n\t\t}\n\n\t\tpublic static readonly identifier = identifier;\n\t\tpublic static readonly info = info;\n\t\tpublic static readonly implicitlyConstructable: ImplicitlyConstructable =\n\t\t\timplicitlyConstructable;\n\t\tpublic static get childTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\t\tpublic static readonly metadata: NodeSchemaMetadata<TCustomMetadata> =\n\t\t\tnodeOptions.metadata ?? {};\n\t\tpublic static readonly persistedMetadata: JsonCompatibleReadOnlyObject | undefined =\n\t\t\tpersistedMetadata;\n\n\t\t// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.\n\t\tpublic get [typeNameSymbol](): TName {\n\t\t\treturn identifier;\n\t\t}\n\t\tpublic get [typeSchemaSymbol](): Output {\n\t\t\treturn Schema.constructorCached?.constructor as unknown as Output;\n\t\t}\n\n\t\tprotected get childSchema(): T {\n\t\t\treturn info;\n\t\t}\n\t\tprotected get allowedTypes(): ReadonlySet<TreeNodeSchema> {\n\t\t\treturn normalizedTypes.evaluateSet();\n\t\t}\n\n\t\tpublic static get [privateDataSymbol](): TreeNodeSchemaPrivateData {\n\t\t\treturn (privateData ??= createTreeNodeSchemaPrivateData(this, [normalizedTypes]));\n\t\t}\n\t}\n\n\tconst output: Output = Schema;\n\treturn output;\n}\n\n/**\n * Transforms data for a child of an array.\n * @param child - The tree data to be transformed.\n * @param allowedTypes - The set of types allowed by the parent context. Used to validate the input tree.\n */\nfunction arrayChildToFlexTree(\n\tchild: InsertableContent,\n\tallowedTypes: ReadonlySet<TreeNodeSchema>,\n): UnhydratedFlexTreeNode {\n\t// We do not support undefined sequence entries.\n\t// If we encounter an undefined entry, use null instead if supported by the schema, otherwise throw.\n\tlet childWithFallback = child;\n\tif (child === undefined) {\n\t\tif (allowedTypes.has(nullSchema)) {\n\t\t\tchildWithFallback = null;\n\t\t} else {\n\t\t\tthrow new TypeError(`Received unsupported array entry value: ${child}.`);\n\t\t}\n\t}\n\treturn unhydratedFlexTreeFromInsertableNode(childWithFallback, allowedTypes);\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.toFlexContent} for Array nodes.\n *\n * @param data - The tree data to be transformed. Must be an iterable.\n * @param schema - The schema to comply with.\n */\nfunction arrayToFlexContent(data: FactoryContent, schema: ArrayNodeSchema): FlexContent {\n\tif (!(typeof data === \"object\" && data !== null && Symbol.iterator in data)) {\n\t\t// eslint-disable-next-line @typescript-eslint/no-base-to-string\n\t\tthrow new UsageError(`Input data is incompatible with Array schema: ${data}`);\n\t}\n\n\tconst allowedChildTypes = normalizeAllowedTypes(schema.info);\n\n\tconst mappedData = Array.from(data, (child) =>\n\t\tarrayChildToFlexTree(child, allowedChildTypes.evaluateSet()),\n\t);\n\n\tconst context = getUnhydratedContext(schema).flexContext;\n\n\t// Array nodes have a single `EmptyKey` field:\n\tconst fieldsEntries =\n\t\tmappedData.length === 0\n\t\t\t? []\n\t\t\t: ([\n\t\t\t\t\t[\n\t\t\t\t\t\tEmptyKey,\n\t\t\t\t\t\tnew UnhydratedSequenceField(\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tFieldKinds.sequence.identifier,\n\t\t\t\t\t\t\tEmptyKey,\n\t\t\t\t\t\t\tmappedData,\n\t\t\t\t\t\t),\n\t\t\t\t\t],\n\t\t\t\t] as const);\n\n\treturn [\n\t\t{\n\t\t\ttype: brand(schema.identifier),\n\t\t},\n\t\tnew Map(fieldsEntries),\n\t];\n}\n\n/**\n * {@link TreeNodeSchemaInitializedData.shallowCompatibilityTest} for Array nodes.\n */\nfunction shallowCompatibilityTest(\n\tdata: FactoryContent,\n\tschema: ArrayNodeSchema,\n): CompatibilityLevel {\n\tif (isTreeValue(data)) {\n\t\treturn CompatibilityLevel.None;\n\t}\n\n\tif (data instanceof Map) {\n\t\t// Maps are iterable, so type checking does allow constructing an ArrayNode from a map if the ArrayNode's type is an array that includes the key and value types of the map.\n\t\treturn CompatibilityLevel.Low;\n\t}\n\n\tif (Symbol.iterator in data) {\n\t\treturn CompatibilityLevel.Normal;\n\t}\n\n\treturn CompatibilityLevel.None;\n}\n\n/**\n * A location in a {@link (TreeArrayNode:interface)}.\n * @remarks\n * Tracks a location even as the array is mutated.\n * How this is adjusted for edits depends on the specific anchor being used.\n * See {@link createArrayInsertionAnchor} for one way to create such an anchor.\n * @privateRemarks\n * This being sealed is not important for its current behaviors as nothing downcasts this,\n * however it is possible we might want to add additional members in the future:\n * sealing this ensures that such additions are a non-breaking change.\n * Things we might want to add include status (for example if its deleted) or events (for example to notify when its index changes).\n * Some specific anchors might even want to add additional method members for things like confidence\n * (so we can indicate when the anchor goes from being truly robust to a heuristic guess due to an edit).\n * @alpha\n * @sealed\n */\nexport interface ArrayPlaceAnchor {\n\t/**\n\t * The current index within the array that this anchor refers to.\n\t * @remarks\n\t * This value is updated as the array is edited in a way that depends on the specific anchor implementation.\n\t * This index is a value from 0 to the current length of the array (inclusive).\n\t * If used as the index to insert content into the array, this means it can point to any location in the array,\n\t * including just after the last child.\n\t * @throws A {@link @fluidframework/telemetry-utils#UsageError} if the anchor has been {@link ArrayPlaceAnchor.dispose | disposed}.\n\t */\n\tget index(): number;\n\n\t/**\n\t * Stop tracking this anchor and release any resources it holds.\n\t * @remarks\n\t * Call this when the anchor is no longer needed (for example when a tracked cursor position is discarded).\n\t * Interacting with an anchor (including reading its properties) after it has been disposed is invalid and will throw.\n\t * Calling `dispose` more than once has no effect.\n\t */\n\tdispose(): void;\n}\n\n/**\n * Create an {@link ArrayPlaceAnchor} tracking an insertion point in the array which is currently at the provided index.\n *\n * @param node - The array node to anchor into.\n * @param currentIndex - The current index of the place to track.\n * @remarks\n * This anchor will track the logical position in the array across changes.\n * As long as the subsection of the array surrounding the anchor point is not edited,\n * this anchor will move with them, keeping its relative position to those children fixed.\n * How exactly it behaves when the adjacent portion of the array is modified is subject to change,\n * but this will always report a valid index to insert content at (which can be the index after the last item in the array).\n *\n * This is intended to track a location that might be used for an insertion point (for example in a text editor): future changes to its details should\n * make it behave better for such uses.\n *\n * In rare cases the tracked index cannot be updated precisely and the anchor falls back to best-effort behavior:\n * it keeps reporting a valid in-bounds index, but that index may no longer correspond to the same logical position\n * as before the change (this can happen when an incremental delta is unavailable for a change, such as during a\n * schema change). Consumers that require an accurate position across such changes should re-derive it from their\n * own state rather than relying solely on this anchor.\n * @privateRemarks\n * The index is maintained incrementally from the shallow (insert/remove) delta delivered by the array node's\n * `childrenChangedAfterBatch` event: inserts and removes before the anchor point shift it, while edits after it\n * (or a removal of the span it sits between) leave it in place. This keeps the anchor pinned to the gap between\n * children even when the child originally at its index is removed.\n *\n * The best-effort behavior noted in the public remarks is the no-delta path: when the composed delta is unavailable\n * (see {@link NodeChangedDataDelta.delta}), the exact shift is unknown so the index is only clamped back into range.\n * This is intentionally weak rather than reintroducing a per-edit O(n) snapshot of the array to diff old-vs-new\n * (which would defeat the point of delta-based tracking) for a case that is rare and, for this alpha API, acceptable\n * to degrade. A stronger fallback could instead let a consumer that already maintains the array contents re-seed the\n * anchor's position on this path, so it lives with the consumer that has the data instead of being duplicated here.\n *\n * TODO: The no-delta case above is one of several places whose behavior is limited by changes for which a composed\n * delta cannot be produced (see {@link NodeChangedDataDelta.delta}). The underlying eventing limitation should be\n * fixed so a delta is always available; when adding new code constrained by it, note it here (or track it centrally)\n * so the full set of affected call sites is known and can be prioritized.\n *\n * When stabilized, this should probably become a method on {@link (TreeArrayNode:interface)}.\n * Future versions of this should use rebaser / changeset logic to do a better job of tracking a location across removals or reinsertion.\n * How this would work, especially for unhydrated nodes is not yet clear.\n * @alpha\n */\nexport function createArrayInsertionAnchor(\n\tnode: TreeArrayNode,\n\tcurrentIndex: number,\n): ArrayPlaceAnchor {\n\t// An out-of-range or non-integer index is a usage error. An index equal to the array length is valid\n\t// (it points just past the last child).\n\tconst field = getInnerNode(node).getBoxed(EmptyKey);\n\tvalidateIndex(currentIndex, field, \"createArrayInsertionAnchor\", /* allowOnePastEnd */ true);\n\tlet trackedIndex = currentIndex;\n\n\tconst kernel = getKernel(node);\n\tlet off: (() => void) | undefined = kernel.events.on(\n\t\t\"childrenChangedAfterBatch\",\n\t\t({ fieldMarks }) => {\n\t\t\tconst marks = fieldMarks.get(EmptyKey);\n\t\t\t// This event fires after the change is applied, so the field reflects the post-edit length.\n\t\t\tconst length = getInnerNode(node).getBoxed(EmptyKey).length;\n\t\t\tif (marks === undefined) {\n\t\t\t\t// No-delta path: the composed delta is unavailable, so the exact shift is unknown. Keep the\n\t\t\t\t// index valid by clamping it to the current length (best-effort). See this function's\n\t\t\t\t// @privateRemarks for when this happens and why the fallback is intentionally weak.\n\t\t\t\ttrackedIndex = clamp(trackedIndex, 0, length);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Clamp defensively so a malformed or partial delta can never push the tracked index outside the\n\t\t\t// valid insertion range while the anchor is live (adjustIndexForArrayDelta has no final clamp).\n\t\t\ttrackedIndex = clamp(adjustIndexForArrayDelta(trackedIndex, marks), 0, length);\n\t\t},\n\t);\n\n\treturn {\n\t\tget index() {\n\t\t\tif (off === undefined) {\n\t\t\t\tthrow new UsageError(\"Cannot read the index of a disposed ArrayPlaceAnchor.\");\n\t\t\t}\n\t\t\treturn trackedIndex;\n\t\t},\n\t\tdispose() {\n\t\t\toff?.();\n\t\t\toff = undefined;\n\t\t},\n\t};\n}\n\n/**\n * Compute the new index of an {@link ArrayPlaceAnchor} after applying a shallow array delta.\n * @remarks\n * The marks cover the array's sequence field in order. `readPosition` walks the pre-edit array as the marks are\n * consumed while `index` stays fixed at the anchor's pre-edit location; comparing the two (both in pre-edit\n * coordinates) shifts `newIndex` to keep the anchor in the same gap between children as content is inserted or\n * removed around it. Each mark is a removal (`detach`), an insertion (`attach`), or a retain (neither); a mark may\n * carry both `detach` and `attach`, which is handled as a removal followed by an insertion. The per-mark behavior is\n * commented inline below.\n */\nfunction adjustIndexForArrayDelta(index: number, marks: readonly DeltaMark[]): number {\n\tlet readPosition = 0;\n\tlet newIndex = index;\n\tfor (const mark of marks) {\n\t\t// A removal consumes pre-edit content: if it lies entirely before the anchor it pulls the anchor left,\n\t\t// and if it contains the anchor's position the anchor collapses to the start of the removed span.\n\t\tif (mark.detach !== undefined) {\n\t\t\tconst removeEnd = readPosition + mark.count;\n\t\t\tif (removeEnd <= index) {\n\t\t\t\tnewIndex -= mark.count;\n\t\t\t} else if (readPosition < index) {\n\t\t\t\tnewIndex -= index - readPosition;\n\t\t\t}\n\t\t\treadPosition += mark.count;\n\t\t}\n\t\tif (mark.attach !== undefined) {\n\t\t\t// Content inserted at or before the anchor pushes it right; inserting exactly at the anchor leaves the\n\t\t\t// anchor after the new content (insertion-point behavior). Inserted content is new, so it does not\n\t\t\t// advance the pre-edit read position.\n\t\t\tif (readPosition <= index) {\n\t\t\t\tnewIndex += mark.count;\n\t\t\t}\n\t\t} else if (mark.detach === undefined) {\n\t\t\t// Retain: existing content that was neither inserted nor removed.\n\t\t\treadPosition += mark.count;\n\t\t}\n\t}\n\treturn newIndex;\n}\n"]}
|
|
@@ -98,6 +98,83 @@ export interface TreeMapNodeAlpha<T extends ImplicitAllowedTypes = ImplicitAllow
|
|
|
98
98
|
* even if some of those elements were not yet in the map when the edit was authored.
|
|
99
99
|
*/
|
|
100
100
|
clear(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Returns the value at `key`, first inserting `fallbackValue` if this map has no entry for `key`.
|
|
103
|
+
*
|
|
104
|
+
* @param key - The key of the element to return or insert at.
|
|
105
|
+
* @param fallbackValue - The value to insert if `key` has no entry.
|
|
106
|
+
* @returns The value at `key`, which may be the provided `fallbackValue`
|
|
107
|
+
* if the map had no previous entry for `key`.
|
|
108
|
+
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* The check for the presence of an existing entry with the given `key` is performed at the time the edit is authored.
|
|
111
|
+
* This has implications for the merge semantics of this operation:
|
|
112
|
+
*
|
|
113
|
+
* - If no entry is present for `key` at authoring time (thus leading to an insert)
|
|
114
|
+
* while a peer concurrently inserts a value for the same `key`,
|
|
115
|
+
* then the two inserts will race and the one that is sequenced second will overwrite the value inserted by the one
|
|
116
|
+
* that is sequenced first.
|
|
117
|
+
*
|
|
118
|
+
* - If an entry is present for `key` at authoring time (thus leading to no insert)
|
|
119
|
+
* while a peer concurrently deletes the entry for `key`,
|
|
120
|
+
* then the map will end up with no entry for `key` no matter how the two edits are sequenced.
|
|
121
|
+
*
|
|
122
|
+
* - If an entry is present for `key` at authoring time (thus leading to no insert)
|
|
123
|
+
* while a peer concurrently inserts a new entry for `key`,
|
|
124
|
+
* then the map will end up with the entry set by the peer no matter how the two edits are sequenced.
|
|
125
|
+
*
|
|
126
|
+
* These last two points mean that, upon sequencing of an edit made with this API,
|
|
127
|
+
* there is no guarantee that the entry for the given key will be the current one (if any) or the fallback one.
|
|
128
|
+
* If such a guarantee is important, then consider using {@link RunTransactionParamsAlpha.preconditions}
|
|
129
|
+
* to ensure the edit only applies when appropriate.
|
|
130
|
+
*
|
|
131
|
+
* This API is **not** equivalent to the following alternative:
|
|
132
|
+
*
|
|
133
|
+
* ```typescript
|
|
134
|
+
* map.set(key, map.get(key) ?? fallbackValue);
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* They differ in the following ways:
|
|
138
|
+
*
|
|
139
|
+
* - This API treats entries containing `null` values as populated.
|
|
140
|
+
* By contrast, the above alternative's usage of `??` means that a `null` entry is treated as equivalent to a missing entry.
|
|
141
|
+
*
|
|
142
|
+
* - This API only inserts/sets the entry for the given `key` when there is no current one.
|
|
143
|
+
* By contrast, the above alternative always performs an insert.
|
|
144
|
+
* That insert will throw an error for non-leaf types (objects, maps, arrays, and records) in cases where the entry
|
|
145
|
+
* is already populated, because inserting a node that was already inserted is not supported.
|
|
146
|
+
* It will always succeed for leaf types (number, string, boolean, null, and handle) since a new node is created
|
|
147
|
+
* from the value.
|
|
148
|
+
* Note that even in the cases where it does not throw,
|
|
149
|
+
* the `set` operation has the potential to overwrite entries that are concurrently inserted even when the map had
|
|
150
|
+
* an entry for `key`, which is not the case with this API.
|
|
151
|
+
*
|
|
152
|
+
* Avoid using this API to write a default value into the document when the application could instead return that
|
|
153
|
+
* default when reading a missing entry, which is much less costly.
|
|
154
|
+
* A more appropriate use of this API is when the value to be optionally inserted varies with the key.
|
|
155
|
+
*/
|
|
156
|
+
getOrInsert(key: string, fallbackValue: InsertableTreeNodeFromImplicitAllowedTypes<T>): TreeNodeFromImplicitAllowedTypes<T>;
|
|
157
|
+
/**
|
|
158
|
+
* Returns the value at `key`, first inserting the value produced by `callback` if this map has no entry for `key`.
|
|
159
|
+
*
|
|
160
|
+
* @param key - The key of the element to return or insert at.
|
|
161
|
+
* @param callback - Invoked with `key` to produce the value to insert if `key` has no entry.
|
|
162
|
+
* Not invoked if an entry is present.
|
|
163
|
+
* @returns The value at `key`, which may be the value produced by `callback`
|
|
164
|
+
* if the map had no previous entry for `key`.
|
|
165
|
+
*
|
|
166
|
+
* @remarks
|
|
167
|
+
* This API is equivalent to {@link TreeMapNodeAlpha.getOrInsert} except that the fallback value is computed lazily:
|
|
168
|
+
* `callback` is only invoked when the map has no entry for `key`.
|
|
169
|
+
* Prefer this API over {@link TreeMapNodeAlpha.getOrInsert} when producing the fallback value is expensive.
|
|
170
|
+
*
|
|
171
|
+
* The check for the presence of an existing entry with the given `key` is performed at the time the edit is authored.
|
|
172
|
+
* See {@link TreeMapNodeAlpha.getOrInsert} for the implications this has on the merge semantics of this operation.
|
|
173
|
+
*
|
|
174
|
+
* If `callback` throws, no edit is made and the error is propagated to the caller.
|
|
175
|
+
* If `callback` sets an entry for `key` in this map, that entry is overwritten with the value `callback` returned.
|
|
176
|
+
*/
|
|
177
|
+
getOrInsertComputed(key: string, callback: (key: string) => InsertableTreeNodeFromImplicitAllowedTypes<T>): TreeNodeFromImplicitAllowedTypes<T>;
|
|
101
178
|
}
|
|
102
179
|
/**
|
|
103
180
|
* Define a {@link TreeNodeSchema} for a {@link (TreeArrayNode:interface)}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapNode.d.ts","sourceRoot":"","sources":["../../../../src/simple-tree/node-kinds/map/mapNode.ts"],"names":[],"mappings":"A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ACjB,IAAI,EAAE,CAAC,EACP,uBAAuB,EAAE,uBAAuB,EAChD,eAAe,EAAE,OAAO,EACxB,WAAW,GAAE,sBAAsB,CAAC,eAAe,CAAM,kPAwFzD;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,oBAAoB,IAC7D,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,0CAA0C,CAAC,CAAC,CAAC,CAAC,CAAC,GAC1E,uBAAuB,CAAC,0CAA0C,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -74,6 +74,22 @@ class CustomMapNodeBase extends index_js_4.TreeNodeValid {
|
|
|
74
74
|
this.editor(key).set(mapTree, field.length === 0);
|
|
75
75
|
return this;
|
|
76
76
|
}
|
|
77
|
+
getOrInsert(key, fallbackValue) {
|
|
78
|
+
const existing = this.get(key);
|
|
79
|
+
if (existing !== undefined) {
|
|
80
|
+
return existing;
|
|
81
|
+
}
|
|
82
|
+
this.set(key, fallbackValue);
|
|
83
|
+
return this.get(key);
|
|
84
|
+
}
|
|
85
|
+
getOrInsertComputed(key, callback) {
|
|
86
|
+
const existing = this.get(key);
|
|
87
|
+
if (existing !== undefined) {
|
|
88
|
+
return existing;
|
|
89
|
+
}
|
|
90
|
+
this.set(key, callback(key));
|
|
91
|
+
return this.get(key);
|
|
92
|
+
}
|
|
77
93
|
get size() {
|
|
78
94
|
return (0, index_js_3.count)(this.innerNode.keys());
|
|
79
95
|
}
|
|
@@ -146,7 +162,7 @@ function mapSchema(identifier, info, implicitlyConstructable, useMapPrototype, n
|
|
|
146
162
|
static get childTypes() {
|
|
147
163
|
return normalizedTypes.evaluateSet();
|
|
148
164
|
}
|
|
149
|
-
// eslint-disable-next-line import-x/no-deprecated
|
|
165
|
+
// eslint-disable-next-line import-x/no-deprecated -- Required to implement the deprecated typeNameSymbol API.
|
|
150
166
|
get [(_a = Symbol.toStringTag, index_js_4.typeNameSymbol)]() {
|
|
151
167
|
return identifier;
|
|
152
168
|
}
|