@gct-paas/word 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,14 @@
1
1
  import includes from "es-toolkit/compat/includes";
2
+ // src/shared/identity.ts
3
+ /** @file 独立于安全上下文的 UUID,用于文档、会话和业务行身份。 */
4
+ /** getRandomValues 在普通 HTTP 中也可用,保持 UUID v4 格式和随机强度。 */
5
+ function createUuid() {
6
+ const bytes = globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(16));
7
+ bytes[6] = bytes[6] & 15 | 64;
8
+ bytes[8] = bytes[8] & 63 | 128;
9
+ const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
10
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
11
+ }
2
12
  // src/model/query/content-tree.ts
3
13
  /** 沿真实拥有关系找到内容根,不因共享字段或页面实例相同而跨入其他编辑域。 */
4
14
  function contentRoot(id, read) {
@@ -128,6 +138,6 @@ function mapTextPosition(position, maps) {
128
138
  }
129
139
  return result;
130
140
  }
131
- export { contentBlockLeaves as a, contentParagraphs as c, contentAncestors as i, contentRoot as l, invertPositionMaps as n, contentCollections as o, mapTextPosition as r, contentLeaves as s, invertOperation as t };
141
+ export { contentBlockLeaves as a, contentParagraphs as c, contentAncestors as i, contentRoot as l, invertPositionMaps as n, contentCollections as o, mapTextPosition as r, contentLeaves as s, invertOperation as t, createUuid as u };
132
142
 
133
- //# sourceMappingURL=change-set-DNOw1FXo.js.map
143
+ //# sourceMappingURL=change-set-DgfKTJ6d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change-set-DgfKTJ6d.js","names":[],"sources":["../../src/shared/identity.ts","../../src/model/query/content-tree.ts","../../src/model/editor/change-set.ts"],"sourcesContent":["/** @file 独立于安全上下文的 UUID,用于文档、会话和业务行身份。 */\n\n/** getRandomValues 在普通 HTTP 中也可用,保持 UUID v4 格式和随机强度。 */\nexport function createUuid(): string {\n const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));\n bytes[6] = (bytes[6]! & 0x0f) | 0x40;\n bytes[8] = (bytes[8]! & 0x3f) | 0x80;\n const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n","/** @file 内容编辑的拥有树顺序;不访问布局、业务值或字段的条件附属分支。 */\n\nimport type { DeepReadonly } from '../editor/change-set-types';\nimport type { Attachment, Block, DocumentDefinition, Overlay, Paragraph, Part } from '../types';\nimport type { ModelEntity } from './entity-index';\n\n/** 可在只读查询或同步事务中借用的最小拥有关系。 */\nexport interface ContentTreeEntry {\n /** 当前权威实体,不克隆子树。 */\n readonly node: DeepReadonly<ModelEntity>;\n /** 直接拥有者,根文档省略。 */\n readonly parentId?: string;\n}\n\n/** 当前读取边界提供实体与拥有者,不能跨 await 保存活视图。 */\nexport type ContentTreeReader = (id: string) => ContentTreeEntry;\n\n/** 章节可在正文内连续选择,部件、浮层与附属内容分别构成独立编辑根。 */\nexport type ContentRoot = DeepReadonly<DocumentDefinition | Part | Overlay | Attachment>;\n\n/** 尚无段落的块集合叶子;选择和移动不需要先往 model 填入占位段落。 */\nexport interface EmptyContent {\n /** 与真实段落区分的读取类别。 */\n readonly kind: 'emptyContent';\n /** 真实拥有者身份。 */\n readonly ownerId: string;\n}\n\n/** 内容树可导航的真实段落或空容器,不包含分页对象。 */\nexport type ContentLeaf = DeepReadonly<Paragraph> | EmptyContent;\n\n/** 沿真实拥有关系找到内容根,不因共享字段或页面实例相同而跨入其他编辑域。 */\nexport function contentRoot(id: string, read: ContentTreeReader): ContentRoot {\n let entry = read(id);\n for (;;) {\n const node = entry.node;\n if (\n 'kind' in node &&\n (node.kind === 'document' ||\n node.kind === 'header' ||\n node.kind === 'footer' ||\n node.kind === 'overlay' ||\n node.kind === 'attachment')\n )\n return node;\n if (!entry.parentId) throw new Error('内容没有合法编辑根');\n entry = read(entry.parentId);\n }\n}\n\n/** 返回到编辑根的少量祖先身份,仅供当前命令保护端点所在的表格容器。 */\nexport function contentAncestors(id: string, read: ContentTreeReader): ReadonlySet<string> {\n const ids = new Set<string>();\n for (let entry = read(id); ;) {\n ids.add(entry.node.id);\n if (!entry.parentId) break;\n entry = read(entry.parentId);\n }\n return ids;\n}\n\n/** 按声明顺序借用根的块集合;正文只经过章节,不进入页部件和浮层。 */\nexport function contentCollections(root: ContentRoot): readonly (readonly DeepReadonly<Block>[])[] {\n return root.kind === 'document' ? root.sections.map((section) => section.blocks) : [root.blocks];\n}\n\n/** 深度优先读取物理格内段落,不跟随字段的条件分支或绑定引用。 */\nexport function* contentParagraphs(root: ContentRoot): Generator<DeepReadonly<Paragraph>> {\n for (const leaf of contentLeaves(root)) if (leaf.kind === 'paragraph') yield leaf;\n}\n\n/** 按拥有顺序遍历段落和空集合,保留空单元格/章节的位置,且不展开字段附属分支。 */\nexport function* contentLeaves(root: ContentRoot): Generator<ContentLeaf> {\n if (root.kind === 'document')\n for (const section of root.sections) yield* contentBlockLeaves(section.id, section.blocks);\n else yield* contentBlockLeaves(root.id, root.blocks);\n}\n\n/** 从真实拥有者遍历段落/空格;供格内进入编辑使用,不构造临时文档根或展平树。 */\nexport function* contentBlockLeaves(\n ownerId: string,\n blocks: readonly DeepReadonly<Block>[],\n): Generator<ContentLeaf> {\n if (!blocks.length) yield { kind: 'emptyContent', ownerId };\n for (const block of blocks)\n if (block.kind === 'paragraph') yield block;\n else\n for (const row of block.rows)\n for (const cell of row.cells) yield* contentBlockLeaves(cell.id, cell.blocks);\n}\n","/**\n * @file 编辑日志算法:提供反向操作与文字位置映射,协议定义见 change-set-types.ts。\n * 阅读定位:editor/ · 创建、编辑、事务、差量与历史。\n */\n\nimport includes from 'es-toolkit/compat/includes';\n\nimport type { DeepReadonly, ModelOperation, PositionMap, TextPosition } from './change-set-types';\n\n/** 将操作反向;调用方倒序执行整组反向操作,才能恢复事务开始时的状态。 */\nexport function invertOperation(operation: ModelOperation): ModelOperation {\n switch (operation.kind) {\n case 'text':\n return { ...operation, remove: operation.insert, insert: operation.remove };\n case 'splice':\n return {\n ...operation,\n remove: operation.insert,\n insert: operation.remove,\n beforePresent: operation.afterPresent,\n afterPresent: operation.beforePresent,\n };\n case 'set':\n case 'dictionary':\n return { ...operation, before: operation.after, after: operation.before };\n case 'business':\n return {\n ...operation,\n before: operation.after,\n after: operation.before,\n beforePresent: operation.afterPresent,\n afterPresent: operation.beforePresent,\n };\n }\n}\n\n/** 反转可重定位的文字映射;删除节点没有可猜测的逆位置,由外层选区历史恢复。 */\nexport function invertPositionMaps(maps: readonly PositionMap[]): PositionMap[] {\n return [...maps].reverse().flatMap((map): PositionMap[] => {\n switch (map.kind) {\n case 'text':\n return [{ ...map, removedLength: map.insertedLength, insertedLength: map.removedLength }];\n case 'split':\n return [{ ...map, kind: 'merge', sourceId: map.targetId, targetId: map.sourceId }];\n case 'merge':\n return [{ ...map, kind: 'split', sourceId: map.targetId, targetId: map.sourceId }];\n case 'remove':\n return [];\n }\n });\n}\n\n/** 顺序重定位文字位置;已删除的节点返回 null,区间内位置按 affinity 吸附到边界。 */\nexport function mapTextPosition(\n position: TextPosition,\n maps: DeepReadonly<PositionMap[]>,\n): TextPosition | null {\n let result = { ...position };\n for (const map of maps) {\n if (map.kind === 'remove') {\n if (includes(map.nodeIds, result.nodeId)) return null;\n continue;\n }\n if (map.kind === 'text' && result.nodeId === map.nodeId) {\n const end = map.offset + map.removedLength;\n if (result.offset > end) result.offset += map.insertedLength - map.removedLength;\n else if (result.offset >= map.offset)\n result.offset = map.offset + (result.affinity === 'before' ? 0 : map.insertedLength);\n }\n if (\n map.kind === 'split' &&\n result.nodeId === map.sourceId &&\n (result.offset > map.offset || (result.offset === map.offset && result.affinity !== 'before'))\n ) {\n result = { ...result, nodeId: map.targetId, offset: result.offset - map.offset };\n }\n if (map.kind === 'merge' && result.nodeId === map.sourceId)\n result = { ...result, nodeId: map.targetId, offset: result.offset + map.offset };\n }\n return result;\n}\n"],"mappings":"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"}
@@ -1,8 +1,8 @@
1
- import { $ as rectDistance, $t as assertDataNumberPrecision, A as selectionFallbacks, An as sameLayoutIdentity, At as nativeObjectKey, B as fieldBehaviorLabel, Bt as normalizeResourceValue, Cn as isRequiredDataValueMissing, Ct as referenceContext, Dn as formatTsv, Dt as isReferenceScanField, E as snapshotFieldDragDefinition, Et as referenceValueIds, F as editingAllowed, Fn as assertFiniteLayoutNumber, Ft as nativeSelectedReferenceValue, G as afterFieldSettlement, H as systemDate, Ht as resourceContext, I as designRegionTypes, In as assertLayoutSize, It as referenceInputIdentity, J as writeFieldValue, Jt as commonFieldDeclaration, K as readFieldTarget, Kt as resourceValues, L as designRegionVariants, Ln as assertLayoutTextMeasureRequest, Lt as authenticatedSignature, M as assertAdaptiveImageCellWritable, Mn as snapshotLayoutVersion, Mt as isMaterialLotBinding, N as hasAdaptiveImageCell, Nn as layoutImageSourceKey, Nt as isNamedLotBinding, O as freezeSelection, On as parseTsv, Ot as referenceScanPaths, P as assertOwnedEditingAllowed, Pn as LayoutContractError, Pt as lotReference, Q as positionX, Qt as nativeFieldBehavior, R as choiceSelection, Rn as assertLayoutTextMeasurement, Rt as signatureText, S as EditorObjects, St as referenceBehavior, T as resolveFieldDrop, Tn as readDataValueInput, Tt as referenceOptions, U as readBusinessField, Ut as resourceLimits, V as resolveBooleanOptionLabel, Vt as resourceBehavior, W as sameBusinessField, Wt as resourceName, X as TextFlowError, Xt as isCommonField, Y as TextFlow, Yt as fieldBehavior, Z as hitPosition, Zt as isFieldTextInput, _ as readFieldOptionInput, _n as invalidDataNumberText, _t as sealStampKeys, a as writeGuardedFieldText, an as readDataBoolean, at as sameTextSource, b as toggledFieldOptionIds, bn as isClosedDataContainer, bt as normalizeReferenceValue, c as fieldNumberSettings, d as isIncompleteFieldNumber, dn as resolveDataValueUpdate, en as dataParameterNumberKind, et as sourceBoundaryIndex, f as validateFieldNumber, fn as shouldInitializeDataValue, ft as millimetersToLayoutPx, g as readFieldChoiceInput, gn as findInvalidDataNumbers, gt as nativeSealValueKind, hn as dataValueIssuesFromError, ht as nativeSealText, i as validateFieldTextDraft, in as normalizeDataParameterNumber, it as samePosition, j as adaptiveImageCellMessage, jn as sameLayoutVersion, jt as nativeObjectRootField, k as mapSelection, kn as tsvClipboardLimits, kt as referenceScanUpdates, l as fieldNumberText, ln as resolveDataDefaultFrom, m as readFieldSignatureInput, mn as assertValidDataValue, mt as authenticatedSeal, n as readFieldTextInput, nn as encodeDataFieldValue, nt as positionSourceId, o as fieldValidationDescription, on as encodeDataCollection, ot as textSourceId, p as assertFieldSignatureInput, pn as DataValueError, pt as pointsToLayoutPx, q as resolveFieldTarget, qt as validateResourceFiles, r as sameFieldTextInput, rn as normalizeDataBoolean, rt as sameDomain, s as FieldNumberError, sn as emptyDataValue, t as nativeTableRowBatchLimit, tn as encodeDataChoice, tt as visualAffinity, u as fieldNumberValue, un as resolveDataDisplay, ut as layoutPxToMillimeters, vt as isSealPosition, w as designFieldDefaults, wn as isUninitializedDataValue, wt as referenceIds, x as writeGuardedFieldChoice, xn as isEmptyDataValue, xt as recordReference, yn as dataValueState, yt as parseSealValue, z as fieldBehaviorDefault, zt as signatureValues } from "./types-XXuIIZ9e.js";
1
+ import { $ as rectDistance, $t as assertDataNumberPrecision, A as selectionFallbacks, An as sameLayoutIdentity, At as nativeObjectKey, B as fieldBehaviorLabel, Bt as normalizeResourceValue, Cn as isRequiredDataValueMissing, Ct as referenceContext, Dn as formatTsv, Dt as isReferenceScanField, E as snapshotFieldDragDefinition, Et as referenceValueIds, F as editingAllowed, Fn as assertFiniteLayoutNumber, Ft as nativeSelectedReferenceValue, G as afterFieldSettlement, H as systemDate, Ht as resourceContext, I as designRegionTypes, In as assertLayoutSize, It as referenceInputIdentity, J as writeFieldValue, Jt as commonFieldDeclaration, K as readFieldTarget, Kt as resourceValues, L as designRegionVariants, Ln as assertLayoutTextMeasureRequest, Lt as authenticatedSignature, M as assertAdaptiveImageCellWritable, Mn as snapshotLayoutVersion, Mt as isMaterialLotBinding, N as hasAdaptiveImageCell, Nn as layoutImageSourceKey, Nt as isNamedLotBinding, O as freezeSelection, On as parseTsv, Ot as referenceScanPaths, P as assertOwnedEditingAllowed, Pn as LayoutContractError, Pt as lotReference, Q as positionX, Qt as nativeFieldBehavior, R as choiceSelection, Rn as assertLayoutTextMeasurement, Rt as signatureText, S as EditorObjects, St as referenceBehavior, T as resolveFieldDrop, Tn as readDataValueInput, Tt as referenceOptions, U as readBusinessField, Ut as resourceLimits, V as resolveBooleanOptionLabel, Vt as resourceBehavior, W as sameBusinessField, Wt as resourceName, X as TextFlowError, Xt as isCommonField, Y as TextFlow, Yt as fieldBehavior, Z as hitPosition, Zt as isFieldTextInput, _ as readFieldOptionInput, _n as invalidDataNumberText, _t as sealStampKeys, a as writeGuardedFieldText, an as readDataBoolean, at as sameTextSource, b as toggledFieldOptionIds, bn as isClosedDataContainer, bt as normalizeReferenceValue, c as fieldNumberSettings, d as isIncompleteFieldNumber, dn as resolveDataValueUpdate, en as dataParameterNumberKind, et as sourceBoundaryIndex, f as validateFieldNumber, fn as shouldInitializeDataValue, ft as millimetersToLayoutPx, g as readFieldChoiceInput, gn as findInvalidDataNumbers, gt as nativeSealValueKind, hn as dataValueIssuesFromError, ht as nativeSealText, i as validateFieldTextDraft, in as normalizeDataParameterNumber, it as samePosition, j as adaptiveImageCellMessage, jn as sameLayoutVersion, jt as nativeObjectRootField, k as mapSelection, kn as tsvClipboardLimits, kt as referenceScanUpdates, l as fieldNumberText, ln as resolveDataDefaultFrom, m as readFieldSignatureInput, mn as assertValidDataValue, mt as authenticatedSeal, n as readFieldTextInput, nn as encodeDataFieldValue, nt as positionSourceId, o as fieldValidationDescription, on as encodeDataCollection, ot as textSourceId, p as assertFieldSignatureInput, pn as DataValueError, pt as pointsToLayoutPx, q as resolveFieldTarget, qt as validateResourceFiles, r as sameFieldTextInput, rn as normalizeDataBoolean, rt as sameDomain, s as FieldNumberError, sn as emptyDataValue, t as nativeTableRowBatchLimit, tn as encodeDataChoice, tt as visualAffinity, u as fieldNumberValue, un as resolveDataDisplay, ut as layoutPxToMillimeters, vt as isSealPosition, w as designFieldDefaults, wn as isUninitializedDataValue, wt as referenceIds, x as writeGuardedFieldChoice, xn as isEmptyDataValue, xt as recordReference, yn as dataValueState, yt as parseSealValue, z as fieldBehaviorDefault, zt as signatureValues } from "./types-Bq4hbWKT.js";
2
+ import { a as contentBlockLeaves, s as contentLeaves, u as createUuid } from "./change-set-DgfKTJ6d.js";
2
3
  import { t as waitForAbortable } from "./abortable-D4G3Ib7H.js";
3
- import { a as contentBlockLeaves, s as contentLeaves } from "./change-set-DNOw1FXo.js";
4
4
  import { D as equalData, E as copyInputData, O as freezeData, S as repeatingTableVariants, n as commonFieldWidgets, o as readFieldBinding, t as NodeFactory, w as cloneJsonData, x as repeatingTableSettings } from "./NodeFactory-D9gVGSok.js";
5
- import { a as readTextFormatUpdate, c as intersectsRectangle, g as replacePathIndexPlaceholders, h as parseValuePath, i as readParagraphFormatUpdate, l as isOrdinaryTable, m as mergeStyle, n as resolveKeepExceptionHighlight, o as containsRectangle, r as patchTextDeclaration, s as indexTablePositions, t as ModelEditor, u as rectangleFromPositions } from "./ModelEditor-GzaLnnX8.js";
5
+ import { a as readTextFormatUpdate, c as intersectsRectangle, g as replacePathIndexPlaceholders, h as parseValuePath, i as readParagraphFormatUpdate, l as isOrdinaryTable, m as mergeStyle, n as resolveKeepExceptionHighlight, o as containsRectangle, r as patchTextDeclaration, s as indexTablePositions, t as ModelEditor, u as rectangleFromPositions } from "./ModelEditor-CXoezurC.js";
6
6
  import { n as tableBorderWidthsPx, t as defaultTableBorderColor } from "./table-borders-Dwuj7lFp.js";
7
7
  import { groupBy, maxBy, sortBy, uniq } from "es-toolkit/array";
8
8
  import { isEqual, isPlainObject } from "es-toolkit/predicate";
@@ -10300,7 +10300,7 @@ var DocumentSession = class {
10300
10300
  /** 创建或借用唯一模型编辑器,只装配资源和通知,不执行数据加载或排版。 */
10301
10301
  constructor(options) {
10302
10302
  if (!options || options.document !== void 0 === (options.editor !== void 0)) throw new Error("只能指定 document 或 editor 其中一种会话来源");
10303
- this.sessionId = options.sessionId ?? globalThis.crypto.randomUUID();
10303
+ this.sessionId = options.sessionId ?? createUuid();
10304
10304
  if (typeof this.sessionId !== "string" || !this.sessionId.trim()) throw new Error("会话身份不能为空");
10305
10305
  const owned = options.document !== void 0 || options.ownership === "owned";
10306
10306
  const editor = options.document !== void 0 ? new ModelEditor(options.document, options.editorOptions) : options.editor;
@@ -17623,7 +17623,7 @@ var DataMatrix = class {
17623
17623
  }
17624
17624
  if (!isRecord(row)) throw new Error(`矩阵轴行不是对象:${path}`);
17625
17625
  const uidField = `__gw_${axis}_uid`;
17626
- if (typeof row[uidField] !== "string" || !row[uidField]) this.services.paths.setProperty(row, uidField, `${axis}_${crypto.randomUUID()}`, batch);
17626
+ if (typeof row[uidField] !== "string" || !row[uidField]) this.services.paths.setProperty(row, uidField, `${axis}_${createUuid()}`, batch);
17627
17627
  return row;
17628
17628
  }
17629
17629
  /** 通过轴 UID 读取格记录,返回内部借用值,公开读取由值服务隔离。 */
@@ -17701,11 +17701,11 @@ var DataMatrix = class {
17701
17701
  const uidField = `__gw_${axis}_uid`;
17702
17702
  const oldUid = row[uidField];
17703
17703
  if (!oldUid) {
17704
- row[uidField] = `${axis}_${crypto.randomUUID()}`;
17704
+ row[uidField] = `${axis}_${createUuid()}`;
17705
17705
  continue;
17706
17706
  }
17707
17707
  if (!existing.some((item) => isRecord(item) && item[uidField] === oldUid)) continue;
17708
- const newUid = `${axis}_${crypto.randomUUID()}`;
17708
+ const newUid = `${axis}_${createUuid()}`;
17709
17709
  row[uidField] = newUid;
17710
17710
  for (const entry of this.crossKeys(tableKey).filter((entry) => entry.axis === axis)) {
17711
17711
  const cells = this.services.values.raw[entry.key];
@@ -17831,7 +17831,7 @@ var DataRows = class {
17831
17831
  assertValidDataValue(row, path);
17832
17832
  delete row.id_;
17833
17833
  delete row.front_row_key_;
17834
- row.front_row_key_ = crypto.randomUUID();
17834
+ row.front_row_key_ = createUuid();
17835
17835
  return row;
17836
17836
  });
17837
17837
  if (!prepared.length && !incoming.length) return false;
@@ -17872,7 +17872,7 @@ var DataRows = class {
17872
17872
  assertValidDataValue(row, path);
17873
17873
  delete row.id_;
17874
17874
  delete row.front_row_key_;
17875
- row.front_row_key_ = crypto.randomUUID();
17875
+ row.front_row_key_ = createUuid();
17876
17876
  return row;
17877
17877
  });
17878
17878
  const target = rows ?? this.array(path, true, true);
@@ -17901,7 +17901,7 @@ var DataRows = class {
17901
17901
  if (!isRecord(value)) throw new Error("子表行必须是对象");
17902
17902
  const row = cloneDeep(value);
17903
17903
  assertValidDataValue(row, path);
17904
- if (!row.front_row_key_) row.front_row_key_ = crypto.randomUUID();
17904
+ if (!row.front_row_key_) row.front_row_key_ = createUuid();
17905
17905
  return row;
17906
17906
  });
17907
17907
  const rows = this.array(path, false);
@@ -17952,7 +17952,7 @@ var DataRows = class {
17952
17952
  ensureFrontKeys() {
17953
17953
  for (const [key, rows] of Object.entries(this.services.values.raw)) {
17954
17954
  if (!Array.isArray(rows)) continue;
17955
- for (const [index, row] of rows.entries()) if (isRecord(row) && !row.front_row_key_) this.services.values.set(`$.${key}[${index}].front_row_key_`, crypto.randomUUID(), "hydrate");
17955
+ for (const [index, row] of rows.entries()) if (isRecord(row) && !row.front_row_key_) this.services.values.set(`$.${key}[${index}].front_row_key_`, createUuid(), "hydrate");
17956
17956
  }
17957
17957
  }
17958
17958
  };
@@ -20690,7 +20690,7 @@ var NativeDataInitializer = class {
20690
20690
  /** 同一门面只允许最新一次准备发布。 */
20691
20691
  active;
20692
20692
  /** 会话任务用途只属于本门面,不与其他实例互相覆盖。 */
20693
- taskKey = `data-initialization:${crypto.randomUUID()}`;
20693
+ taskKey = `data-initialization:${createUuid()}`;
20694
20694
  /** 构造只接线,当前会话身份由参数准备器共同校验。 */
20695
20695
  constructor(handle, options) {
20696
20696
  this.state = {
@@ -21928,7 +21928,7 @@ var NativeFillTargets = class {
21928
21928
  if (index < rows.length) updates.set(path, next);
21929
21929
  else {
21930
21930
  const offset = index - rows.length;
21931
- while (appended.length <= offset) appended.push({ front_row_key_: crypto.randomUUID() });
21931
+ while (appended.length <= offset) appended.push({ front_row_key_: createUuid() });
21932
21932
  set(appended[offset], parts, next);
21933
21933
  }
21934
21934
  }
@@ -22459,7 +22459,7 @@ var NativeResources = class {
22459
22459
  // src/runtime/form/shared/identity.ts
22460
22460
  /** 业务任务和新行的身份只在当前操作生成,不更改 model 节点身份。 */
22461
22461
  function createNativeId() {
22462
- return crypto.randomUUID();
22462
+ return createUuid();
22463
22463
  }
22464
22464
  // src/runtime/form/business/inspection/identity.ts
22465
22465
  /** @file 检验快照与实际主体行的身份绑定;持久化快照只按UID绑定。 */
@@ -22856,7 +22856,7 @@ function materialGroups(declaration, environment, raw, readValue) {
22856
22856
  // src/runtime/form/shared/row.ts
22857
22857
  /** 新业务行缺少稳定身份时补齐,不覆盖已存在的身份。 */
22858
22858
  function ensureFrontRowKey(row) {
22859
- if (typeof row.front_row_key_ !== "string" || !row.front_row_key_) row.front_row_key_ = crypto.randomUUID();
22859
+ if (typeof row.front_row_key_ !== "string" || !row.front_row_key_) row.front_row_key_ = createUuid();
22860
22860
  return row.front_row_key_;
22861
22861
  }
22862
22862
  /** 隔离读取间以稳定键识别同一业务行,不比较快照对象引用。 */
@@ -33882,4 +33882,4 @@ function attachNativeLayout(context, options) {
33882
33882
  }
33883
33883
  export { shouldInitializeDocumentData as $, NativeMaterialSelection as A, clippedFrame as At, logicalFillPath as B, NativeReferenceScopeError as C, compareFieldConfigurations as Ct, materialAutofillRegions as D, LayoutSessionError as Dt, tableSelectionKind as E, LayoutSession as Et, nativeProductReference as F, viewportRectToPage as Ft, attachNativeDataSources as G, nativeSourceWorkerCode as H, NativeInspectionInitialization as I, runtimeRequest as It, sourceParameters as J, copySourceValue as K, NativeResources as L, NativeMaterialObjects as M, pagePointToViewport as Mt, NativeMaterialInitialization as N, pageRectToViewport as Nt, productAutofillDetails as O, LayoutQuery as Ot, materialProductMatches as P, viewportPointToPage as Pt, isUninitialized as Q, NativeFieldFills as R, NativeReferences as S, compareDocumentContent as St, inventorySelection as T, isRecord as Tt, runNativeSourceScript as U, subtableFillColumn as V, NativeDataSources as W, NativeSourceError as X, sourceProperty as Y, hasPersistedDocumentData as Z, CHECK_TABLE_TYPE_TO_VALUE_FIELD as _, resizedDesignColumnWidth as _t, NativeDataServices as a, NativeDataRuntime as at, NativeSignatures as b, combineSessionSignals as bt, businessNumberMinimum as c, DataManager as ct, NativeValidator as d, NativeTableQuickFill as dt, NativeDataInitializer as et, attachNativeValidator as f, nativeQuickFillLimit as ft, createNativeSubmissionData as g, NestedTableInsertionError as gt, allocationNotices as h, EditorController as ht, attachSessionLayout as i, attachNativeParameterInitializer as it, getInvalidMaterialLotReason as j, UnsupportedLayoutError as jt, NativeMaterials as k, DocumentLayoutBuilder as kt, businessTableFieldDefaults as l, NativeBusinessTables as lt, attachNativeSubmissionCoordinator as m, attachNativeInteraction as mt, NativeLayoutPresentation as n, attachNativeDataInitializer as nt, attachNativeDataServices as o, attachNativeDataRuntime as ot, NativeSubmissionCoordinator as p, isDerivedDataPath as pt, sourceResult as q, choiceSpacingDefaults as r, NativeParameterInitializer as rt, NativeBusinessFields as s, NativeDataQuery as st, attachNativeLayout as t, NativeInitializationQueryError as tt, attachSessionData as u, NativeTableScan as ut, isSubmitExcludedKey as v, MissingSubTableHeaderTargetError as vt, validateNativeReference as w, validateTemplateSave as wt, NativeSeals as x, DocumentSession as xt, validateNativeSignatures as y, FieldPlacementError as yt, attachNativeFieldFills as z };
33884
33884
 
33885
- //# sourceMappingURL=sdk-DH5c-Bbt.js.map
33885
+ //# sourceMappingURL=sdk-Dz96Ca_-.js.map