@portabletext/editor 8.0.3 → 8.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/lib/{behavior.types.action-C6D8CCF9.d.ts → behavior.types.action-C0XDEQnB.d.ts} +18 -1
  2. package/lib/behavior.types.action-C0XDEQnB.d.ts.map +1 -0
  3. package/lib/behaviors/index.d.ts +1 -1
  4. package/lib/{get-container-D1nM_ww9.js → get-container-D2pN5Npr.js} +3 -3
  5. package/lib/{get-container-D1nM_ww9.js.map → get-container-D2pN5Npr.js.map} +1 -1
  6. package/lib/{get-parent-Ci5241qs.js → get-parent-DgaKcy8-.js} +18 -12
  7. package/lib/get-parent-DgaKcy8-.js.map +1 -0
  8. package/lib/{get-path-sub-schema-CZd9VcVM.js → get-path-sub-schema-Dd0QYZ0m.js} +2 -2
  9. package/lib/{get-path-sub-schema-CZd9VcVM.js.map → get-path-sub-schema-Dd0QYZ0m.js.map} +1 -1
  10. package/lib/index.d.ts +1 -1
  11. package/lib/index.js +290 -205
  12. package/lib/index.js.map +1 -1
  13. package/lib/plugins/index.d.ts +1 -1
  14. package/lib/{selector.is-selecting-entire-blocks-DPnzucrd.js → selector.is-selecting-entire-blocks-BFhnnkHf.js} +4 -4
  15. package/lib/{selector.is-selecting-entire-blocks-DPnzucrd.js.map → selector.is-selecting-entire-blocks-BFhnnkHf.js.map} +1 -1
  16. package/lib/selectors/index.d.ts +1 -1
  17. package/lib/selectors/index.js +4 -4
  18. package/lib/traversal/index.d.ts +1 -1
  19. package/lib/traversal/index.js +3 -3
  20. package/lib/{util.is-equal-selections-N1hxVUbE.js → util.is-equal-selections-BdK98okY.js} +2 -2
  21. package/lib/{util.is-equal-selections-N1hxVUbE.js.map → util.is-equal-selections-BdK98okY.js.map} +1 -1
  22. package/lib/{util.slice-blocks-B2fZcNok.js → util.slice-blocks-_ElaB53f.js} +2 -2
  23. package/lib/{util.slice-blocks-B2fZcNok.js.map → util.slice-blocks-_ElaB53f.js.map} +1 -1
  24. package/lib/utils/index.d.ts +1 -1
  25. package/lib/utils/index.js +3 -3
  26. package/package.json +1 -1
  27. package/lib/behavior.types.action-C6D8CCF9.d.ts.map +0 -1
  28. package/lib/get-parent-Ci5241qs.js.map +0 -1
@@ -1464,6 +1464,12 @@ interface RangeDecoration {
1464
1464
  * The component that renders the range decoration. It receives the
1465
1465
  * decorated text as its children.
1466
1466
  *
1467
+ * The component can render more than once for one decoration: the range
1468
+ * is split into segments at formatting boundaries and where it overlaps
1469
+ * other decorations, and each segment gets its own wrapper. Where
1470
+ * decorations overlap, their components nest, first in array order
1471
+ * outermost.
1472
+ *
1467
1473
  * @example
1468
1474
  * ```tsx
1469
1475
  * (rangeComponentProps: PropsWithChildren) => (
@@ -1901,6 +1907,7 @@ type OperationEvent = {
1901
1907
  type OperationListener = (event: OperationEvent) => void;
1902
1908
  type DecoratedRange = Range & {
1903
1909
  rangeDecoration: RangeDecoration;
1910
+ merge: (leaf: PortableTextSpan, decoration: object) => void;
1904
1911
  };
1905
1912
  type HistoryItem = {
1906
1913
  operations: EngineOperation[];
@@ -2143,6 +2150,15 @@ type EditorEmittedEvent = {
2143
2150
  */
2144
2151
  type: 'operation';
2145
2152
  operation: Operation;
2153
+ /**
2154
+ * Where the change that produced this operation came from:
2155
+ * `'local'` for changes made in this editor (edits, undo/redo),
2156
+ * `'remote'` for changes applied from the outside (`patches`,
2157
+ * `update value`, and the initial value sync). A normalization fix
2158
+ * (a repaired key, a merged span) reports the origin of the change
2159
+ * that triggered it.
2160
+ */
2161
+ origin: 'local' | 'remote';
2146
2162
  } | PatchEvent | {
2147
2163
  type: 'read only';
2148
2164
  } | {
@@ -2588,6 +2604,7 @@ declare const editorMachine: import("xstate").StateMachine<{
2588
2604
  } | {
2589
2605
  type: 'operation';
2590
2606
  operation: Operation;
2607
+ origin: 'local' | 'remote';
2591
2608
  } | {
2592
2609
  type: 'read only';
2593
2610
  } | {
@@ -3395,4 +3412,4 @@ type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (payload: {
3395
3412
  dom: EditorDom;
3396
3413
  }, guardResponse: TGuardResponse) => Array<BehaviorAction>;
3397
3414
  export { BehaviorGuard as $, defineBlockObject as $t, PortableTextSpan$1 as A, Annotation as At, usePortableTextEditor as B, DecoratorRender as Bt, ListDefinition as C, EditorSchema as Ct, PortableTextBlock$1 as D, RegisteredInlineObject as Dt, Patch$1 as E, RegisteredContainer as Et, defineSchema as F, BlockObjectRenderProps as Ft, Editor as G, RegistrableNode as Gt, useEditorSelector as H, InlineObject as Ht, BlockOffset as I, Container as It, EditorEmittedEvent as J, SpanRenderProps as Jt, EditorConfig as K, Span as Kt, useEditor as L, ContainerRender as Lt, SchemaDefinition$1 as M, AnnotationRenderProps as Mt, StyleDefinition as N, BlockObject as Nt, PortableTextChild$1 as O, RegisteredPositional as Ot, StyleSchemaType as P, BlockObjectRender as Pt, defineBehavior as Q, defineAnnotation as Qt, defaultKeyGenerator as R, ContainerRenderProps as Rt, InlineObjectSchemaType as S, Node$1 as St, OfDefinition$1 as T, RegisteredBlockObject as Tt, EditorProvider as U, InlineObjectRender as Ut, EditorSelector as V, DecoratorRenderProps as Vt, EditorProviderProps as W, InlineObjectRenderProps as Wt, Operation as X, TextBlockRender as Xt, MutationEvent as Y, TextBlock as Yt, Behavior as Z, TextBlockRenderProps as Zt, BlockObjectSchemaType as _, PortableTextEditable as _t, forward as a, AnnotationPath as an, EditorSelectionPoint as at, FieldDefinition$1 as b, PortableTextEditor as bt, CustomBehaviorEvent as c, KeyedSegment as cn, OnPasteFn as ct, SyntheticBehaviorEvent as d, PasteData as dt, defineContainer as en, EditorContext as et, PatchesEvent as f, RangeDecoration as ft, BlockObjectDefinition as g, ScrollSelectionIntoViewFunction as gt, BaseDefinition as h, RenderPlaceholderFunction as ht, execute as i, defineTextBlock as in, EditorSelection as it, PortableTextTextBlock$1 as j, AnnotationRender as jt, PortableTextObject$1 as k, RegisteredSpan as kt, InsertPlacement as l, Path as ln, OnPasteResult as lt, AnnotationSchemaType as m, RenderEditableFunction as mt, BehaviorActionSet as n, defineInlineObject as nn, AddedAnnotationPaths as nt, raise$1 as o, BlockPath as on, InvalidValueResolution as ot, AnnotationDefinition as p, RangeDecorationOnMovedDetails as pt, EditorEvent as q, SpanRender as qt, effect as r, defineSpan as rn, EditableAPIDeleteOptions as rt, BehaviorEvent as s, ChildPath as sn, OnCopyFn as st, BehaviorAction as t, defineDecorator as tn, EditorSnapshot as tt, NativeBehaviorEvent as u, PathSegment as un, OnPasteResultOrPromise as ut, DecoratorDefinition as v, PortableTextEditableProps as vt, ListSchemaType as w, Containers as wt, InlineObjectDefinition as x, TraversalSnapshot as xt, DecoratorSchemaType as y, HotkeyOptions as yt, usePortableTextEditorSelection as z, Decorator as zt };
3398
- //# sourceMappingURL=behavior.types.action-C6D8CCF9.d.ts.map
3415
+ //# sourceMappingURL=behavior.types.action-C0XDEQnB.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"behavior.types.action-C0XDEQnB.d.ts","names":[],"sources":["../src/internal-utils/mime-type.ts","../src/type-utils.ts","../src/converters/converter.types.ts","../src/types/paths.ts","../src/renderers/renderer.types.ts","../src/schema/container-types.ts","../src/editor/editor-schema.ts","../src/engine/interfaces/node.ts","../src/traversal/traversal-snapshot.ts","../src/editor/PortableTextEditor.tsx","../src/types/options.ts","../src/editor/Editable.tsx","../src/types/editor.ts","../src/engine/types/types.ts","../src/engine/interfaces/point.ts","../src/engine/interfaces/range.ts","../src/engine/interfaces/operation.ts","../src/engine/interfaces/range-ref.ts","../src/engine/dom/utils/diff-text.ts","../src/engine/dom/utils/dom.ts","../src/engine/dom/plugin/dom-editor.ts","../src/engine/interfaces/location.ts","../src/engine/interfaces/path-ref.ts","../src/engine/interfaces/point-ref.ts","../src/engine/interfaces/editor.ts","../src/engine/core/operation-channel.ts","../src/editor/range-decorations-machine.ts","../src/types/editor-engine.ts","../src/editor/editor-snapshot.ts","../src/behaviors/behavior.types.guard.ts","../src/behaviors/behavior.types.behavior.ts","../src/types/operation.ts","../src/editor/relay.ts","../src/editor.ts","../src/editor/editor-provider.tsx","../src/editor/editor-selector.ts","../src/editor/usePortableTextEditor.ts","../src/editor/usePortableTextEditorSelection.tsx","../src/utils/key-generator.ts","../src/editor/use-editor.ts","../src/types/block-offset.ts","../src/priority/priority.types.ts","../src/behaviors/behavior.config.ts","../src/editor/editor-machine.ts","../src/internal-utils/event-position.ts","../src/types/block-with-optional-key.ts","../src/behaviors/behavior.types.event.ts","../src/editor/editor-dom.ts","../src/behaviors/behavior.types.action.ts"],"mappings":";;;;KAAY;;;;KCGA,cACV,QACA,sBAAsB,QACtB,oBAAoB,OAAO,YACzB,eAAe,OAAO,SAAS,eAAe;KAWtC,eAAe,QAAQ,6BAA6B;EAC9D,YAAY;OAGP,WAAW,SAAS,sBACd,cAAc,wBACjB,OAAO;KAIL,cAAc,GAAG,UAAU,KAAK;KCvBhC,UAAU,kBAAkB,WAAW;EACjD,UAAU;EACV,WAAW,WAAW;EACtB,aAAa,aAAa;;KASvB,eAAe,kBAAkB,WAAW;EAE3C;EACA;;EAGA;EACA,UAAU;EACV;EACA;;EAGA;EACA;EACA,UAAU;EACV;;EAGA;EACA;;EAGA;EACA,UAAU;EACV;;EAGA;EACA,MAAM,MAAM;EACZ,UAAU;;KAGJ,WAAW,kBAAkB,eACvC,UACA;EAEA,UAAU;EACV,OAAO,cAAc,eAAe;MAChC,cACJ,eAAe;KAKL,aAAa,kBAAkB,eACzC,UACA;EAEA,UAAU;EACV,OAAO,cAAc,eAAe;MAChC,cACJ,eAAe;;;;;UChEA;EACf;;;;;;KAOU;;;;;;;;;KAUA,gCAAgC,eAAe;;;;;KAM/C,OAAO;;;;;;KAOP,YAAY;;;;;;KAOZ,iBAAiB;;;;;;KAOjB,YAAY;;;;;;;;;;;;KC7BZ;EACV,YAAY;EACZ,UAAU;EACV;EACA,MAAM;EACN,MAAM;EACN;EACA;;;;;;;;;;;;;;EAc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iBAClC,mBAAmB,6BACjB,cACE,uBAEA,4BAA4B,uBAGhC,2CAA2C,UACzC,oBAAoB,UAAU,SAC9B,2BAA2B,wBACzB,cAAc,uBAAuB;KAG1C,iBAAiB,wBACpB,uBAAuB,wBAAwB,YAAY;KC5xBjD;EACV,gBAAgB,UAAU,mBAAmB,MAAM;EACnD,gBAAgB,UAAU,mBAAmB,MAAM;EACnD,wBAAwB;;;;;EAKxB,mBAAmB,UAAU,mBAAmB;;;;;;;;EAQhD,wBAAwB;IACtB;IACA;QACI;EACN,uBAAuB,UAAU,mBAAmB;EACpD,qBAAqB,UAAU,mBAAmB;;;;;EAKlD,iBACE,OACA;IAEA,OAAO,cAAc;IACrB;MACE,SAAS;MACT;MACA;;;;;;;KCrCM;EAEN;EACA,OAAO;;EAGP;EACA,OAAO,sBAAsB,yBAAyB;;EAGtD;EACA,OAAO,yBAAyB;;EAGhC;EACA,SAAS;;;;;;;;;;;;;;;;;;;;;;;IAuBP,OAAO,OAAO;;;;;;;;;;;;;;;;;;;;iBAqBN,QACd,OAAO,yBACN,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyCD,QACd,OAAO,sBAAsB,yBAAyB,sBACrD,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCD,QACd,OAAO,yBAAyB,sBAC/B,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CD,OACd,QAAQ,cAAc,8CACrB,cAAc;;;;KAOL,kBAAkB,gBAAgB,mBAC5C;EACE,UAAU;EACV,OAAO;EACP,KAAK;GAEP,eAAe,mBACZ,MAAM"}
@@ -1,2 +1,2 @@
1
- import { $ as BehaviorGuard, Q as defineBehavior, Z as Behavior, a as forward, c as CustomBehaviorEvent, d as SyntheticBehaviorEvent, i as execute, l as InsertPlacement, n as BehaviorActionSet, o as raise, r as effect, s as BehaviorEvent, t as BehaviorAction, u as NativeBehaviorEvent } from "../behavior.types.action-C6D8CCF9.js";
1
+ import { $ as BehaviorGuard, Q as defineBehavior, Z as Behavior, a as forward, c as CustomBehaviorEvent, d as SyntheticBehaviorEvent, i as execute, l as InsertPlacement, n as BehaviorActionSet, o as raise, r as effect, s as BehaviorEvent, t as BehaviorAction, u as NativeBehaviorEvent } from "../behavior.types.action-C0XDEQnB.js";
2
2
  export { type Behavior, type BehaviorAction, type BehaviorActionSet, type BehaviorEvent, type BehaviorGuard, type CustomBehaviorEvent, type InsertPlacement, type NativeBehaviorEvent, type SyntheticBehaviorEvent, defineBehavior, effect, execute, forward, raise };
@@ -1,5 +1,5 @@
1
- import { i as getChildren, r as getNode, u as isKeyedSegment } from "./get-parent-Ci5241qs.js";
2
- import { C as getAncestors, _ as comparePoints, b as isEditableContainer, g as isAfterPoint, m as rangeEdges, r as comparePoints$1, u as getNodes, v as comparePaths, y as isObject$1 } from "./get-path-sub-schema-CZd9VcVM.js";
1
+ import { a as getChildren, d as isKeyedSegment, r as getNode } from "./get-parent-DgaKcy8-.js";
2
+ import { C as getAncestors, _ as comparePoints, b as isEditableContainer, g as isAfterPoint, m as rangeEdges, r as comparePoints$1, u as getNodes, v as comparePaths, y as isObject$1 } from "./get-path-sub-schema-Dd0QYZ0m.js";
3
3
  import { getSubSchema, isSpan, isTextBlock } from "@portabletext/schema";
4
4
  function getAncestor(snapshot, path, options) {
5
5
  let { match, mode = "lowest" } = options, ancestors = getAncestors(snapshot, path);
@@ -219,4 +219,4 @@ function getContainer(snapshot, path) {
219
219
  }
220
220
  export { getAncestor as _, getTextBlock as a, pathContains as c, isRange as d, isPoint as f, isLeafObject as g, getLeaf as h, getFirstChild as i, getSpan as l, isPath as m, getUnionSchema as n, rangeIntersects as o, isObject as p, getLastChild as r, isBeforePoint as s, getContainer as t, getText as u };
221
221
 
222
- //# sourceMappingURL=get-container-D1nM_ww9.js.map
222
+ //# sourceMappingURL=get-container-D2pN5Npr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-container-D1nM_ww9.js","names":[],"sources":["../src/traversal/get-ancestor.ts","../src/traversal/is-leaf-object.ts","../src/traversal/get-leaf.ts","../src/engine/path/is-path.ts","../src/engine/utils/is-object.ts","../src/engine/point/is-point.ts","../src/engine/range/is-range.ts","../src/traversal/get-text.ts","../src/traversal/get-span.ts","../src/traversal/path-contains.ts","../src/engine/point/is-before-point.ts","../src/traversal/range-intersects.ts","../src/traversal/get-text-block.ts","../src/traversal/get-first-child.ts","../src/traversal/get-last-child.ts","../src/traversal/get-union-schema.ts","../src/traversal/get-container.ts"],"sourcesContent":["import type {PortableTextBlock} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {getAncestors} from './get-ancestors'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Find an ancestor of the node at a given path that matches a predicate.\n * Does not check the node at the path itself, only its ancestors.\n *\n * `mode: 'lowest'` (default) returns the nearest matching ancestor.\n * `mode: 'highest'` returns the outermost matching ancestor.\n *\n * When `match` is a type predicate, the returned `node` narrows to that type.\n *\n * @public\n */\nexport function getAncestor<TMatch extends PortableTextBlock>(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {\n match: (node: PortableTextBlock, path: Path) => node is TMatch\n mode?: 'lowest' | 'highest'\n },\n): {node: TMatch; path: Path} | undefined\n/**\n * @public\n */\nexport function getAncestor(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {\n match: (node: PortableTextBlock, path: Path) => boolean\n mode?: 'lowest' | 'highest'\n },\n): {node: PortableTextBlock; path: Path} | undefined\nexport function getAncestor(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {\n match: (node: PortableTextBlock, path: Path) => boolean\n mode?: 'lowest' | 'highest'\n },\n): {node: PortableTextBlock; path: Path} | undefined {\n const {match, mode = 'lowest'} = options\n const ancestors = getAncestors(snapshot, path)\n\n if (mode === 'highest') {\n for (const ancestor of [...ancestors].reverse()) {\n if (match(ancestor.node, ancestor.path)) {\n return ancestor\n }\n }\n return undefined\n }\n\n for (const ancestor of ancestors) {\n if (match(ancestor.node, ancestor.path)) {\n return ancestor\n }\n }\n\n return undefined\n}\n","import type {PortableTextObject} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {isEditableContainer} from '../schema/is-editable-container'\nimport {isObject} from './is-object'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Check if a node is a leaf object: an object node that has no editable\n * children (not a container).\n * Returns true for block objects and inline objects that don't have\n * registered editable content (containers).\n *\n * @public\n */\nexport function isLeafObject(\n snapshot: TraversalSnapshot,\n node: unknown,\n path: Path,\n): node is PortableTextObject {\n return isObject(snapshot, node) && !isEditableContainer(snapshot, node, path)\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {getChildren} from './get-children'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the deepest leaf node starting from a path, walking toward either the\n * start or end edge. A leaf is any node that has no children according to the\n * traversal context.\n *\n * @public\n */\nexport function getLeaf(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {edge: 'start' | 'end'},\n): {node: Node; path: Path} | undefined {\n const {edge} = options\n\n let currentPath = path\n\n // If starting from root (empty path), descend into first/last child\n if (currentPath.length === 0) {\n const children = getChildren(snapshot, [])\n if (children.length === 0) {\n return undefined\n }\n const firstOrLast = edge === 'end' ? children.at(-1)! : children.at(0)!\n const nodeChildren = getChildren(snapshot, firstOrLast.path)\n if (nodeChildren.length === 0) {\n return firstOrLast\n }\n currentPath = firstOrLast.path\n } else {\n // Check if the node at path is already a leaf\n const entry = getNode(snapshot, currentPath)\n if (!entry) {\n return undefined\n }\n const children = getChildren(snapshot, currentPath)\n if (children.length === 0) {\n return entry\n }\n }\n\n // Descend to deepest leaf\n while (true) {\n const children = getChildren(snapshot, currentPath)\n if (children.length === 0) {\n const entry = getNode(snapshot, currentPath)\n return entry ?? undefined\n }\n const child = edge === 'end' ? children.at(-1)! : children.at(0)!\n currentPath = child.path\n }\n}\n","import {isKeyedSegment} from '../../utils/util.is-keyed-segment'\nimport type {Path} from '../interfaces/path'\n\nexport function isPath(value: any): value is Path {\n return (\n Array.isArray(value) &&\n (value.length === 0 ||\n typeof value[0] === 'number' ||\n typeof value[0] === 'string' ||\n isKeyedSegment(value[0]))\n )\n}\n","export const isObject = (value: any) =>\n typeof value === 'object' && value !== null\n","import type {Point} from '../interfaces/point'\nimport {isPath} from '../path/is-path'\nimport {isObject} from '../utils/is-object'\n\nexport function isPoint(value: any): value is Point {\n return (\n isObject(value) && typeof value.offset === 'number' && isPath(value.path)\n )\n}\n","import type {Range} from '../interfaces/range'\nimport {isPoint} from '../point/is-point'\nimport {isObject} from '../utils/is-object'\n\nexport function isRange(value: any): value is Range {\n return isObject(value) && isPoint(value.anchor) && isPoint(value.focus)\n}\n","import {isSpan} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {getNode} from './get-node'\nimport {getNodes} from './get-nodes'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the concatenated text content of the node at a given path.\n *\n * @public\n */\nexport function getText(\n snapshot: TraversalSnapshot,\n path: Path,\n): string | undefined {\n const entry = getNode(snapshot, path)\n\n if (!entry) {\n return undefined\n }\n\n if (isSpan({schema: snapshot.context.schema}, entry.node)) {\n return entry.node.text\n }\n\n let text = ''\n\n for (const descendant of getNodes(snapshot, {at: path})) {\n if (isSpan({schema: snapshot.context.schema}, descendant.node)) {\n text += descendant.node.text\n }\n }\n\n return text\n}\n","import {isSpan, type PortableTextSpan} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the span node at a given path.\n *\n * @public\n */\nexport function getSpan(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: PortableTextSpan; path: Path} | undefined {\n const entry = getNode(snapshot, path)\n\n if (!entry) {\n return undefined\n }\n\n if (!isSpan({schema: snapshot.context.schema}, entry.node)) {\n return undefined\n }\n\n return {node: entry.node, path: entry.path}\n}\n","import type {Path} from '../types/paths'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\n\n/**\n * Returns true if `ancestor` is equal to `descendant`, or if `descendant`\n * lives anywhere inside `ancestor`'s subtree.\n *\n * @public\n */\nexport function pathContains(ancestor: Path, descendant: Path): boolean {\n if (ancestor.length > descendant.length) {\n return false\n }\n\n for (let i = 0; i < ancestor.length; i++) {\n const segment = ancestor[i]\n const otherSegment = descendant[i]\n\n if (isKeyedSegment(segment) && isKeyedSegment(otherSegment)) {\n if (segment._key !== otherSegment._key) {\n return false\n }\n } else if (segment !== otherSegment) {\n return false\n }\n }\n\n return true\n}\n","import type {Node} from '../interfaces/node'\nimport type {Point} from '../interfaces/point'\nimport {comparePoints} from './compare-points'\n\nexport function isBeforePoint(\n point: Point,\n another: Point,\n root: {value: Array<Node>},\n): boolean {\n return comparePoints(point, another, root) === -1\n}\n","import {comparePaths} from '../engine/path/compare-paths'\nimport {isAfterPoint} from '../engine/point/is-after-point'\nimport {isBeforePoint} from '../engine/point/is-before-point'\nimport {isPoint} from '../engine/point/is-point'\nimport {isRange} from '../engine/range/is-range'\nimport {rangeEdges} from '../engine/range/range-edges'\nimport type {EditorSelection, EditorSelectionPoint} from '../types/editor'\nimport type {Path} from '../types/paths'\nimport {comparePoints} from './compare-points'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Returns true if `range` and the supplied `target` intersect. The target\n * may be a `Path`, an `EditorSelectionPoint`, or another\n * `EditorSelection`.\n *\n * For a `Path` or `EditorSelectionPoint` target, \"intersect\" means the\n * target lies at or between `range`'s start and end edges (inclusive).\n *\n * For an `EditorSelection` target, \"intersect\" means either endpoint of\n * `target` lies inside `range`, or `range` strictly encloses `target`.\n *\n * Pass `snapshot.context.selection` as `range` to ask the question against\n * the editor's current selection.\n *\n * Returns `false` when either `range` or `target` is `null`.\n *\n * @public\n */\nexport function rangeIntersects(\n snapshot: TraversalSnapshot,\n range: EditorSelection,\n target: Path | EditorSelectionPoint | EditorSelection,\n): boolean {\n if (!range || target === null) {\n return false\n }\n\n const root = {value: snapshot.context.value}\n\n if (isRange(target)) {\n if (\n rangeIntersects(snapshot, range, target.anchor) ||\n rangeIntersects(snapshot, range, target.focus)\n ) {\n return true\n }\n const [rs, re] = rangeEdges(range, root)\n const [ts, te] = rangeEdges(target, root)\n return isBeforePoint(rs, ts, root) && isAfterPoint(re, te, root)\n }\n\n const [start, end] = rangeEdges(range, root)\n let isAfterStart = false\n let isBeforeEnd = false\n\n if (isPoint(target)) {\n isAfterStart = comparePoints(snapshot, target, start) >= 0\n isBeforeEnd = comparePoints(snapshot, target, end) <= 0\n } else {\n isAfterStart = comparePaths(target, start.path, root) >= 0\n isBeforeEnd = comparePaths(target, end.path, root) <= 0\n }\n\n return isAfterStart && isBeforeEnd\n}\n","import {isTextBlock, type PortableTextTextBlock} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the text block node at a given path.\n *\n * @public\n */\nexport function getTextBlock(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: PortableTextTextBlock; path: Path} | undefined {\n const entry = getNode(snapshot, path)\n\n if (!entry) {\n return undefined\n }\n\n if (!isTextBlock({schema: snapshot.context.schema}, entry.node)) {\n return undefined\n }\n\n return {node: entry.node, path: entry.path}\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {getChildren} from './get-children'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the first child of a node at a given path.\n *\n * @public\n */\nexport function getFirstChild(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: Node; path: Path} | undefined {\n return getChildren(snapshot, path).at(0)\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {getChildren} from './get-children'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the last child of a node at a given path.\n *\n * @public\n */\nexport function getLastChild(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: Node; path: Path} | undefined {\n const children = getChildren(snapshot, path)\n\n return children.at(-1)\n}\n","import {getSubSchema, type Schema} from '@portabletext/schema'\nimport type {Containers} from '../schema/resolve-containers'\n\n/**\n * Return a `Schema` that contains every named member declared anywhere\n * in the editor's schema graph that is reachable from a position where text\n * is edited - the root schema merged with the sub-schema of every registered\n * container whose field accepts text blocks, deduped by name. Useful for\n * rendering a static toolbar whose buttons stay stable across selection\n * moves while still reflecting everything that could plausibly be edited or\n * inserted somewhere.\n *\n * Containers whose field does NOT accept text blocks (e.g. a `table`\n * container whose `rows` field only accepts `row` objects, or a `row`\n * container whose `cells` field only accepts `cell` objects) are\n * **structural**: their immediate `of` types are organizational, not\n * insertable user content. Those structural types are excluded from the\n * union. Their nested text-block-accepting descendants (e.g. a `cell`\n * that contains a `content` field of `{type: 'block'}`) are reached via\n * those descendants' own container registration.\n *\n * Pair with `getPathSubSchema` (or a path-based intersection across a\n * range) to determine which of the union's members are applicable at the\n * current selection.\n *\n * @public\n */\nexport function getUnionSchema(schema: Schema, containers: Containers): Schema {\n const decorators = mergeByName(schema.decorators, [])\n const annotations = mergeByName(schema.annotations, [])\n const lists = mergeByName(schema.lists, [])\n const styles = mergeByName(schema.styles, [])\n const inlineObjects = mergeByName(schema.inlineObjects, [])\n const blockObjects = mergeByName(schema.blockObjects, [])\n\n for (const container of containers.values()) {\n if (!acceptsTextBlock(container.field.of, schema.block.name)) {\n continue\n }\n const sub = getSubSchema(schema, container.field.of)\n mergeByName(sub.decorators, decorators)\n mergeByName(sub.annotations, annotations)\n mergeByName(sub.lists, lists)\n mergeByName(sub.styles, styles)\n mergeByName(sub.inlineObjects, inlineObjects)\n mergeByName(sub.blockObjects, blockObjects)\n }\n\n return {\n ...schema,\n decorators,\n annotations,\n lists,\n styles,\n inlineObjects,\n blockObjects,\n }\n}\n\nfunction acceptsTextBlock(\n of: ReadonlyArray<{type: string}>,\n blockName: string,\n): boolean {\n return of.some(\n (member) => member.type === 'block' || member.type === blockName,\n )\n}\n\nfunction mergeByName<T extends {name: string}>(\n source: ReadonlyArray<T>,\n target: Array<T>,\n): Array<T> {\n for (const entry of source) {\n if (target.some((existing) => existing.name === entry.name)) {\n continue\n }\n target.push(entry)\n }\n return target\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {isEditableContainer} from '../schema/is-editable-container'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the registered editable container at a given path.\n *\n * @public\n */\nexport function getContainer(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: Node; path: Path} | undefined {\n const entry = getNode(snapshot, path)\n\n if (!entry) {\n return undefined\n }\n\n if (!isEditableContainer(snapshot, entry.node, entry.path)) {\n return undefined\n }\n\n return {node: entry.node, path: entry.path}\n}\n"],"mappings":";;;AAmCA,SAAgB,YACd,UACA,MACA,SAImD;CACnD,IAAM,EAAC,OAAO,OAAO,aAAY,SAC3B,YAAY,aAAa,UAAU,IAAI;CAE7C,IAAI,SAAS,WAAW;EACtB,KAAK,IAAM,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,QAAQ,GAC5C,IAAI,MAAM,SAAS,MAAM,SAAS,IAAI,GACpC,OAAO;EAGX;CACF;CAEA,KAAK,IAAM,YAAY,WACrB,IAAI,MAAM,SAAS,MAAM,SAAS,IAAI,GACpC,OAAO;AAKb;;;;;;;;;AChDA,SAAgB,aACd,UACA,MACA,MAC4B;CAC5B,OAAO,WAAS,UAAU,IAAI,KAAK,CAAC,oBAAoB,UAAU,MAAM,IAAI;AAC9E;;;;;;;;ACPA,SAAgB,QACd,UACA,MACA,SACsC;CACtC,IAAM,EAAC,SAAQ,SAEX,cAAc;CAGlB,IAAI,YAAY,WAAW,GAAG;EAC5B,IAAM,WAAW,YAAY,UAAU,CAAC,CAAC;EACz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AQ,MAAM,GAC9B,YAAY,IAAI,eAAe,aAAa,GAC5C,YAAY,IAAI,cAAc,YAAY;CAC5C;CAEA,OAAO;EACL,GAAG;EACH;EACA;EACA;EACA;EACA;EACA;CACF;AACF;AAEA,SAAS,iBACP,IACA,WACS;CACT,OAAO,GAAG,MACP,WAAW,OAAO,SAAS,WAAW,OAAO,SAAS,SACzD;AACF;AAEA,SAAS,YACP,QACA,QACU;CACV,KAAK,IAAM,SAAS,QACd,OAAO,MAAM,aAAa,SAAS,SAAS,MAAM,IAAI,KAG1D,OAAO,KAAK,KAAK;CAEnB,OAAO;AACT;;;;;;ACpEA,SAAgB,aACd,UACA,MACsC;CACtC,IAAM,QAAQ,QAAQ,UAAU,IAAI;CAE/B,aAIA,oBAAoB,UAAU,MAAM,MAAM,MAAM,IAAI,GAIzD,OAAO;EAAC,MAAM,MAAM;EAAM,MAAM,MAAM;CAAI;AAC5C"}
1
+ {"version":3,"file":"get-container-D2pN5Npr.js","names":[],"sources":["../src/traversal/get-ancestor.ts","../src/traversal/is-leaf-object.ts","../src/traversal/get-leaf.ts","../src/engine/path/is-path.ts","../src/engine/utils/is-object.ts","../src/engine/point/is-point.ts","../src/engine/range/is-range.ts","../src/traversal/get-text.ts","../src/traversal/get-span.ts","../src/traversal/path-contains.ts","../src/engine/point/is-before-point.ts","../src/traversal/range-intersects.ts","../src/traversal/get-text-block.ts","../src/traversal/get-first-child.ts","../src/traversal/get-last-child.ts","../src/traversal/get-union-schema.ts","../src/traversal/get-container.ts"],"sourcesContent":["import type {PortableTextBlock} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {getAncestors} from './get-ancestors'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Find an ancestor of the node at a given path that matches a predicate.\n * Does not check the node at the path itself, only its ancestors.\n *\n * `mode: 'lowest'` (default) returns the nearest matching ancestor.\n * `mode: 'highest'` returns the outermost matching ancestor.\n *\n * When `match` is a type predicate, the returned `node` narrows to that type.\n *\n * @public\n */\nexport function getAncestor<TMatch extends PortableTextBlock>(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {\n match: (node: PortableTextBlock, path: Path) => node is TMatch\n mode?: 'lowest' | 'highest'\n },\n): {node: TMatch; path: Path} | undefined\n/**\n * @public\n */\nexport function getAncestor(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {\n match: (node: PortableTextBlock, path: Path) => boolean\n mode?: 'lowest' | 'highest'\n },\n): {node: PortableTextBlock; path: Path} | undefined\nexport function getAncestor(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {\n match: (node: PortableTextBlock, path: Path) => boolean\n mode?: 'lowest' | 'highest'\n },\n): {node: PortableTextBlock; path: Path} | undefined {\n const {match, mode = 'lowest'} = options\n const ancestors = getAncestors(snapshot, path)\n\n if (mode === 'highest') {\n for (const ancestor of [...ancestors].reverse()) {\n if (match(ancestor.node, ancestor.path)) {\n return ancestor\n }\n }\n return undefined\n }\n\n for (const ancestor of ancestors) {\n if (match(ancestor.node, ancestor.path)) {\n return ancestor\n }\n }\n\n return undefined\n}\n","import type {PortableTextObject} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {isEditableContainer} from '../schema/is-editable-container'\nimport {isObject} from './is-object'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Check if a node is a leaf object: an object node that has no editable\n * children (not a container).\n * Returns true for block objects and inline objects that don't have\n * registered editable content (containers).\n *\n * @public\n */\nexport function isLeafObject(\n snapshot: TraversalSnapshot,\n node: unknown,\n path: Path,\n): node is PortableTextObject {\n return isObject(snapshot, node) && !isEditableContainer(snapshot, node, path)\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {getChildren} from './get-children'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the deepest leaf node starting from a path, walking toward either the\n * start or end edge. A leaf is any node that has no children according to the\n * traversal context.\n *\n * @public\n */\nexport function getLeaf(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {edge: 'start' | 'end'},\n): {node: Node; path: Path} | undefined {\n const {edge} = options\n\n let currentPath = path\n\n // If starting from root (empty path), descend into first/last child\n if (currentPath.length === 0) {\n const children = getChildren(snapshot, [])\n if (children.length === 0) {\n return undefined\n }\n const firstOrLast = edge === 'end' ? children.at(-1)! : children.at(0)!\n const nodeChildren = getChildren(snapshot, firstOrLast.path)\n if (nodeChildren.length === 0) {\n return firstOrLast\n }\n currentPath = firstOrLast.path\n } else {\n // Check if the node at path is already a leaf\n const entry = getNode(snapshot, currentPath)\n if (!entry) {\n return undefined\n }\n const children = getChildren(snapshot, currentPath)\n if (children.length === 0) {\n return entry\n }\n }\n\n // Descend to deepest leaf\n while (true) {\n const children = getChildren(snapshot, currentPath)\n if (children.length === 0) {\n const entry = getNode(snapshot, currentPath)\n return entry ?? undefined\n }\n const child = edge === 'end' ? children.at(-1)! : children.at(0)!\n currentPath = child.path\n }\n}\n","import {isKeyedSegment} from '../../utils/util.is-keyed-segment'\nimport type {Path} from '../interfaces/path'\n\nexport function isPath(value: any): value is Path {\n return (\n Array.isArray(value) &&\n (value.length === 0 ||\n typeof value[0] === 'number' ||\n typeof value[0] === 'string' ||\n isKeyedSegment(value[0]))\n )\n}\n","export const isObject = (value: any) =>\n typeof value === 'object' && value !== null\n","import type {Point} from '../interfaces/point'\nimport {isPath} from '../path/is-path'\nimport {isObject} from '../utils/is-object'\n\nexport function isPoint(value: any): value is Point {\n return (\n isObject(value) && typeof value.offset === 'number' && isPath(value.path)\n )\n}\n","import type {Range} from '../interfaces/range'\nimport {isPoint} from '../point/is-point'\nimport {isObject} from '../utils/is-object'\n\nexport function isRange(value: any): value is Range {\n return isObject(value) && isPoint(value.anchor) && isPoint(value.focus)\n}\n","import {isSpan} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {getNode} from './get-node'\nimport {getNodes} from './get-nodes'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the concatenated text content of the node at a given path.\n *\n * @public\n */\nexport function getText(\n snapshot: TraversalSnapshot,\n path: Path,\n): string | undefined {\n const entry = getNode(snapshot, path)\n\n if (!entry) {\n return undefined\n }\n\n if (isSpan({schema: snapshot.context.schema}, entry.node)) {\n return entry.node.text\n }\n\n let text = ''\n\n for (const descendant of getNodes(snapshot, {at: path})) {\n if (isSpan({schema: snapshot.context.schema}, descendant.node)) {\n text += descendant.node.text\n }\n }\n\n return text\n}\n","import {isSpan, type PortableTextSpan} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the span node at a given path.\n *\n * @public\n */\nexport function getSpan(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: PortableTextSpan; path: Path} | undefined {\n const entry = getNode(snapshot, path)\n\n if (!entry) {\n return undefined\n }\n\n if (!isSpan({schema: snapshot.context.schema}, entry.node)) {\n return undefined\n }\n\n return {node: entry.node, path: entry.path}\n}\n","import type {Path} from '../types/paths'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\n\n/**\n * Returns true if `ancestor` is equal to `descendant`, or if `descendant`\n * lives anywhere inside `ancestor`'s subtree.\n *\n * @public\n */\nexport function pathContains(ancestor: Path, descendant: Path): boolean {\n if (ancestor.length > descendant.length) {\n return false\n }\n\n for (let i = 0; i < ancestor.length; i++) {\n const segment = ancestor[i]\n const otherSegment = descendant[i]\n\n if (isKeyedSegment(segment) && isKeyedSegment(otherSegment)) {\n if (segment._key !== otherSegment._key) {\n return false\n }\n } else if (segment !== otherSegment) {\n return false\n }\n }\n\n return true\n}\n","import type {Node} from '../interfaces/node'\nimport type {Point} from '../interfaces/point'\nimport {comparePoints} from './compare-points'\n\nexport function isBeforePoint(\n point: Point,\n another: Point,\n root: {value: Array<Node>},\n): boolean {\n return comparePoints(point, another, root) === -1\n}\n","import {comparePaths} from '../engine/path/compare-paths'\nimport {isAfterPoint} from '../engine/point/is-after-point'\nimport {isBeforePoint} from '../engine/point/is-before-point'\nimport {isPoint} from '../engine/point/is-point'\nimport {isRange} from '../engine/range/is-range'\nimport {rangeEdges} from '../engine/range/range-edges'\nimport type {EditorSelection, EditorSelectionPoint} from '../types/editor'\nimport type {Path} from '../types/paths'\nimport {comparePoints} from './compare-points'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Returns true if `range` and the supplied `target` intersect. The target\n * may be a `Path`, an `EditorSelectionPoint`, or another\n * `EditorSelection`.\n *\n * For a `Path` or `EditorSelectionPoint` target, \"intersect\" means the\n * target lies at or between `range`'s start and end edges (inclusive).\n *\n * For an `EditorSelection` target, \"intersect\" means either endpoint of\n * `target` lies inside `range`, or `range` strictly encloses `target`.\n *\n * Pass `snapshot.context.selection` as `range` to ask the question against\n * the editor's current selection.\n *\n * Returns `false` when either `range` or `target` is `null`.\n *\n * @public\n */\nexport function rangeIntersects(\n snapshot: TraversalSnapshot,\n range: EditorSelection,\n target: Path | EditorSelectionPoint | EditorSelection,\n): boolean {\n if (!range || target === null) {\n return false\n }\n\n const root = {value: snapshot.context.value}\n\n if (isRange(target)) {\n if (\n rangeIntersects(snapshot, range, target.anchor) ||\n rangeIntersects(snapshot, range, target.focus)\n ) {\n return true\n }\n const [rs, re] = rangeEdges(range, root)\n const [ts, te] = rangeEdges(target, root)\n return isBeforePoint(rs, ts, root) && isAfterPoint(re, te, root)\n }\n\n const [start, end] = rangeEdges(range, root)\n let isAfterStart = false\n let isBeforeEnd = false\n\n if (isPoint(target)) {\n isAfterStart = comparePoints(snapshot, target, start) >= 0\n isBeforeEnd = comparePoints(snapshot, target, end) <= 0\n } else {\n isAfterStart = comparePaths(target, start.path, root) >= 0\n isBeforeEnd = comparePaths(target, end.path, root) <= 0\n }\n\n return isAfterStart && isBeforeEnd\n}\n","import {isTextBlock, type PortableTextTextBlock} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the text block node at a given path.\n *\n * @public\n */\nexport function getTextBlock(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: PortableTextTextBlock; path: Path} | undefined {\n const entry = getNode(snapshot, path)\n\n if (!entry) {\n return undefined\n }\n\n if (!isTextBlock({schema: snapshot.context.schema}, entry.node)) {\n return undefined\n }\n\n return {node: entry.node, path: entry.path}\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {getChildren} from './get-children'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the first child of a node at a given path.\n *\n * @public\n */\nexport function getFirstChild(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: Node; path: Path} | undefined {\n return getChildren(snapshot, path).at(0)\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {getChildren} from './get-children'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the last child of a node at a given path.\n *\n * @public\n */\nexport function getLastChild(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: Node; path: Path} | undefined {\n const children = getChildren(snapshot, path)\n\n return children.at(-1)\n}\n","import {getSubSchema, type Schema} from '@portabletext/schema'\nimport type {Containers} from '../schema/resolve-containers'\n\n/**\n * Return a `Schema` that contains every named member declared anywhere\n * in the editor's schema graph that is reachable from a position where text\n * is edited - the root schema merged with the sub-schema of every registered\n * container whose field accepts text blocks, deduped by name. Useful for\n * rendering a static toolbar whose buttons stay stable across selection\n * moves while still reflecting everything that could plausibly be edited or\n * inserted somewhere.\n *\n * Containers whose field does NOT accept text blocks (e.g. a `table`\n * container whose `rows` field only accepts `row` objects, or a `row`\n * container whose `cells` field only accepts `cell` objects) are\n * **structural**: their immediate `of` types are organizational, not\n * insertable user content. Those structural types are excluded from the\n * union. Their nested text-block-accepting descendants (e.g. a `cell`\n * that contains a `content` field of `{type: 'block'}`) are reached via\n * those descendants' own container registration.\n *\n * Pair with `getPathSubSchema` (or a path-based intersection across a\n * range) to determine which of the union's members are applicable at the\n * current selection.\n *\n * @public\n */\nexport function getUnionSchema(schema: Schema, containers: Containers): Schema {\n const decorators = mergeByName(schema.decorators, [])\n const annotations = mergeByName(schema.annotations, [])\n const lists = mergeByName(schema.lists, [])\n const styles = mergeByName(schema.styles, [])\n const inlineObjects = mergeByName(schema.inlineObjects, [])\n const blockObjects = mergeByName(schema.blockObjects, [])\n\n for (const container of containers.values()) {\n if (!acceptsTextBlock(container.field.of, schema.block.name)) {\n continue\n }\n const sub = getSubSchema(schema, container.field.of)\n mergeByName(sub.decorators, decorators)\n mergeByName(sub.annotations, annotations)\n mergeByName(sub.lists, lists)\n mergeByName(sub.styles, styles)\n mergeByName(sub.inlineObjects, inlineObjects)\n mergeByName(sub.blockObjects, blockObjects)\n }\n\n return {\n ...schema,\n decorators,\n annotations,\n lists,\n styles,\n inlineObjects,\n blockObjects,\n }\n}\n\nfunction acceptsTextBlock(\n of: ReadonlyArray<{type: string}>,\n blockName: string,\n): boolean {\n return of.some(\n (member) => member.type === 'block' || member.type === blockName,\n )\n}\n\nfunction mergeByName<T extends {name: string}>(\n source: ReadonlyArray<T>,\n target: Array<T>,\n): Array<T> {\n for (const entry of source) {\n if (target.some((existing) => existing.name === entry.name)) {\n continue\n }\n target.push(entry)\n }\n return target\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {isEditableContainer} from '../schema/is-editable-container'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the registered editable container at a given path.\n *\n * @public\n */\nexport function getContainer(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: Node; path: Path} | undefined {\n const entry = getNode(snapshot, path)\n\n if (!entry) {\n return undefined\n }\n\n if (!isEditableContainer(snapshot, entry.node, entry.path)) {\n return undefined\n }\n\n return {node: entry.node, path: entry.path}\n}\n"],"mappings":";;;AAmCA,SAAgB,YAC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
157
  function getNode(snapshot, path) {
158
- if (path.length === 0) return;
158
+ let result = resolveNode(snapshot, path);
159
+ return result.status === "found" ? result.entry : void 0;
160
+ }
161
+ function resolveNode(snapshot, path) {
162
+ if (path.length === 0) return { status: "missing" };
159
163
  let { context, blockIndexMap } = snapshot, currentChildren = context.value, currentFieldName, node, currentParent, resolvedPath = [];
160
164
  for (let i = 0; i < path.length; i++) {
161
165
  let segment = path[i];
@@ -166,7 +170,7 @@ function getNode(snapshot, path) {
166
170
  }
167
171
  for (let j = i + 1; j < path.length; j++) {
168
172
  let s = path[j];
169
- if (isKeyedSegment(s) || typeof s == "number") return;
173
+ if (isKeyedSegment(s) || typeof s == "number") return { status: "unreachable" };
170
174
  }
171
175
  break;
172
176
  }
@@ -175,8 +179,8 @@ function getNode(snapshot, path) {
175
179
  let index = blockIndexMap.get(serializePath(resolvedPath));
176
180
  index !== void 0 && currentChildren[index]?._key === segment._key ? node = currentChildren[index] : (node = currentChildren.find((child) => child._key === segment._key), node && node._key !== void 0 && (resolvedPath[resolvedPath.length - 1] = { _key: node._key }));
177
181
  } else if (typeof segment == "number") node = currentChildren.at(segment), node && resolvedPath.push({ _key: node._key });
178
- else return;
179
- if (!node) return;
182
+ else return { status: "missing" };
183
+ if (!node) return { status: "missing" };
180
184
  let hasMoreSegments = !1;
181
185
  for (let j = i + 1; j < path.length; j++) {
182
186
  let s = path[j];
@@ -187,17 +191,19 @@ function getNode(snapshot, path) {
187
191
  }
188
192
  if (hasMoreSegments) {
189
193
  let next = getNodeChildren(context, node, currentParent);
190
- if (!next) return;
194
+ if (!next) return { status: "missing" };
191
195
  currentChildren = next.children, currentFieldName = next.fieldName, currentParent = next.parent;
192
196
  } else currentFieldName = void 0;
193
197
  }
194
- if (node) {
195
- for (; resolvedPath.length > 0 && typeof resolvedPath[resolvedPath.length - 1] == "string";) resolvedPath.pop();
196
- return {
198
+ if (!node) return { status: "missing" };
199
+ for (; resolvedPath.length > 0 && typeof resolvedPath[resolvedPath.length - 1] == "string";) resolvedPath.pop();
200
+ return {
201
+ status: "found",
202
+ entry: {
197
203
  node,
198
204
  path: resolvedPath
199
- };
200
- }
205
+ }
206
+ };
201
207
  }
202
208
  /**
203
209
  * Get the parent path of a path.
@@ -232,6 +238,6 @@ function getParent(snapshot, path, options) {
232
238
  };
233
239
  if (!(options?.match && !options.match(result.node, result.path))) return result;
234
240
  }
235
- export { getNodeChildren as a, isTypedObject as c, getChildren as i, serializePath as l, parentPath as n, getContainerChildren as o, getNode as r, isRecord as s, getParent as t, isKeyedSegment as u };
241
+ export { getChildren as a, isRecord as c, isKeyedSegment as d, resolveNode as i, isTypedObject as l, parentPath as n, getNodeChildren as o, getNode as r, getContainerChildren as s, getParent as t, serializePath as u };
236
242
 
237
- //# sourceMappingURL=get-parent-Ci5241qs.js.map
243
+ //# sourceMappingURL=get-parent-DgaKcy8-.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-parent-DgaKcy8-.js","names":[],"sources":["../src/utils/util.is-keyed-segment.ts","../src/paths/serialize-path.ts","../src/utils/asserters.ts","../src/traversal/get-container-children.ts","../src/traversal/get-children.ts","../src/traversal/get-node.ts","../src/engine/path/parent-path.ts","../src/traversal/get-parent.ts"],"sourcesContent":["import type {KeyedSegment} from '../types/paths'\n\n/**\n * @public\n */\nexport function isKeyedSegment(segment: unknown): segment is KeyedSegment {\n return typeof segment === 'object' && segment !== null && '_key' in segment\n}\n","import type {Path} from '../types/paths'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\n\n/**\n * Serialize a keyed path to a string using Sanity's bracket notation.\n *\n * - `[{_key: 'k0'}]` -> `[_key==\"k0\"]`\n * - `[{_key: 'k0'}, 'children', {_key: 's0'}]` -> `[_key==\"k0\"].children[_key==\"s0\"]`\n * - `[{_key: 't0'}, 'rows', {_key: 'r0'}, 'cells', {_key: 'c0'}, 'content', {_key: 'b0'}, 'children', {_key: 's0'}]` -> `[_key==\"t0\"].rows[_key==\"r0\"].cells[_key==\"c0\"].content[_key==\"b0\"].children[_key==\"s0\"]`\n */\nexport function serializePath(path: Path): string {\n return path.reduce<string>((result, segment, index) => {\n if (isKeyedSegment(segment)) {\n return `${result}[_key==\"${segment._key}\"]`\n }\n\n const separator = index === 0 ? '' : '.'\n return `${result}${separator}${segment}`\n }, '')\n}\n","import type {TypedObject} from '@portabletext/schema'\n\nexport function isTypedObject(object: unknown): object is TypedObject {\n return isRecord(object) && typeof object['_type'] === 'string'\n}\n\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return !!value && (typeof value === 'object' || typeof value === 'function')\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {\n Containers,\n RegisteredContainer,\n} from '../schema/resolve-containers'\n\n/**\n * Resolve a container node's editable child array.\n *\n * Returns `{children, container}` for a node registered as a container:\n * `children` is the node's editable child array, and `container` is the\n * node's own container registration. Read `container.field.name` for the\n * path segment that reaches `children`, and thread `container` back in as\n * `parent` when descending into them.\n *\n * Returns `undefined` for anything that is not a container: text blocks,\n * spans, leaves, and unregistered objects. It is node-based and resolves\n * in one step with no path re-walk, so recursive descent over containers\n * is linear in nesting depth. The caller seeds the document root from\n * `context.value` itself.\n *\n * @beta\n */\nexport function getContainerChildren(\n containers: Containers,\n node: Node,\n parent?: RegisteredContainer,\n):\n | {\n children: Array<Node>\n container: RegisteredContainer\n }\n | undefined {\n const resolved = resolveNodeContainer(containers, parent, node)\n\n if (!resolved) {\n return undefined\n }\n\n const fieldValue = (node as Record<string, unknown>)[resolved.field.name]\n\n if (!Array.isArray(fieldValue)) {\n return undefined\n }\n\n return {\n children: fieldValue as Array<Node>,\n container: resolved,\n }\n}\n\n/**\n * Pick the positional override from `parent.of` if present; fall back\n * to the top-level entry. Returns only `RegisteredContainer` entries\n * since leaves do not have editable children.\n */\nfunction resolveNodeContainer(\n containers: Containers,\n parent: RegisteredContainer | undefined,\n node: Node,\n): RegisteredContainer | undefined {\n if (parent?.of) {\n for (const entry of parent.of) {\n if (entry.type === node._type) {\n // Only return container entries; leaves have no editable children.\n if ('field' in entry) {\n return entry\n }\n return undefined\n }\n }\n }\n return containers.get(node._type)\n}\n","import {isTextBlock} from '@portabletext/schema'\nimport type {EditorSchema} from '../editor/editor-schema'\nimport type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {serializePath} from '../paths/serialize-path'\nimport type {\n Containers,\n RegisteredContainer,\n} from '../schema/resolve-containers'\nimport {isTypedObject} from '../utils/asserters'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\nimport {getContainerChildren} from './get-container-children'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the children of a node at a given path.\n *\n * @public\n */\nexport function getChildren(\n snapshot: TraversalSnapshot,\n path: Path,\n): Array<{node: Node; path: Path}> {\n let currentChildren: Array<Node> = snapshot.context.value\n let currentFieldName = 'value'\n let currentPath: Path = []\n let isRoot = true\n let currentParent: RegisteredContainer | undefined\n\n for (const segment of path) {\n if (typeof segment === 'string') {\n continue\n }\n\n let node: Node | undefined\n if (isKeyedSegment(segment)) {\n // Resolve via `blockIndexMap` (O(1)) and fall back to a linear scan on a\n // miss or when the snapshot's map disagrees with the value, mirroring\n // `getNode`. The candidate path is this segment's full keyed path.\n const candidatePath: Path = isRoot\n ? [{_key: segment._key}]\n : [...currentPath, currentFieldName, {_key: segment._key}]\n const index = snapshot.blockIndexMap.get(serializePath(candidatePath))\n node =\n index !== undefined && currentChildren[index]?._key === segment._key\n ? currentChildren[index]\n : currentChildren.find((child) => child._key === segment._key)\n } else if (typeof segment === 'number') {\n node = currentChildren.at(segment)\n }\n\n if (!node) {\n return []\n }\n\n currentPath = isRoot\n ? [{_key: node._key}]\n : [...currentPath, currentFieldName, {_key: node._key}]\n isRoot = false\n\n const next = getNodeChildren(snapshot.context, node, currentParent)\n\n if (!next) {\n return []\n }\n\n currentChildren = next.children\n currentFieldName = next.fieldName\n currentParent = next.parent\n }\n\n return currentChildren.map((child) => ({\n node: child,\n path: isRoot\n ? [{_key: child._key}]\n : [...currentPath, currentFieldName, {_key: child._key}],\n }))\n}\n\n/**\n * Resolve a node's editable child array.\n *\n * When `parent` is provided and its `of` declares a positional entry\n * matching `node._type`, that positional entry's `field` is used.\n * Otherwise the top-level `containers.get(node._type)` provides the\n * fallback.\n *\n * The returned `parent` is the resolved container entry for `node`\n * itself (used by the caller to thread further descent).\n *\n * Internal descent kernel shared by the positional traversal utilities\n * (`getChildren`, `getNode`, `getNodes`, `getAncestors`); it folds the\n * text-block, container, and root-document cases. Public consumers that\n * only need to descend containers use {@link getContainerChildren}.\n */\nexport function getNodeChildren(\n context: {\n schema: EditorSchema\n containers: Containers\n },\n node: Node | {value: Array<Node>},\n parent?: RegisteredContainer,\n):\n | {\n children: Array<Node>\n fieldName: string\n parent: RegisteredContainer | undefined\n }\n | undefined {\n // Text blocks store children in .children\n if (isTextBlock(context, node)) {\n return {\n children: node.children,\n fieldName: 'children',\n parent: undefined,\n }\n }\n\n if (isTypedObject(node)) {\n const result = getContainerChildren(context.containers, node, parent)\n\n if (result) {\n return {\n children: result.children,\n fieldName: result.container.field.name,\n parent: result.container,\n }\n }\n }\n\n // Root context: has .value array but no _key or _type\n if (\n 'value' in node &&\n Array.isArray(node['value']) &&\n !('_key' in node) &&\n !('_type' in node)\n ) {\n return {\n children: node['value'] as Array<Node>,\n fieldName: 'value',\n parent: undefined,\n }\n }\n\n return undefined\n}\n","import type {Node} from '../engine/interfaces/node'\nimport type {Path} from '../engine/interfaces/path'\nimport {serializePath} from '../paths/serialize-path'\nimport type {RegisteredContainer} from '../schema/resolve-containers'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\nimport {getNodeChildren} from './get-children'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the node at a given path.\n *\n * The path can be either keyed (KeyedSegment + field name strings) or\n * indexed (numbers). Keyed segments are resolved by matching `_key`,\n * field name strings name a structural descent into the previous\n * node's children, and numbers are resolved by index.\n *\n * The returned `path` always identifies the returned node: it's fully\n * keyed (numeric indices are converted to `KeyedSegment`s) and any\n * trailing segments in the input that point outside the value tree —\n * e.g. an object node's primitive field, or an annotation reached via\n * `'markDefs'` on a text block — are stripped so that\n * `getNode(snapshot, entry.path).node === entry.node`.\n *\n * The walk stops when a string segment names a field that isn't the\n * current node's structural child array. Annotations live in\n * `markDefs` on a text block, alongside `children` rather than inside\n * it, so `getNode` resolves an annotation path to the enclosing text\n * block. Use `getAnnotation` to resolve the annotation itself.\n *\n * @public\n */\nexport function getNode(\n snapshot: TraversalSnapshot,\n path: Path,\n): {node: Node; path: Path} | undefined {\n const result = resolveNode(snapshot, path)\n return result.status === 'found' ? result.entry : undefined\n}\n\n/**\n * Result of walking a path against a snapshot.\n *\n * `unreachable` is the one outcome that means \"structurally impossible\n * by design\": the path digs past a sidecar field (e.g. `markDefs` on\n * a text block) into a keyed/indexed segment, which `getNode` can\n * never resolve (use `getAnnotation` for annotations). Every other\n * negative outcome is `missing`; on those branches a caller bug and a\n * benign race (the node removed by a concurrent edit) produce the\n * same state, so they cannot be told apart.\n */\nexport type ResolveNodeResult =\n | {status: 'found'; entry: {node: Node; path: Path}}\n | {status: 'missing'}\n | {status: 'unreachable'}\n\nexport function resolveNode(\n snapshot: TraversalSnapshot,\n path: Path,\n): ResolveNodeResult {\n if (path.length === 0) {\n return {status: 'missing'}\n }\n\n const {context, blockIndexMap} = snapshot\n let currentChildren: Array<Node> = context.value\n let currentFieldName: string | undefined\n let node: Node | undefined\n let currentParent: RegisteredContainer | undefined\n const resolvedPath: Path = []\n\n for (let i = 0; i < path.length; i++) {\n const segment = path[i]\n\n if (typeof segment === 'string') {\n // A string segment names a structural descent. If it matches the\n // field name produced by the previous node's `getNodeChildren`,\n // it's part of the value-tree descent — push it and continue.\n // Otherwise the string names a sidecar field (markDefs on a text\n // block, a primitive field on an object). If the input keeps\n // digging past it with more keyed/numeric segments, the caller\n // wanted a node inside the sidecar and `getNode` can't reach it\n // (use `getAnnotation` for annotations); report unreachable.\n // Otherwise the rest is just trailing field names — let the loop\n // exit and the post-loop strip remove them.\n if (currentFieldName !== undefined && segment === currentFieldName) {\n resolvedPath.push(segment)\n continue\n }\n for (let j = i + 1; j < path.length; j++) {\n const s = path[j]\n if (isKeyedSegment(s) || typeof s === 'number') {\n return {status: 'unreachable'}\n }\n }\n break\n }\n\n if (isKeyedSegment(segment)) {\n resolvedPath.push(segment)\n const index = blockIndexMap.get(serializePath(resolvedPath))\n if (\n index !== undefined &&\n currentChildren[index]?._key === segment._key\n ) {\n node = currentChildren[index]\n } else {\n // The map can miss (unkeyed transient nodes, e.g. `{_type:'table'}`\n // inserted by a remote patch before normalize mints a key) or\n // disagree with the traversed value (snapshots that pair the live\n // map with a pre-apply value, e.g. `textPatch`). Fall back to a\n // linear scan in both cases.\n node = currentChildren.find((child) => child._key === segment._key)\n if (node && node._key !== undefined) {\n resolvedPath[resolvedPath.length - 1] = {_key: node._key}\n }\n }\n } else if (typeof segment === 'number') {\n node = currentChildren.at(segment)\n if (node) {\n resolvedPath.push({_key: node._key})\n }\n } else {\n return {status: 'missing'}\n }\n\n if (!node) {\n return {status: 'missing'}\n }\n\n let hasMoreSegments = false\n for (let j = i + 1; j < path.length; j++) {\n const s = path[j]\n if (isKeyedSegment(s) || typeof s === 'number') {\n hasMoreSegments = true\n break\n }\n }\n\n if (hasMoreSegments) {\n const next = getNodeChildren(context, node, currentParent)\n\n if (!next) {\n return {status: 'missing'}\n }\n\n currentChildren = next.children\n currentFieldName = next.fieldName\n currentParent = next.parent\n } else {\n currentFieldName = undefined\n }\n }\n\n if (!node) {\n return {status: 'missing'}\n }\n\n // Strip trailing field-name segments. The walker may have pushed\n // matching field names during structural descent; if the deepest\n // reached keyed segment was the last keyed segment in the input,\n // any further field names that followed are part of the input but\n // don't identify the returned node.\n while (\n resolvedPath.length > 0 &&\n typeof resolvedPath[resolvedPath.length - 1] === 'string'\n ) {\n resolvedPath.pop()\n }\n\n return {status: 'found', entry: {node, path: resolvedPath}}\n}\n","import {isKeyedSegment} from '../../utils/util.is-keyed-segment'\nimport type {Path} from '../interfaces/path'\n\n/**\n * Get the parent path of a path.\n *\n * Drops the last node segment (keyed or numeric) and the preceding field\n * name string.\n *\n * [{_key:'b1'}, 'children', {_key:'s1'}] → [{_key:'b1'}]\n * [{_key:'b1'}, 'children', 0] → [{_key:'b1'}]\n * [{_key:'b1'}] → []\n */\nexport function parentPath(path: Path): Path {\n if (path.length === 0) {\n throw new Error(`Cannot get the parent path of the root path [${path}].`)\n }\n\n let lastNodeIndex = -1\n for (let i = path.length - 1; i >= 0; i--) {\n if (isKeyedSegment(path[i]) || typeof path[i] === 'number') {\n lastNodeIndex = i\n break\n }\n }\n\n if (lastNodeIndex === -1) {\n return []\n }\n\n const result = path.slice(0, lastNodeIndex)\n\n if (result.length > 0 && typeof result[result.length - 1] === 'string') {\n return result.slice(0, -1)\n }\n\n return result\n}\n","import type {PortableTextBlock} from '@portabletext/schema'\nimport type {Path} from '../engine/interfaces/path'\nimport {parentPath} from '../engine/path/parent-path'\nimport {getNode} from './get-node'\nimport type {TraversalSnapshot} from './traversal-snapshot'\n\n/**\n * Get the parent of a node at a given path.\n *\n * A parent has children, so it is always a `PortableTextBlock` (text block\n * or object node).\n *\n * When `match` is provided and the parent does not satisfy it, returns\n * `undefined`.\n *\n * @public\n */\nexport function getParent<TMatch extends PortableTextBlock>(\n snapshot: TraversalSnapshot,\n path: Path,\n options: {\n match: (node: PortableTextBlock, path: Path) => node is TMatch\n },\n): {node: TMatch; path: Path} | undefined\n/**\n * @public\n */\nexport function getParent(\n snapshot: TraversalSnapshot,\n path: Path,\n options?: {\n match?: (node: PortableTextBlock, path: Path) => boolean\n },\n): {node: PortableTextBlock; path: Path} | undefined\nexport function getParent(\n snapshot: TraversalSnapshot,\n path: Path,\n options?: {\n match?: (node: PortableTextBlock, path: Path) => boolean\n },\n): {node: PortableTextBlock; path: Path} | undefined {\n if (path.length === 0) {\n return undefined\n }\n\n const parent = parentPath(path)\n\n if (parent.length === 0) {\n return undefined\n }\n\n const entry = getNode(snapshot, parent)\n\n if (!entry) {\n return undefined\n }\n\n const result = {node: entry.node as PortableTextBlock, path: entry.path}\n\n if (options?.match && !options.match(result.node, result.path)) {\n return undefined\n }\n\n return result\n}\n"],"mappings":";;;;AAKA,SAAgB,eAAe,SAA2C;CACxE,OAAO,OAAO,WAAY,cAAY,WAAoB,UAAU;AACtE;;;;;;;;ACGA,SAAgB,cAAc,MAAoB;CAChD,OAAO,KAAK,QAAgB,QAAQ,SAAS,UACvC,eAAe,OAAO,IACjB,GAAG,OAAO,UAAU,QAAQ,KAAK,MAInC,GAAG,SADQ,UAAU,IAAI,KAAK,MACN,WAC9B,EAAE;AACP;ACjBA,SAAgB,cAAc,QAAwC;CACpE,OAAO,SAAS,MAAM,KAAK,OAAO,OAAO,SAAa;AACxD;AAEA,SAAgB,SAAS,OAAkD;CACzE,OAAO,CAAC,CAAC,UAAU,OAAO,SAAU,YAAY,OAAO,SAAU;AACnE;;;;;;;;;;;;;;;;;;ACeA,SAAgB,qBACd,YACA,MACA,QAMY;CACZ,IAAM,WAAW,qBAAqB,YAAY,QAAQ,IAAI;CAE9D,IAAI,CAAC,UACH;CAGF,IAAM,aAAc,KAAiC,SAAS,MAAM;CAE/D,UAAM,QAAQ,UAAU,GAI7B,OAAO;EACL,UAAU;EACV,WAAW;CACb;AACF;;;;;;AAOA,SAAS,qBACP,YACA,QACA,MACiC;CACjC,IAAI,QAAQ,IACL;OAAA,IAAM,SAAS,OAAO,IACzB,IAAI,MAAM,SAAS,KAAK,OAKtB,OAHI,WAAW,QACN,QAET;CACF;CAGJ,OAAO,WAAW,IAAI,KAAK,KAAK;AAClC;;;;;;ACtDA,SAAgB,YACd,UACA,MACiC;CACjC,IAAI,kBAA+B,SAAS,QAAQ,OAChD,mBAAmB,SACnB,cAAoB,CAAC,GACrB,SAAS,IACT;CAEJ,KAAK,IAAM,WAAW,MAAM;EAC1B,IAAI,OAAO,WAAY,UACrB;EAGF,IAAI;EACJ,IAAI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ACA,SAGmD;CACnD,IAAI,KAAK,WAAW,GAClB;CAGF,IAAM,SAAS,WAAW,IAAI;CAE9B,IAAI,OAAO,WAAW,GACpB;CAGF,IAAM,QAAQ,QAAQ,UAAU,MAAM;CAEtC,IAAI,CAAC,OACH;CAGF,IAAM,SAAS;EAAC,MAAM,MAAM;EAA2B,MAAM,MAAM;CAAI;CAEnE,eAAS,SAAS,CAAC,QAAQ,MAAM,OAAO,MAAM,OAAO,IAAI,IAI7D,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import { a as getNodeChildren, c as isTypedObject, i as getChildren, l as serializePath, n as parentPath, r as getNode, t as getParent, u as isKeyedSegment } from "./get-parent-Ci5241qs.js";
1
+ import { a as getChildren, d as isKeyedSegment, l as isTypedObject, n as parentPath, o as getNodeChildren, r as getNode, t as getParent, u as serializePath } from "./get-parent-DgaKcy8-.js";
2
2
  import { getSubSchema } from "@portabletext/schema";
3
3
  /**
4
4
  * Get all ancestors of the node at a given path, from nearest to furthest.
@@ -510,4 +510,4 @@ function getPathSubSchema(snapshot, path) {
510
510
  }
511
511
  export { getAncestors as C, hasNode as S, comparePoints$1 as _, isInline as a, isEditableContainer as b, isSpanNode as c, resolveChildEntryIndex as d, isAncestorPath as f, isAfterPoint as g, isBackwardRange as h, getEnclosingBlock as i, getSibling as l, rangeEdges as m, getEnclosingContainer as n, getBlock as o, isTextBlockNode as p, comparePoints as r, isBlock as s, getPathSubSchema as t, getNodes as u, comparePaths as v, resolveContainerAt as x, isObject as y };
512
512
 
513
- //# sourceMappingURL=get-path-sub-schema-CZd9VcVM.js.map
513
+ //# sourceMappingURL=get-path-sub-schema-Dd0QYZ0m.js.map