@mindexec/cli 0.2.478 → 0.2.479

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 (146) hide show
  1. package/README.md +323 -323
  2. package/codex-model-catalog.js +202 -202
  3. package/codex-runtime.js +1608 -1608
  4. package/desktop-workspace-state.cjs +120 -120
  5. package/electron/main.cjs +517 -517
  6. package/electron/preload.cjs +17 -17
  7. package/electron/recurring-update-owner-smoke.mjs +55 -55
  8. package/electron/recurring-update-owner.cjs +97 -97
  9. package/electron/source-smoke.mjs +108 -108
  10. package/electron/update-feed-resolver.cjs +79 -79
  11. package/electron/update-feed.json +10 -10
  12. package/electron/update-manager-smoke.mjs +146 -146
  13. package/electron/update-manager.cjs +297 -297
  14. package/electron/windows-package-smoke.mjs +156 -156
  15. package/launch-bridge.cjs +236 -236
  16. package/lzo1x.js +110 -110
  17. package/mode4-atlas-worker.js +440 -440
  18. package/mode4-atlas.js +130 -130
  19. package/package.json +1 -1
  20. package/port-guard.cjs +285 -285
  21. package/remote-fast/osx-arm64/MacScreenCaptureKitH264.swift +339 -339
  22. package/remote-fast/osx-arm64/MacSystemAudioCapture.swift +214 -214
  23. package/remote-fast/osx-arm64/UnixRawCaptureHelper.mjs +80 -80
  24. package/remote-fast/osx-arm64/livedesk-raw-capture-resampler.mjs +73 -73
  25. package/remote-fast/osx-arm64/mindexec-remote-fast.dll +0 -0
  26. package/remote-fast/osx-x64/MacScreenCaptureKitH264.swift +339 -339
  27. package/remote-fast/osx-x64/MacSystemAudioCapture.swift +214 -214
  28. package/remote-fast/osx-x64/UnixRawCaptureHelper.mjs +80 -80
  29. package/remote-fast/osx-x64/livedesk-raw-capture-resampler.mjs +73 -73
  30. package/remote-fast/osx-x64/mindexec-remote-fast.dll +0 -0
  31. package/remote-fast/win-x64/mindexec-remote-fast.dll +0 -0
  32. package/remote-hub.js +3698 -3698
  33. package/scripts/auth-session-smoke.mjs +262 -262
  34. package/scripts/board-render-ownership-smoke.mjs +85 -85
  35. package/scripts/codex-model-catalog-smoke.mjs +150 -150
  36. package/scripts/codex-runtime-home-smoke.mjs +58 -58
  37. package/scripts/codex-sdk-image-live-smoke.mjs +43 -43
  38. package/scripts/codex-sdk-image-runtime-smoke.mjs +122 -122
  39. package/scripts/codex-sdk-runtime-smoke.mjs +89 -89
  40. package/scripts/desktop-update-publisher-smoke.mjs +89 -89
  41. package/scripts/desktop-update-worker-smoke.mjs +72 -72
  42. package/scripts/desktop-workspace-state-smoke.mjs +81 -81
  43. package/scripts/drive-installed-update-smoke.mjs +67 -67
  44. package/scripts/npm-fresh-install-smoke.mjs +216 -216
  45. package/scripts/publish-mindexec-desktop-updates.mjs +224 -224
  46. package/scripts/remote-agent-managed-smoke.mjs +318 -318
  47. package/scripts/remote-agent-package-smoke.mjs +64 -64
  48. package/scripts/remote-agent-ws-smoke.mjs +269 -269
  49. package/scripts/remote-fast-live-rate-smoke.mjs +343 -343
  50. package/scripts/remote-fast-mdm-browser-smoke.mjs +453 -453
  51. package/scripts/remote-fleet-render-smoke.mjs +1350 -1350
  52. package/scripts/remote-frame-ws-smoke.mjs +234 -234
  53. package/scripts/remote-http-smoke.mjs +592 -592
  54. package/scripts/remote-hub-identity-smoke.mjs +146 -146
  55. package/scripts/remote-hub-scale-smoke.mjs +124 -124
  56. package/scripts/remote-hub-smoke.mjs +699 -699
  57. package/scripts/remote-input-ws-smoke.mjs +263 -263
  58. package/scripts/remote-registry-follower-smoke.mjs +815 -815
  59. package/scripts/setup-tree-sitter-grammars.mjs +59 -59
  60. package/server.js +7510 -7510
  61. package/start-bridge.bat +32 -32
  62. package/start-bridge.sh +81 -81
  63. package/tree-sitter-grammars/README.md +18 -0
  64. package/tree-sitter-grammars/tree-sitter-c_sharp.wasm +0 -0
  65. package/tree-sitter-grammars/tree-sitter-go.wasm +0 -0
  66. package/tree-sitter-grammars/tree-sitter-java.wasm +0 -0
  67. package/tree-sitter-grammars/tree-sitter-javascript.wasm +0 -0
  68. package/tree-sitter-grammars/tree-sitter-python.wasm +0 -0
  69. package/tree-sitter-grammars/tree-sitter-rust.wasm +0 -0
  70. package/tree-sitter-grammars/tree-sitter-tsx.wasm +0 -0
  71. package/tree-sitter-grammars/tree-sitter-typescript.wasm +0 -0
  72. package/wwwroot/_content/MindExecution.Plugins.Admin/css/admin-dashboard.css +546 -546
  73. package/wwwroot/_content/MindExecution.Plugins.Directory/background.png +0 -0
  74. package/wwwroot/_content/MindExecution.Plugins.YouTube/css/youtube-search.css +251 -251
  75. package/wwwroot/_content/MindExecution.Shared/css/mind-map-overrides.css +3789 -3789
  76. package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Bold.ttf +0 -0
  77. package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Regular.ttf +0 -0
  78. package/wwwroot/_content/MindExecution.Shared/js/agent-visualization.js +27 -27
  79. package/wwwroot/_content/MindExecution.Shared/js/background-themes.js +1449 -1449
  80. package/wwwroot/_content/MindExecution.Shared/js/code-master.js +8316 -8316
  81. package/wwwroot/_content/MindExecution.Shared/js/file-system-helper.js +338 -338
  82. package/wwwroot/_content/MindExecution.Shared/js/marked.min.js +69 -69
  83. package/wwwroot/_content/MindExecution.Shared/js/mind-map-animated-image-preview.js +270 -270
  84. package/wwwroot/_content/MindExecution.Shared/js/mind-map-automation-edge-motion.js +170 -170
  85. package/wwwroot/_content/MindExecution.Shared/js/mind-map-board-render-ownership.js +81 -81
  86. package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js +10506 -10506
  87. package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js.backup +1059 -0
  88. package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-hotpath.js +902 -902
  89. package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-manager.js +24637 -24637
  90. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dev-guards.js +325 -325
  91. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js +1491 -1491
  92. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js.bak +434 -0
  93. package/wwwroot/_content/MindExecution.Shared/js/mind-map-glow-shader.js +70 -70
  94. package/wwwroot/_content/MindExecution.Shared/js/mind-map-image-policy.js +218 -218
  95. package/wwwroot/_content/MindExecution.Shared/js/mind-map-interactions.js +7078 -7078
  96. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-plan-worker.js +160 -160
  97. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-renderer.js +9958 -9958
  98. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-video-placeholder.js +107 -107
  99. package/wwwroot/_content/MindExecution.Shared/js/mind-map-logic-workers.js +1004 -1004
  100. package/wwwroot/_content/MindExecution.Shared/js/mind-map-menu-manager.js +1351 -1351
  101. package/wwwroot/_content/MindExecution.Shared/js/mind-map-multi-select.js +865 -865
  102. package/wwwroot/_content/MindExecution.Shared/js/mind-map-node-search-worker.js +554 -554
  103. package/wwwroot/_content/MindExecution.Shared/js/mind-map-nodes.js +4744 -4744
  104. package/wwwroot/_content/MindExecution.Shared/js/mind-map-normal-boundary-optimizer.js +624 -624
  105. package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js +241 -241
  106. package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js.backup +372 -0
  107. package/wwwroot/_content/MindExecution.Shared/js/mind-map-pipeline.js +2290 -2290
  108. package/wwwroot/_content/MindExecution.Shared/js/mind-map-remote-codecs.js +202 -202
  109. package/wwwroot/_content/MindExecution.Shared/js/mind-map-render-plan.js +1971 -1971
  110. package/wwwroot/_content/MindExecution.Shared/js/mind-map-text-lod-system.js +93 -93
  111. package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js +2391 -2391
  112. package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js.backup +1258 -0
  113. package/wwwroot/_content/MindExecution.Shared/js/mind-map-video-playback-controls.js +95 -95
  114. package/wwwroot/_content/MindExecution.Shared/js/mind-map-visibility-worker.js +895 -895
  115. package/wwwroot/_content/MindExecution.Shared/js/mindmap-toolbar.js +636 -636
  116. package/wwwroot/_content/MindExecution.Shared/js/native-drop-handler.js +45 -45
  117. package/wwwroot/_content/MindExecution.Shared/js/plan-master.js +117 -117
  118. package/wwwroot/_content/MindExecution.Shared/js/renderers/CSS3DRenderer.js +114 -114
  119. package/wwwroot/_content/MindExecution.Shared/js/texture-worker-manager.js +10 -10
  120. package/wwwroot/_content/MindExecution.Shared/js/three.min.js +6 -6
  121. package/wwwroot/_content/MindExecution.Shared/js/token-manager.js +7 -7
  122. package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js +6 -6
  123. package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js.map +2 -2
  124. package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/css/all.min.css +8 -8
  125. package/wwwroot/_content/MindExecution.Shared/models/vocab.txt +30522 -30522
  126. package/wwwroot/_framework/{Google.Protobuf.33g2gb5is0.dll → Google.Protobuf.9h59ukbel7.dll} +0 -0
  127. package/wwwroot/_framework/{MindExecution.Core.z100xo4mg0.dll → MindExecution.Core.xxsj2s456b.dll} +0 -0
  128. package/wwwroot/_framework/{MindExecution.Kernel.i9cldrx8yc.dll → MindExecution.Kernel.5jofnc0wrd.dll} +0 -0
  129. package/wwwroot/_framework/{MindExecution.Plugins.Admin.48lzqddb0a.dll → MindExecution.Plugins.Admin.t7m4jnqjg3.dll} +0 -0
  130. package/wwwroot/_framework/{MindExecution.Plugins.Business.7m8u1q142p.dll → MindExecution.Plugins.Business.6yjlhhavap.dll} +0 -0
  131. package/wwwroot/_framework/{MindExecution.Plugins.Concept.cl5wmr53od.dll → MindExecution.Plugins.Concept.iikqq5zxu0.dll} +0 -0
  132. package/wwwroot/_framework/{MindExecution.Plugins.Directory.slipi39041.dll → MindExecution.Plugins.Directory.c5ribyne4m.dll} +0 -0
  133. package/wwwroot/_framework/{MindExecution.Plugins.PlanMaster.qfge05l671.dll → MindExecution.Plugins.PlanMaster.365bbuifr9.dll} +0 -0
  134. package/wwwroot/_framework/{MindExecution.Plugins.YouTube.tn7v29ut77.dll → MindExecution.Plugins.YouTube.ax415cilpk.dll} +0 -0
  135. package/wwwroot/_framework/MindExecution.Shared.21e2nvf86u.dll +0 -0
  136. package/wwwroot/_framework/{MindExecution.Web.rwawrxxk38.dll → MindExecution.Web.ppgm8rey59.dll} +0 -0
  137. package/wwwroot/_framework/{System.Collections.23yxgetbju.dll → System.Collections.zyvbaq6mpd.dll} +0 -0
  138. package/wwwroot/_framework/blazor.boot.json +25 -25
  139. package/wwwroot/_headers +40 -40
  140. package/wwwroot/_redirects +1 -1
  141. package/wwwroot/index.html +772 -772
  142. package/wwwroot/js/marketing-tool.js +180 -180
  143. package/wwwroot/manifest.webmanifest +23 -23
  144. package/wwwroot/service-worker-assets.js +109 -81
  145. package/wwwroot/service-worker.js +33 -33
  146. package/wwwroot/_framework/MindExecution.Shared.rjqlf0umjn.dll +0 -0
@@ -1,624 +1,624 @@
1
- (function () {
2
- 'use strict';
3
-
4
- const BUILD_ID = '20260713-normal-boundary-optimizer-v002';
5
-
6
- function install(prototype, helpers = {}) {
7
- if (!prototype || prototype._normalBoundaryOptimizerBuild === BUILD_ID) return true;
8
-
9
- const supportsCss3dNodeModel = helpers.supportsCss3dNodeModel;
10
- const isTextLikeModel = helpers.isTextLikeModel;
11
- const isLivePortalCssLodModel = helpers.isLivePortalCssLodModel;
12
- const hasAgentConsoleOpenForEntry = helpers.hasAgentConsoleOpenForEntry;
13
- const getNodeContentType = helpers.getNodeContentType;
14
- const getLodBandForCameraZ = helpers.getLodBandForCameraZ;
15
- if ([supportsCss3dNodeModel, isTextLikeModel, isLivePortalCssLodModel,
16
- hasAgentConsoleOpenForEntry, getNodeContentType, getLodBandForCameraZ]
17
- .some(value => typeof value !== 'function')) {
18
- throw new Error('[NormalBoundaryOptimizer] Missing LOD renderer helper contract.');
19
- }
20
-
21
- Object.assign(prototype, {
22
- _getFullResCssOwnershipKey(module, selectionKey = '') {
23
- return [
24
- String(selectionKey || ''),
25
- String(module?.draggedNodeId || ''),
26
- String(module?._textOverlayV2State?.editing?.nodeId || ''),
27
- String(module?._editingOverlayState?.nodeId || ''),
28
- String(module?._textOverlayV2State?.selectionNodeId || ''),
29
- String(this._getCurrentHoveredNodeId(module) || '')
30
- ].join('|');
31
- },
32
-
33
- _buildFullResCssAllowSet(prioritizedVisible, nodeObjectsById, module = this._module,
34
- lodBand = this._currentLodBand, selectionKey = '') {
35
- const stickyAllowedIds = new Set();
36
- const addStickyId = (value) => {
37
- const nodeId = String(value || '').trim();
38
- if (!nodeId) return;
39
- const entry = nodeObjectsById?.get?.(nodeId) || null;
40
- if (entry && supportsCss3dNodeModel(entry.model)) stickyAllowedIds.add(nodeId);
41
- };
42
- const stickyIds = [
43
- module?.selectedNodeIdJs || null,
44
- module?.draggedNodeId || null,
45
- module?._textOverlayV2State?.editing?.nodeId || null,
46
- module?._editingOverlayState?.nodeId || null,
47
- module?._textOverlayV2State?.selectionNodeId || null,
48
- this._getCurrentHoveredNodeId(module)
49
- ];
50
- for (const stickyId of stickyIds) addStickyId(stickyId);
51
- module?.multiSelectedNodeIds?.forEach?.(addStickyId);
52
-
53
- const visibilityVersion = Number(module?._visibilityVersion || 0);
54
- const normalizedSelectionKey = this._getFullResCssOwnershipKey(module, selectionKey);
55
- const ownsCachedSet =
56
- this._lastFullResCssAllowNodeMap === nodeObjectsById &&
57
- this._lastFullResCssAllowSelectionKey === normalizedSelectionKey &&
58
- this._activeFullResCssNodeIds instanceof Set &&
59
- this._isNodeArrayDirty !== true;
60
- const hasExactDelta =
61
- ownsCachedSet &&
62
- visibilityVersion === this._lastFullResCssAllowVisibilityVersion + 1 &&
63
- module?._lastVisibilityDiffComplete === true &&
64
- Number(module?._lastVisibilityDiffVersion ?? -1) === visibilityVersion;
65
-
66
- if (ownsCachedSet && visibilityVersion === this._lastFullResCssAllowVisibilityVersion) {
67
- stickyAllowedIds.forEach(nodeId => this._activeFullResCssNodeIds.add(nodeId));
68
- return this._activeFullResCssNodeIds;
69
- }
70
-
71
- if (hasExactDelta) {
72
- const allowedIds = this._activeFullResCssNodeIds;
73
- for (const nodeIdValue of module._lastVisibilityExitedIds || []) {
74
- const nodeId = String(nodeIdValue || '').trim();
75
- if (nodeId && !stickyAllowedIds.has(nodeId)) allowedIds.delete(nodeId);
76
- }
77
- for (const nodeIdValue of module._lastVisibilityEnteredIds || []) {
78
- const nodeId = String(nodeIdValue || '').trim();
79
- const entry = nodeObjectsById?.get?.(nodeId) || null;
80
- if (nodeId && entry && supportsCss3dNodeModel(entry.model)) allowedIds.add(nodeId);
81
- }
82
- stickyAllowedIds.forEach(nodeId => allowedIds.add(nodeId));
83
- this._lastFullResCssAllowVisibilityVersion = visibilityVersion;
84
- return allowedIds;
85
- }
86
-
87
- const allowedIds = new Set(stickyAllowedIds);
88
- // Full-res NEAR/NORMAL is the readable CSS3D path. Preserve every
89
- // visible supported owner; exact deltas only avoid rebuilding the set.
90
- if (Array.isArray(prioritizedVisible)) {
91
- for (let i = 0; i < prioritizedVisible.length; i++) {
92
- const nodeId = prioritizedVisible[i]?.nodeId;
93
- if (!nodeId || allowedIds.has(nodeId)) continue;
94
- const entry = nodeObjectsById?.get?.(nodeId) || null;
95
- if (entry && supportsCss3dNodeModel(entry.model)) allowedIds.add(nodeId);
96
- }
97
- }
98
- this._activeFullResCssNodeIds = allowedIds;
99
- this._lastFullResCssAllowVisibilityVersion = visibilityVersion;
100
- this._lastFullResCssAllowSelectionKey = normalizedSelectionKey;
101
- this._lastFullResCssAllowNodeMap = nodeObjectsById;
102
- return allowedIds;
103
- },
104
-
105
- _hasFullResCssReadinessDrift(prioritizedVisible, nodeObjectsById, allowedCssIds,
106
- module = this._module, selectionKey = '') {
107
- const visibilityVersion = Number(module?._visibilityVersion || 0);
108
- const normalizedSelectionKey = this._getFullResCssOwnershipKey(module, selectionKey);
109
- const ownsPendingSet =
110
- this._lastFullResReadinessNodeMap === nodeObjectsById &&
111
- this._lastFullResReadinessSelectionKey === normalizedSelectionKey &&
112
- this._isNodeArrayDirty !== true;
113
- const hasExactDelta =
114
- ownsPendingSet &&
115
- visibilityVersion === this._lastFullResReadinessVisibilityVersion + 1 &&
116
- module?._lastVisibilityDiffComplete === true &&
117
- Number(module?._lastVisibilityDiffVersion ?? -1) === visibilityVersion;
118
-
119
- if (!ownsPendingSet ||
120
- (visibilityVersion !== this._lastFullResReadinessVisibilityVersion && !hasExactDelta)) {
121
- this._fullResCssPendingReadyIds.clear();
122
- for (let i = 0; i < (prioritizedVisible?.length || 0); i++) {
123
- const nodeId = prioritizedVisible[i]?.nodeId;
124
- if (!nodeId || allowedCssIds?.has?.(nodeId) !== true) continue;
125
- const entry = nodeObjectsById?.get?.(nodeId) || null;
126
- if (entry && supportsCss3dNodeModel(entry.model) && this._isFullResCssReady(entry) !== true) {
127
- this._fullResCssPendingReadyIds.add(nodeId);
128
- }
129
- }
130
- } else if (hasExactDelta) {
131
- for (const nodeIdValue of module._lastVisibilityExitedIds || []) {
132
- this._fullResCssPendingReadyIds.delete(String(nodeIdValue || '').trim());
133
- }
134
- for (const nodeIdValue of module._lastVisibilityEnteredIds || []) {
135
- const nodeId = String(nodeIdValue || '').trim();
136
- if (!nodeId || allowedCssIds?.has?.(nodeId) !== true) continue;
137
- const entry = nodeObjectsById?.get?.(nodeId) || null;
138
- if (entry && supportsCss3dNodeModel(entry.model) && this._isFullResCssReady(entry) !== true) {
139
- this._fullResCssPendingReadyIds.add(nodeId);
140
- }
141
- }
142
- }
143
-
144
- for (const nodeId of this._fullResCssPendingReadyIds) {
145
- const entry = nodeObjectsById?.get?.(nodeId) || null;
146
- if (allowedCssIds?.has?.(nodeId) !== true || !entry ||
147
- !supportsCss3dNodeModel(entry.model) || this._isFullResCssReady(entry) === true) {
148
- this._fullResCssPendingReadyIds.delete(nodeId);
149
- }
150
- }
151
- this._lastFullResReadinessVisibilityVersion = visibilityVersion;
152
- this._lastFullResReadinessSelectionKey = normalizedSelectionKey;
153
- this._lastFullResReadinessNodeMap = nodeObjectsById;
154
- return this._fullResCssPendingReadyIds.size > 0;
155
- },
156
-
157
- _restoreCss3dTextSourceForHighDetail(entry) {
158
- const root = entry?.cssObject?.element || null;
159
- if (!root || !isTextLikeModel(entry?.model)) return;
160
- const nodeId = String(entry?.model?.id || entry?.model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
161
- const module = this._module || null;
162
- const overlayV2 = window.MindMapTextOverlayV2 || null;
163
- const overlayActive = !!nodeId && (
164
- overlayV2?.hasSelection?.(module, nodeId) === true ||
165
- overlayV2?.hasEditing?.(module, nodeId) === true
166
- );
167
- if (overlayActive) return;
168
-
169
- const suspensionSelector =
170
- '[data-text-overlay-source-suspended], .mind-map-text-overlay-source-suspended, .mind-map-v2-source-suspended';
171
- if (entry._css3dSourceSuspended !== true && root.matches?.(suspensionSelector) !== true) return;
172
- overlayV2?.resumeSource?.(entry);
173
- const clearSuspendedTarget = (target) => {
174
- if (!target) return;
175
- target.classList?.remove?.('mind-map-v2-source-suspended');
176
- target.classList?.remove?.('mind-map-text-overlay-source-suspended');
177
- target.removeAttribute?.('data-text-overlay-source-suspended');
178
- if (!target.style) return;
179
- target.style.opacity = '';
180
- target.style.pointerEvents = '';
181
- target.style.userSelect = '';
182
- target.style.webkitUserSelect = '';
183
- target.style.caretColor = '';
184
- target.style.contentVisibility = '';
185
- target.style.containIntrinsicSize = '';
186
- target.style.contain = '';
187
- };
188
- clearSuspendedTarget(root);
189
- root.querySelectorAll?.(suspensionSelector)?.forEach?.(clearSuspendedTarget);
190
- entry._css3dSourceSuspended = false;
191
- },
192
-
193
- _getCss3dDetailTargets(entry) {
194
- const root = entry?.cssObject?.element || null;
195
- if (!root) return [];
196
- const cached = entry?._css3dDetailTargetCache || null;
197
- const firstChild = root.firstElementChild || null;
198
- if (cached?.root === root && cached.firstChild === firstChild) return cached.targets;
199
- const targets = [root];
200
- const inner = root.querySelector?.('.node-container') || null;
201
- if (inner && inner !== root) targets.push(inner);
202
- const resolvedTargets = targets.filter(target => !!target?.classList);
203
- entry._css3dDetailTargetCache = { root, firstChild, targets: resolvedTargets };
204
- return resolvedTargets;
205
- },
206
-
207
- _areCss3dDetailTargetsAtLevel(entry, isHigh) {
208
- const targets = this._getCss3dDetailTargets(entry);
209
- if (targets.length === 0) return false;
210
- const expected = isHigh ? 'lod-high' : 'lod-low';
211
- const rejected = isHigh ? 'lod-low' : 'lod-high';
212
- for (let i = 0; i < targets.length; i++) {
213
- const classList = targets[i]?.classList;
214
- if (!classList || classList.contains(expected) !== true || classList.contains(rejected) === true) {
215
- return false;
216
- }
217
- }
218
- return true;
219
- },
220
-
221
- _isCss3dSourceSuspended(entry) {
222
- const root = entry?.cssObject?.element || null;
223
- if (!root) return false;
224
- if (entry._css3dSourceSuspended === true) return true;
225
- return root.matches?.(
226
- '[data-text-overlay-source-suspended],.mind-map-text-overlay-source-suspended,.mind-map-v2-source-suspended') === true;
227
- },
228
-
229
- _isCss3dLowDetail(entry) {
230
- return this._getCss3dDetailTargets(entry)
231
- .some(target => target.classList.contains('lod-low'));
232
- },
233
-
234
- _isFullResCssReady(entry) {
235
- const cssObject = entry?.cssObject || null;
236
- const element = cssObject?.element || null;
237
- if (!cssObject || !element || cssObject.visible !== true || entry?.currentType !== 'CSS') return false;
238
- if (element.style?.display === 'none' || element.style?.visibility === 'hidden' ||
239
- element.style?.opacity === '0') return false;
240
- return this._isCss3dLowDetail(entry) !== true;
241
- },
242
-
243
- _setNodeDetailLevel(entry, level) {
244
- if (!entry?.cssObject?.element) return false;
245
- const targets = this._getCss3dDetailTargets(entry);
246
- if (targets.length === 0) return false;
247
- const isHigh = level === 'HIGH';
248
- const expected = isHigh ? 'lod-high' : 'lod-low';
249
- const rejected = isHigh ? 'lod-low' : 'lod-high';
250
- let changed = false;
251
- for (const target of targets) {
252
- if (target.classList.contains(rejected)) {
253
- target.classList.remove(rejected);
254
- changed = true;
255
- }
256
- if (!target.classList.contains(expected)) {
257
- target.classList.add(expected);
258
- changed = true;
259
- }
260
- }
261
- if (isHigh) this._restoreCss3dTextSourceForHighDetail(entry);
262
- return changed;
263
- },
264
-
265
- _setCss3dLodClass(entry, isHigh) {
266
- this._setNodeDetailLevel(entry, isHigh ? 'HIGH' : 'LOW');
267
- if (getNodeContentType(entry?.model) === 'video' &&
268
- window.MindMapCss3DManager?.syncCss3dVideoLodMediaSource) {
269
- window.MindMapCss3DManager.syncCss3dVideoLodMediaSource(entry.model, entry.cssObject, isHigh === true);
270
- }
271
- },
272
-
273
- _restoreVisibleCss3dHighDetailForNear(nodeObjectsById, module, lodBand) {
274
- // Full-res: NEAR / NORMAL. MID/FAR use resident instances.
275
- if ((lodBand !== 'NEAR' && lodBand !== 'NORMAL') || !nodeObjectsById) return 0;
276
- let restoredCount = 0;
277
- const visitedIds = new Set();
278
- const restoreNode = (nodeIdValue) => {
279
- const nodeId = String(nodeIdValue || '').trim();
280
- if (!nodeId || visitedIds.has(nodeId)) return;
281
- visitedIds.add(nodeId);
282
- const entry = nodeObjectsById.get(nodeId) || null;
283
- const cssElement = entry?.cssObject?.element || null;
284
- const isRecordedVisible = this._nearCssVisibleIds.has(nodeId);
285
- if (!cssElement ||
286
- (entry.cssObject?.visible !== true && !isRecordedVisible) ||
287
- (cssElement.style.display === 'none' && !isRecordedVisible) ||
288
- this._isCss3dLowDetail(entry) !== true) return;
289
- this._setCss3dLodClass(entry, true);
290
- restoredCount++;
291
- };
292
- const visibleIds = module?._visibleIds || module?._prevVisibleIds || null;
293
- visibleIds?.forEach?.(restoreNode);
294
- this._nearCssVisibleIds.forEach(restoreNode);
295
- this._activeFullResCssNodeIds.forEach(restoreNode);
296
- this._fullResImageVisualIds?.forEach?.(restoreNode);
297
- restoreNode(module?.selectedNodeIdJs || module?.selectedNodeId);
298
- restoreNode(module?.draggedNodeId);
299
- module?.multiSelectedNodeIds?.forEach?.(restoreNode);
300
- if (restoredCount > 0 && module) {
301
- module._css3dVisualChangedThisFrame = true;
302
- module._css3dVisualChangedSinceLastRender = true;
303
- }
304
- return restoredCount;
305
- },
306
-
307
- _shouldUseHighCss3dDetail(entry, module) {
308
- const cameraZ = Number(module?.camera?.position?.z || 0);
309
- const cameraBand = getLodBandForCameraZ(cameraZ);
310
- if (cameraBand === 'NEAR' || cameraBand === 'NORMAL') return true;
311
- const nodeId = String(entry?.model?.id || entry?.model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
312
- const selectedNodeId = String(module?.selectedNodeIdJs || module?.selectedNodeId || '').trim();
313
- return !!nodeId && !!selectedNodeId && nodeId === selectedNodeId;
314
- },
315
-
316
- _isFullResCssFringePrewarmBlocked(module) {
317
- return module?.isPanning === true || module?.isZooming === true ||
318
- module?._panSmoothingActive === true || module?._viewSyncMotionActive === true ||
319
- module?._cameraMovingThisFrame === true || module?.isDraggingNode === true ||
320
- module?.isDraggingMultipleNodes === true || module?.isResizing === true ||
321
- module?.isWindowResizing === true;
322
- },
323
-
324
- _clearFullResCssFringePrepared(entry) {
325
- const cssObject = entry?.cssObject || null;
326
- const element = cssObject?.element || null;
327
- const userData = cssObject?.userData || null;
328
- if (!cssObject || userData?._fullResFringePrepared !== true) return false;
329
- const nodeId = String(entry?.model?.id || entry?.model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
330
- const pointerEvents = String(userData._fullResFringePointerEvents ?? '');
331
- delete userData._fullResFringePrepared;
332
- delete userData._fullResFringePointerEvents;
333
- if (element?.style) {
334
- if (pointerEvents) element.style.setProperty?.('pointer-events', pointerEvents, 'important');
335
- else element.style.removeProperty?.('pointer-events');
336
- if (cssObject.visible !== true) {
337
- element.style.setProperty?.('display', 'none', 'important');
338
- element.style.setProperty?.('opacity', '1', 'important');
339
- }
340
- }
341
- if (nodeId) this._fullResCssFringePreparedIds.delete(nodeId);
342
- return true;
343
- },
344
-
345
- _promoteFullResCssFringePrepared(entry) {
346
- const cssObject = entry?.cssObject || null;
347
- const element = cssObject?.element || null;
348
- const userData = cssObject?.userData || null;
349
- if (!cssObject || userData?._fullResFringePrepared !== true) return false;
350
- const nodeId = String(entry?.model?.id || entry?.model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
351
- const pointerEvents = String(userData._fullResFringePointerEvents ?? '');
352
- delete userData._fullResFringePrepared;
353
- delete userData._fullResFringePointerEvents;
354
- delete userData._fullResFringeCreated;
355
- if (element?.style) {
356
- if (pointerEvents) element.style.setProperty?.('pointer-events', pointerEvents, 'important');
357
- else element.style.removeProperty?.('pointer-events');
358
- }
359
- if (nodeId) this._fullResCssFringePreparedIds.delete(nodeId);
360
- return true;
361
- },
362
-
363
- _releaseFullResCssFringeObject(entry) {
364
- const cssObject = entry?.cssObject || null;
365
- if (!cssObject || cssObject.userData?._fullResFringeCreated !== true ||
366
- cssObject.visible === true || entry?.currentType === 'CSS') return false;
367
- this._clearFullResCssFringePrepared(entry);
368
- this._detachCss3dObject(entry);
369
- delete cssObject.userData._fullResFringeCreated;
370
- if (entry.cssObject === cssObject) {
371
- entry.cssObject = null;
372
- entry._css3dDetailTargetCache = null;
373
- }
374
- return true;
375
- },
376
-
377
- _cancelFullResCssFringePrewarm(nodeObjectsById, releaseCreated = true) {
378
- const state = this._fullResCssFringePrewarmState;
379
- if (state?.retryTimer) clearTimeout(state.retryTimer);
380
- if (state) {
381
- state.retryTimer = 0;
382
- state.complete = true;
383
- }
384
- this._fullResCssFringePrewarmState = null;
385
- const nodeMap = nodeObjectsById || state?.nodeObjectsById || null;
386
- for (const nodeId of Array.from(this._fullResCssFringePreparedIds)) {
387
- const entry = nodeMap?.get?.(nodeId) || null;
388
- if (!entry) continue;
389
- if (releaseCreated && this._releaseFullResCssFringeObject(entry)) continue;
390
- this._clearFullResCssFringePrepared(entry);
391
- this._detachCss3dObject(entry);
392
- }
393
- this._fullResCssFringePreparedIds.clear();
394
- this._fullResCssFringePrewarmCandidateCount = 0;
395
- },
396
-
397
- _prepareFullResCssFringeLayout(entry, module, nodeIdValue) {
398
- const cssObject = entry?.cssObject || null;
399
- const element = cssObject?.element || null;
400
- const nodeId = String(nodeIdValue || entry?.model?.id || entry?.model?.Id || '').trim();
401
- if (!cssObject || !element || !nodeId || cssObject.visible === true || entry?.currentType === 'CSS' ||
402
- this._nearCssVisibleIds.has(nodeId)) return false;
403
- if (cssObject.userData?._fullResFringePrepared === true) {
404
- this._fullResCssFringePreparedIds.add(nodeId);
405
- return false;
406
- }
407
- const cssScene = module?.cssScene || module?.scene || null;
408
- if (!cssScene) return false;
409
- if (cssObject.parent !== cssScene) cssScene.add(cssObject);
410
- const glPos = entry.glObject?.position || null;
411
- if (glPos) cssObject.position.copy(glPos);
412
- cssObject.visible = false;
413
- cssObject.userData ||= {};
414
- cssObject.userData._fullResFringePrepared = true;
415
- cssObject.userData._fullResFringePointerEvents = element.style?.pointerEvents || '';
416
- element.style?.setProperty?.('visibility', 'visible', 'important');
417
- element.style?.setProperty?.('opacity', '0', 'important');
418
- element.style?.setProperty?.('pointer-events', 'none', 'important');
419
- element.style?.setProperty?.('display', 'block', 'important');
420
- const rootStyle = element.firstElementChild?.style || null;
421
- rootStyle?.setProperty?.('content-visibility', 'visible', 'important');
422
- rootStyle?.setProperty?.('contain-intrinsic-size', 'auto', 'important');
423
- const cameraElement = module?.cssRenderer?.getCameraElement?.() || null;
424
- if (cameraElement && element.parentNode !== cameraElement) cameraElement.appendChild(element);
425
- cssObject.updateMatrixWorld?.(true);
426
- module?.cssRenderer?.prepareObjectLayout?.(cssObject);
427
- this._fullResCssFringePreparedIds.add(nodeId);
428
- this._fullResCssFringeLayoutWarmCount = Number(this._fullResCssFringeLayoutWarmCount || 0) + 1;
429
- return true;
430
- },
431
-
432
- _retryFullResCssFringePrewarm(state, delayMs = 80) {
433
- if (!state || state.retryTimer) return;
434
- state.retryTimer = setTimeout(() => {
435
- state.retryTimer = 0;
436
- if (this._fullResCssFringePrewarmState === state) this._queueFullResCssFringePrewarm(state);
437
- }, delayMs);
438
- },
439
-
440
- _queueFullResCssFringePrewarm(state) {
441
- if (!state || state.scheduled || state.complete || this._fullResCssFringePrewarmState !== state) return false;
442
- state.scheduled = true;
443
- const run = (deadline) => {
444
- state.scheduled = false;
445
- if (this._fullResCssFringePrewarmState !== state || this._disposed === true ||
446
- this._module !== state.module || state.module?.nodeObjectsById !== state.nodeObjectsById) return;
447
- if (this.isLoading === true || state.module?.isLoading === true || this.isInLODMode !== false) return;
448
- if (this._isFullResCssFringePrewarmBlocked(state.module)) {
449
- this._retryFullResCssFringePrewarm(state);
450
- return;
451
- }
452
- const hasIdleTime = () =>
453
- !deadline || typeof deadline.timeRemaining !== 'function' || deadline.timeRemaining() > 1;
454
-
455
- if (!state.scanComplete) {
456
- state.entryIterator ||= state.nodeObjectsById.values();
457
- const scanStartedAt = performance.now();
458
- let scanned = 0;
459
- let iteratorDone = false;
460
- while (scanned < 192 &&
461
- (scanned === 0 || performance.now() - scanStartedAt < 2 || hasIdleTime())) {
462
- const next = state.entryIterator.next();
463
- if (next.done) {
464
- iteratorDone = true;
465
- break;
466
- }
467
- const entry = next.value;
468
- const model = entry?.model || null;
469
- const nodeId = String(model?.id || model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
470
- const cssAlreadyVisible = !!nodeId && (
471
- entry?.cssObject?.visible === true || entry?.currentType === 'CSS' ||
472
- this._nearCssVisibleIds.has(nodeId)
473
- );
474
- if (!model || !isTextLikeModel(model) || isLivePortalCssLodModel(model) ||
475
- hasAgentConsoleOpenForEntry(entry) || cssAlreadyVisible) {
476
- scanned++;
477
- continue;
478
- }
479
- const position = entry.glObject?.position || entry.cssObject?.position || null;
480
- const x = Number(position?.x ?? model.x ?? model.X ?? 0);
481
- const y = Number(position?.y ?? model.y ?? model.Y ?? 0);
482
- const width = Math.max(1, Number(model.width ?? model.Width ?? 400));
483
- const height = Math.max(1, Number(model.height ?? model.Height ?? 200));
484
- const halfW = width * 0.5;
485
- const halfH = height * 0.5;
486
- if (x + halfW >= state.rect.left && x - halfW <= state.rect.right &&
487
- y + halfH >= state.rect.bottom && y - halfH <= state.rect.top && nodeId) {
488
- const dx = x - state.centerX;
489
- const dy = y - state.centerY;
490
- state.candidates.push({ nodeId, distSq: dx * dx + dy * dy });
491
- }
492
- scanned++;
493
- }
494
- if (!iteratorDone) {
495
- this._queueFullResCssFringePrewarm(state);
496
- return;
497
- }
498
- state.candidates.sort((a, b) => a.distSq - b.distSq);
499
- if (state.candidates.length > state.maxCandidates) state.candidates.length = state.maxCandidates;
500
- const nextPreparedIds = new Set(state.candidates.map(candidate => candidate.nodeId));
501
- const currentVisibleIds = state.module?._visibleIds || state.module?._prevVisibleIds || null;
502
- for (const preparedNodeId of Array.from(this._fullResCssFringePreparedIds)) {
503
- if (nextPreparedIds.has(preparedNodeId) || currentVisibleIds?.has?.(preparedNodeId)) continue;
504
- const preparedEntry = state.nodeObjectsById.get(preparedNodeId) || null;
505
- if (!preparedEntry) {
506
- this._fullResCssFringePreparedIds.delete(preparedNodeId);
507
- continue;
508
- }
509
- if (!this._releaseFullResCssFringeObject(preparedEntry)) {
510
- this._clearFullResCssFringePrepared(preparedEntry);
511
- this._detachCss3dObject(preparedEntry);
512
- }
513
- }
514
- state.scanComplete = true;
515
- this._fullResCssFringePrewarmCandidateCount = state.candidates.length;
516
- }
517
-
518
- const prepareStartedAt = performance.now();
519
- let processed = 0;
520
- while (state.candidateCursor < state.candidates.length && processed < 2 &&
521
- (processed === 0 || (performance.now() - prepareStartedAt < 4 && hasIdleTime()))) {
522
- const candidate = state.candidates[state.candidateCursor++];
523
- processed++;
524
- const entry = state.nodeObjectsById.get(candidate.nodeId) || null;
525
- if (!entry || !isTextLikeModel(entry.model) || isLivePortalCssLodModel(entry.model) ||
526
- hasAgentConsoleOpenForEntry(entry)) continue;
527
- let didPrepare = false;
528
- if (!entry.cssObject) {
529
- didPrepare = this._ensureHiddenCss3dObject(entry, state.module) === true;
530
- if (didPrepare && entry.cssObject?.userData) {
531
- entry.cssObject.userData._fullResFringeCreated = true;
532
- }
533
- }
534
- if (entry.cssObject && entry.isCssDirty === true &&
535
- window.MindMapCss3DManager?.syncCss3dContent) {
536
- entry._css3dDetailTargetCache = null;
537
- window.MindMapCss3DManager.syncCss3dContent(entry.model, entry.cssObject);
538
- entry.isCssDirty = false;
539
- didPrepare = true;
540
- }
541
- this._prepareFullResCssFringeLayout(entry, state.module, candidate.nodeId);
542
- if (didPrepare) {
543
- this._fullResCssFringePrewarmCount = Number(this._fullResCssFringePrewarmCount || 0) + 1;
544
- }
545
- }
546
- if (state.candidateCursor >= state.candidates.length) {
547
- state.complete = true;
548
- return;
549
- }
550
- this._queueFullResCssFringePrewarm(state);
551
- };
552
- if (typeof globalThis.requestIdleCallback === 'function') {
553
- globalThis.requestIdleCallback(run, { timeout: 140 });
554
- } else {
555
- setTimeout(() => run({ timeRemaining: () => 4, didTimeout: true }), 16);
556
- }
557
- return true;
558
- },
559
-
560
- _scheduleFullResCssFringePrewarm(nodeObjectsById, module = this._module) {
561
- if (!nodeObjectsById?.values || !module || this._disposed === true || this.isLoading === true ||
562
- module.isLoading === true || this.isInLODMode !== false ||
563
- this._isFullResCssFringePrewarmBlocked(module)) return false;
564
- const normalBoundary = Number(this.constructor?.LOD_THRESHOLDS?.NORMAL || 9000);
565
- const cameraZ = Number(module.camera?.position?.z || 0);
566
- const viewportRect = module._lastVisibilityViewportWorldRect || null;
567
- if (!(cameraZ > 0) || cameraZ >= normalBoundary || viewportRect?.mode !== 'full-res') return false;
568
- const centerX = Number(module.camera?.position?.x || 0);
569
- const centerY = Number(module.camera?.position?.y || 0);
570
- const currentHalfW = Math.max(1, (Number(viewportRect.right) - Number(viewportRect.left)) * 0.5);
571
- const currentHalfH = Math.max(1, (Number(viewportRect.top) - Number(viewportRect.bottom)) * 0.5);
572
- if (!Number.isFinite(currentHalfW) || !Number.isFinite(currentHalfH)) return false;
573
- const boundaryScale = Math.max(1.15, Math.min(4,
574
- (normalBoundary / Math.max(2250, cameraZ)) * 1.08));
575
- const halfW = currentHalfW * boundaryScale;
576
- const halfH = currentHalfH * boundaryScale;
577
- const visibleCount = Number(module._visibleIds?.size || module._prevVisibleIds?.size || 0);
578
- const maxCandidates = Math.min(320, Math.max(160, Math.ceil(visibleCount * 3)));
579
- const key = [
580
- Number(nodeObjectsById.size || 0),
581
- Math.round(centerX / 250),
582
- Math.round(centerY / 250),
583
- Math.round(halfW / 250),
584
- Math.round(halfH / 250),
585
- maxCandidates
586
- ].join('|');
587
- let state = this._fullResCssFringePrewarmState;
588
- if (!state || state.key !== key || state.module !== module || state.nodeObjectsById !== nodeObjectsById) {
589
- if (state?.retryTimer) clearTimeout(state.retryTimer);
590
- state = {
591
- key, module, nodeObjectsById, centerX, centerY, maxCandidates,
592
- rect: {
593
- left: centerX - halfW,
594
- right: centerX + halfW,
595
- bottom: centerY - halfH,
596
- top: centerY + halfH
597
- },
598
- entryIterator: null,
599
- scanComplete: false,
600
- candidates: [],
601
- candidateCursor: 0,
602
- scheduled: false,
603
- retryTimer: 0,
604
- complete: false
605
- };
606
- this._fullResCssFringePrewarmState = state;
607
- }
608
- if (state.complete) return false;
609
- return this._queueFullResCssFringePrewarm(state);
610
- }
611
- });
612
-
613
- Object.defineProperty(prototype, '_normalBoundaryOptimizerBuild', {
614
- configurable: true,
615
- value: BUILD_ID
616
- });
617
- window.MindCanvasBuildInfo?.registerPart?.('normalBoundaryOptimizer', BUILD_ID, {
618
- file: 'mind-map-normal-boundary-optimizer.js'
619
- });
620
- return true;
621
- }
622
-
623
- window.MindMapNormalBoundaryOptimizer = Object.freeze({ BUILD_ID, install });
624
- })();
1
+ (function () {
2
+ 'use strict';
3
+
4
+ const BUILD_ID = '20260713-normal-boundary-optimizer-v002';
5
+
6
+ function install(prototype, helpers = {}) {
7
+ if (!prototype || prototype._normalBoundaryOptimizerBuild === BUILD_ID) return true;
8
+
9
+ const supportsCss3dNodeModel = helpers.supportsCss3dNodeModel;
10
+ const isTextLikeModel = helpers.isTextLikeModel;
11
+ const isLivePortalCssLodModel = helpers.isLivePortalCssLodModel;
12
+ const hasAgentConsoleOpenForEntry = helpers.hasAgentConsoleOpenForEntry;
13
+ const getNodeContentType = helpers.getNodeContentType;
14
+ const getLodBandForCameraZ = helpers.getLodBandForCameraZ;
15
+ if ([supportsCss3dNodeModel, isTextLikeModel, isLivePortalCssLodModel,
16
+ hasAgentConsoleOpenForEntry, getNodeContentType, getLodBandForCameraZ]
17
+ .some(value => typeof value !== 'function')) {
18
+ throw new Error('[NormalBoundaryOptimizer] Missing LOD renderer helper contract.');
19
+ }
20
+
21
+ Object.assign(prototype, {
22
+ _getFullResCssOwnershipKey(module, selectionKey = '') {
23
+ return [
24
+ String(selectionKey || ''),
25
+ String(module?.draggedNodeId || ''),
26
+ String(module?._textOverlayV2State?.editing?.nodeId || ''),
27
+ String(module?._editingOverlayState?.nodeId || ''),
28
+ String(module?._textOverlayV2State?.selectionNodeId || ''),
29
+ String(this._getCurrentHoveredNodeId(module) || '')
30
+ ].join('|');
31
+ },
32
+
33
+ _buildFullResCssAllowSet(prioritizedVisible, nodeObjectsById, module = this._module,
34
+ lodBand = this._currentLodBand, selectionKey = '') {
35
+ const stickyAllowedIds = new Set();
36
+ const addStickyId = (value) => {
37
+ const nodeId = String(value || '').trim();
38
+ if (!nodeId) return;
39
+ const entry = nodeObjectsById?.get?.(nodeId) || null;
40
+ if (entry && supportsCss3dNodeModel(entry.model)) stickyAllowedIds.add(nodeId);
41
+ };
42
+ const stickyIds = [
43
+ module?.selectedNodeIdJs || null,
44
+ module?.draggedNodeId || null,
45
+ module?._textOverlayV2State?.editing?.nodeId || null,
46
+ module?._editingOverlayState?.nodeId || null,
47
+ module?._textOverlayV2State?.selectionNodeId || null,
48
+ this._getCurrentHoveredNodeId(module)
49
+ ];
50
+ for (const stickyId of stickyIds) addStickyId(stickyId);
51
+ module?.multiSelectedNodeIds?.forEach?.(addStickyId);
52
+
53
+ const visibilityVersion = Number(module?._visibilityVersion || 0);
54
+ const normalizedSelectionKey = this._getFullResCssOwnershipKey(module, selectionKey);
55
+ const ownsCachedSet =
56
+ this._lastFullResCssAllowNodeMap === nodeObjectsById &&
57
+ this._lastFullResCssAllowSelectionKey === normalizedSelectionKey &&
58
+ this._activeFullResCssNodeIds instanceof Set &&
59
+ this._isNodeArrayDirty !== true;
60
+ const hasExactDelta =
61
+ ownsCachedSet &&
62
+ visibilityVersion === this._lastFullResCssAllowVisibilityVersion + 1 &&
63
+ module?._lastVisibilityDiffComplete === true &&
64
+ Number(module?._lastVisibilityDiffVersion ?? -1) === visibilityVersion;
65
+
66
+ if (ownsCachedSet && visibilityVersion === this._lastFullResCssAllowVisibilityVersion) {
67
+ stickyAllowedIds.forEach(nodeId => this._activeFullResCssNodeIds.add(nodeId));
68
+ return this._activeFullResCssNodeIds;
69
+ }
70
+
71
+ if (hasExactDelta) {
72
+ const allowedIds = this._activeFullResCssNodeIds;
73
+ for (const nodeIdValue of module._lastVisibilityExitedIds || []) {
74
+ const nodeId = String(nodeIdValue || '').trim();
75
+ if (nodeId && !stickyAllowedIds.has(nodeId)) allowedIds.delete(nodeId);
76
+ }
77
+ for (const nodeIdValue of module._lastVisibilityEnteredIds || []) {
78
+ const nodeId = String(nodeIdValue || '').trim();
79
+ const entry = nodeObjectsById?.get?.(nodeId) || null;
80
+ if (nodeId && entry && supportsCss3dNodeModel(entry.model)) allowedIds.add(nodeId);
81
+ }
82
+ stickyAllowedIds.forEach(nodeId => allowedIds.add(nodeId));
83
+ this._lastFullResCssAllowVisibilityVersion = visibilityVersion;
84
+ return allowedIds;
85
+ }
86
+
87
+ const allowedIds = new Set(stickyAllowedIds);
88
+ // Full-res NEAR/NORMAL is the readable CSS3D path. Preserve every
89
+ // visible supported owner; exact deltas only avoid rebuilding the set.
90
+ if (Array.isArray(prioritizedVisible)) {
91
+ for (let i = 0; i < prioritizedVisible.length; i++) {
92
+ const nodeId = prioritizedVisible[i]?.nodeId;
93
+ if (!nodeId || allowedIds.has(nodeId)) continue;
94
+ const entry = nodeObjectsById?.get?.(nodeId) || null;
95
+ if (entry && supportsCss3dNodeModel(entry.model)) allowedIds.add(nodeId);
96
+ }
97
+ }
98
+ this._activeFullResCssNodeIds = allowedIds;
99
+ this._lastFullResCssAllowVisibilityVersion = visibilityVersion;
100
+ this._lastFullResCssAllowSelectionKey = normalizedSelectionKey;
101
+ this._lastFullResCssAllowNodeMap = nodeObjectsById;
102
+ return allowedIds;
103
+ },
104
+
105
+ _hasFullResCssReadinessDrift(prioritizedVisible, nodeObjectsById, allowedCssIds,
106
+ module = this._module, selectionKey = '') {
107
+ const visibilityVersion = Number(module?._visibilityVersion || 0);
108
+ const normalizedSelectionKey = this._getFullResCssOwnershipKey(module, selectionKey);
109
+ const ownsPendingSet =
110
+ this._lastFullResReadinessNodeMap === nodeObjectsById &&
111
+ this._lastFullResReadinessSelectionKey === normalizedSelectionKey &&
112
+ this._isNodeArrayDirty !== true;
113
+ const hasExactDelta =
114
+ ownsPendingSet &&
115
+ visibilityVersion === this._lastFullResReadinessVisibilityVersion + 1 &&
116
+ module?._lastVisibilityDiffComplete === true &&
117
+ Number(module?._lastVisibilityDiffVersion ?? -1) === visibilityVersion;
118
+
119
+ if (!ownsPendingSet ||
120
+ (visibilityVersion !== this._lastFullResReadinessVisibilityVersion && !hasExactDelta)) {
121
+ this._fullResCssPendingReadyIds.clear();
122
+ for (let i = 0; i < (prioritizedVisible?.length || 0); i++) {
123
+ const nodeId = prioritizedVisible[i]?.nodeId;
124
+ if (!nodeId || allowedCssIds?.has?.(nodeId) !== true) continue;
125
+ const entry = nodeObjectsById?.get?.(nodeId) || null;
126
+ if (entry && supportsCss3dNodeModel(entry.model) && this._isFullResCssReady(entry) !== true) {
127
+ this._fullResCssPendingReadyIds.add(nodeId);
128
+ }
129
+ }
130
+ } else if (hasExactDelta) {
131
+ for (const nodeIdValue of module._lastVisibilityExitedIds || []) {
132
+ this._fullResCssPendingReadyIds.delete(String(nodeIdValue || '').trim());
133
+ }
134
+ for (const nodeIdValue of module._lastVisibilityEnteredIds || []) {
135
+ const nodeId = String(nodeIdValue || '').trim();
136
+ if (!nodeId || allowedCssIds?.has?.(nodeId) !== true) continue;
137
+ const entry = nodeObjectsById?.get?.(nodeId) || null;
138
+ if (entry && supportsCss3dNodeModel(entry.model) && this._isFullResCssReady(entry) !== true) {
139
+ this._fullResCssPendingReadyIds.add(nodeId);
140
+ }
141
+ }
142
+ }
143
+
144
+ for (const nodeId of this._fullResCssPendingReadyIds) {
145
+ const entry = nodeObjectsById?.get?.(nodeId) || null;
146
+ if (allowedCssIds?.has?.(nodeId) !== true || !entry ||
147
+ !supportsCss3dNodeModel(entry.model) || this._isFullResCssReady(entry) === true) {
148
+ this._fullResCssPendingReadyIds.delete(nodeId);
149
+ }
150
+ }
151
+ this._lastFullResReadinessVisibilityVersion = visibilityVersion;
152
+ this._lastFullResReadinessSelectionKey = normalizedSelectionKey;
153
+ this._lastFullResReadinessNodeMap = nodeObjectsById;
154
+ return this._fullResCssPendingReadyIds.size > 0;
155
+ },
156
+
157
+ _restoreCss3dTextSourceForHighDetail(entry) {
158
+ const root = entry?.cssObject?.element || null;
159
+ if (!root || !isTextLikeModel(entry?.model)) return;
160
+ const nodeId = String(entry?.model?.id || entry?.model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
161
+ const module = this._module || null;
162
+ const overlayV2 = window.MindMapTextOverlayV2 || null;
163
+ const overlayActive = !!nodeId && (
164
+ overlayV2?.hasSelection?.(module, nodeId) === true ||
165
+ overlayV2?.hasEditing?.(module, nodeId) === true
166
+ );
167
+ if (overlayActive) return;
168
+
169
+ const suspensionSelector =
170
+ '[data-text-overlay-source-suspended], .mind-map-text-overlay-source-suspended, .mind-map-v2-source-suspended';
171
+ if (entry._css3dSourceSuspended !== true && root.matches?.(suspensionSelector) !== true) return;
172
+ overlayV2?.resumeSource?.(entry);
173
+ const clearSuspendedTarget = (target) => {
174
+ if (!target) return;
175
+ target.classList?.remove?.('mind-map-v2-source-suspended');
176
+ target.classList?.remove?.('mind-map-text-overlay-source-suspended');
177
+ target.removeAttribute?.('data-text-overlay-source-suspended');
178
+ if (!target.style) return;
179
+ target.style.opacity = '';
180
+ target.style.pointerEvents = '';
181
+ target.style.userSelect = '';
182
+ target.style.webkitUserSelect = '';
183
+ target.style.caretColor = '';
184
+ target.style.contentVisibility = '';
185
+ target.style.containIntrinsicSize = '';
186
+ target.style.contain = '';
187
+ };
188
+ clearSuspendedTarget(root);
189
+ root.querySelectorAll?.(suspensionSelector)?.forEach?.(clearSuspendedTarget);
190
+ entry._css3dSourceSuspended = false;
191
+ },
192
+
193
+ _getCss3dDetailTargets(entry) {
194
+ const root = entry?.cssObject?.element || null;
195
+ if (!root) return [];
196
+ const cached = entry?._css3dDetailTargetCache || null;
197
+ const firstChild = root.firstElementChild || null;
198
+ if (cached?.root === root && cached.firstChild === firstChild) return cached.targets;
199
+ const targets = [root];
200
+ const inner = root.querySelector?.('.node-container') || null;
201
+ if (inner && inner !== root) targets.push(inner);
202
+ const resolvedTargets = targets.filter(target => !!target?.classList);
203
+ entry._css3dDetailTargetCache = { root, firstChild, targets: resolvedTargets };
204
+ return resolvedTargets;
205
+ },
206
+
207
+ _areCss3dDetailTargetsAtLevel(entry, isHigh) {
208
+ const targets = this._getCss3dDetailTargets(entry);
209
+ if (targets.length === 0) return false;
210
+ const expected = isHigh ? 'lod-high' : 'lod-low';
211
+ const rejected = isHigh ? 'lod-low' : 'lod-high';
212
+ for (let i = 0; i < targets.length; i++) {
213
+ const classList = targets[i]?.classList;
214
+ if (!classList || classList.contains(expected) !== true || classList.contains(rejected) === true) {
215
+ return false;
216
+ }
217
+ }
218
+ return true;
219
+ },
220
+
221
+ _isCss3dSourceSuspended(entry) {
222
+ const root = entry?.cssObject?.element || null;
223
+ if (!root) return false;
224
+ if (entry._css3dSourceSuspended === true) return true;
225
+ return root.matches?.(
226
+ '[data-text-overlay-source-suspended],.mind-map-text-overlay-source-suspended,.mind-map-v2-source-suspended') === true;
227
+ },
228
+
229
+ _isCss3dLowDetail(entry) {
230
+ return this._getCss3dDetailTargets(entry)
231
+ .some(target => target.classList.contains('lod-low'));
232
+ },
233
+
234
+ _isFullResCssReady(entry) {
235
+ const cssObject = entry?.cssObject || null;
236
+ const element = cssObject?.element || null;
237
+ if (!cssObject || !element || cssObject.visible !== true || entry?.currentType !== 'CSS') return false;
238
+ if (element.style?.display === 'none' || element.style?.visibility === 'hidden' ||
239
+ element.style?.opacity === '0') return false;
240
+ return this._isCss3dLowDetail(entry) !== true;
241
+ },
242
+
243
+ _setNodeDetailLevel(entry, level) {
244
+ if (!entry?.cssObject?.element) return false;
245
+ const targets = this._getCss3dDetailTargets(entry);
246
+ if (targets.length === 0) return false;
247
+ const isHigh = level === 'HIGH';
248
+ const expected = isHigh ? 'lod-high' : 'lod-low';
249
+ const rejected = isHigh ? 'lod-low' : 'lod-high';
250
+ let changed = false;
251
+ for (const target of targets) {
252
+ if (target.classList.contains(rejected)) {
253
+ target.classList.remove(rejected);
254
+ changed = true;
255
+ }
256
+ if (!target.classList.contains(expected)) {
257
+ target.classList.add(expected);
258
+ changed = true;
259
+ }
260
+ }
261
+ if (isHigh) this._restoreCss3dTextSourceForHighDetail(entry);
262
+ return changed;
263
+ },
264
+
265
+ _setCss3dLodClass(entry, isHigh) {
266
+ this._setNodeDetailLevel(entry, isHigh ? 'HIGH' : 'LOW');
267
+ if (getNodeContentType(entry?.model) === 'video' &&
268
+ window.MindMapCss3DManager?.syncCss3dVideoLodMediaSource) {
269
+ window.MindMapCss3DManager.syncCss3dVideoLodMediaSource(entry.model, entry.cssObject, isHigh === true);
270
+ }
271
+ },
272
+
273
+ _restoreVisibleCss3dHighDetailForNear(nodeObjectsById, module, lodBand) {
274
+ // Full-res: NEAR / NORMAL. MID/FAR use resident instances.
275
+ if ((lodBand !== 'NEAR' && lodBand !== 'NORMAL') || !nodeObjectsById) return 0;
276
+ let restoredCount = 0;
277
+ const visitedIds = new Set();
278
+ const restoreNode = (nodeIdValue) => {
279
+ const nodeId = String(nodeIdValue || '').trim();
280
+ if (!nodeId || visitedIds.has(nodeId)) return;
281
+ visitedIds.add(nodeId);
282
+ const entry = nodeObjectsById.get(nodeId) || null;
283
+ const cssElement = entry?.cssObject?.element || null;
284
+ const isRecordedVisible = this._nearCssVisibleIds.has(nodeId);
285
+ if (!cssElement ||
286
+ (entry.cssObject?.visible !== true && !isRecordedVisible) ||
287
+ (cssElement.style.display === 'none' && !isRecordedVisible) ||
288
+ this._isCss3dLowDetail(entry) !== true) return;
289
+ this._setCss3dLodClass(entry, true);
290
+ restoredCount++;
291
+ };
292
+ const visibleIds = module?._visibleIds || module?._prevVisibleIds || null;
293
+ visibleIds?.forEach?.(restoreNode);
294
+ this._nearCssVisibleIds.forEach(restoreNode);
295
+ this._activeFullResCssNodeIds.forEach(restoreNode);
296
+ this._fullResImageVisualIds?.forEach?.(restoreNode);
297
+ restoreNode(module?.selectedNodeIdJs || module?.selectedNodeId);
298
+ restoreNode(module?.draggedNodeId);
299
+ module?.multiSelectedNodeIds?.forEach?.(restoreNode);
300
+ if (restoredCount > 0 && module) {
301
+ module._css3dVisualChangedThisFrame = true;
302
+ module._css3dVisualChangedSinceLastRender = true;
303
+ }
304
+ return restoredCount;
305
+ },
306
+
307
+ _shouldUseHighCss3dDetail(entry, module) {
308
+ const cameraZ = Number(module?.camera?.position?.z || 0);
309
+ const cameraBand = getLodBandForCameraZ(cameraZ);
310
+ if (cameraBand === 'NEAR' || cameraBand === 'NORMAL') return true;
311
+ const nodeId = String(entry?.model?.id || entry?.model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
312
+ const selectedNodeId = String(module?.selectedNodeIdJs || module?.selectedNodeId || '').trim();
313
+ return !!nodeId && !!selectedNodeId && nodeId === selectedNodeId;
314
+ },
315
+
316
+ _isFullResCssFringePrewarmBlocked(module) {
317
+ return module?.isPanning === true || module?.isZooming === true ||
318
+ module?._panSmoothingActive === true || module?._viewSyncMotionActive === true ||
319
+ module?._cameraMovingThisFrame === true || module?.isDraggingNode === true ||
320
+ module?.isDraggingMultipleNodes === true || module?.isResizing === true ||
321
+ module?.isWindowResizing === true;
322
+ },
323
+
324
+ _clearFullResCssFringePrepared(entry) {
325
+ const cssObject = entry?.cssObject || null;
326
+ const element = cssObject?.element || null;
327
+ const userData = cssObject?.userData || null;
328
+ if (!cssObject || userData?._fullResFringePrepared !== true) return false;
329
+ const nodeId = String(entry?.model?.id || entry?.model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
330
+ const pointerEvents = String(userData._fullResFringePointerEvents ?? '');
331
+ delete userData._fullResFringePrepared;
332
+ delete userData._fullResFringePointerEvents;
333
+ if (element?.style) {
334
+ if (pointerEvents) element.style.setProperty?.('pointer-events', pointerEvents, 'important');
335
+ else element.style.removeProperty?.('pointer-events');
336
+ if (cssObject.visible !== true) {
337
+ element.style.setProperty?.('display', 'none', 'important');
338
+ element.style.setProperty?.('opacity', '1', 'important');
339
+ }
340
+ }
341
+ if (nodeId) this._fullResCssFringePreparedIds.delete(nodeId);
342
+ return true;
343
+ },
344
+
345
+ _promoteFullResCssFringePrepared(entry) {
346
+ const cssObject = entry?.cssObject || null;
347
+ const element = cssObject?.element || null;
348
+ const userData = cssObject?.userData || null;
349
+ if (!cssObject || userData?._fullResFringePrepared !== true) return false;
350
+ const nodeId = String(entry?.model?.id || entry?.model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
351
+ const pointerEvents = String(userData._fullResFringePointerEvents ?? '');
352
+ delete userData._fullResFringePrepared;
353
+ delete userData._fullResFringePointerEvents;
354
+ delete userData._fullResFringeCreated;
355
+ if (element?.style) {
356
+ if (pointerEvents) element.style.setProperty?.('pointer-events', pointerEvents, 'important');
357
+ else element.style.removeProperty?.('pointer-events');
358
+ }
359
+ if (nodeId) this._fullResCssFringePreparedIds.delete(nodeId);
360
+ return true;
361
+ },
362
+
363
+ _releaseFullResCssFringeObject(entry) {
364
+ const cssObject = entry?.cssObject || null;
365
+ if (!cssObject || cssObject.userData?._fullResFringeCreated !== true ||
366
+ cssObject.visible === true || entry?.currentType === 'CSS') return false;
367
+ this._clearFullResCssFringePrepared(entry);
368
+ this._detachCss3dObject(entry);
369
+ delete cssObject.userData._fullResFringeCreated;
370
+ if (entry.cssObject === cssObject) {
371
+ entry.cssObject = null;
372
+ entry._css3dDetailTargetCache = null;
373
+ }
374
+ return true;
375
+ },
376
+
377
+ _cancelFullResCssFringePrewarm(nodeObjectsById, releaseCreated = true) {
378
+ const state = this._fullResCssFringePrewarmState;
379
+ if (state?.retryTimer) clearTimeout(state.retryTimer);
380
+ if (state) {
381
+ state.retryTimer = 0;
382
+ state.complete = true;
383
+ }
384
+ this._fullResCssFringePrewarmState = null;
385
+ const nodeMap = nodeObjectsById || state?.nodeObjectsById || null;
386
+ for (const nodeId of Array.from(this._fullResCssFringePreparedIds)) {
387
+ const entry = nodeMap?.get?.(nodeId) || null;
388
+ if (!entry) continue;
389
+ if (releaseCreated && this._releaseFullResCssFringeObject(entry)) continue;
390
+ this._clearFullResCssFringePrepared(entry);
391
+ this._detachCss3dObject(entry);
392
+ }
393
+ this._fullResCssFringePreparedIds.clear();
394
+ this._fullResCssFringePrewarmCandidateCount = 0;
395
+ },
396
+
397
+ _prepareFullResCssFringeLayout(entry, module, nodeIdValue) {
398
+ const cssObject = entry?.cssObject || null;
399
+ const element = cssObject?.element || null;
400
+ const nodeId = String(nodeIdValue || entry?.model?.id || entry?.model?.Id || '').trim();
401
+ if (!cssObject || !element || !nodeId || cssObject.visible === true || entry?.currentType === 'CSS' ||
402
+ this._nearCssVisibleIds.has(nodeId)) return false;
403
+ if (cssObject.userData?._fullResFringePrepared === true) {
404
+ this._fullResCssFringePreparedIds.add(nodeId);
405
+ return false;
406
+ }
407
+ const cssScene = module?.cssScene || module?.scene || null;
408
+ if (!cssScene) return false;
409
+ if (cssObject.parent !== cssScene) cssScene.add(cssObject);
410
+ const glPos = entry.glObject?.position || null;
411
+ if (glPos) cssObject.position.copy(glPos);
412
+ cssObject.visible = false;
413
+ cssObject.userData ||= {};
414
+ cssObject.userData._fullResFringePrepared = true;
415
+ cssObject.userData._fullResFringePointerEvents = element.style?.pointerEvents || '';
416
+ element.style?.setProperty?.('visibility', 'visible', 'important');
417
+ element.style?.setProperty?.('opacity', '0', 'important');
418
+ element.style?.setProperty?.('pointer-events', 'none', 'important');
419
+ element.style?.setProperty?.('display', 'block', 'important');
420
+ const rootStyle = element.firstElementChild?.style || null;
421
+ rootStyle?.setProperty?.('content-visibility', 'visible', 'important');
422
+ rootStyle?.setProperty?.('contain-intrinsic-size', 'auto', 'important');
423
+ const cameraElement = module?.cssRenderer?.getCameraElement?.() || null;
424
+ if (cameraElement && element.parentNode !== cameraElement) cameraElement.appendChild(element);
425
+ cssObject.updateMatrixWorld?.(true);
426
+ module?.cssRenderer?.prepareObjectLayout?.(cssObject);
427
+ this._fullResCssFringePreparedIds.add(nodeId);
428
+ this._fullResCssFringeLayoutWarmCount = Number(this._fullResCssFringeLayoutWarmCount || 0) + 1;
429
+ return true;
430
+ },
431
+
432
+ _retryFullResCssFringePrewarm(state, delayMs = 80) {
433
+ if (!state || state.retryTimer) return;
434
+ state.retryTimer = setTimeout(() => {
435
+ state.retryTimer = 0;
436
+ if (this._fullResCssFringePrewarmState === state) this._queueFullResCssFringePrewarm(state);
437
+ }, delayMs);
438
+ },
439
+
440
+ _queueFullResCssFringePrewarm(state) {
441
+ if (!state || state.scheduled || state.complete || this._fullResCssFringePrewarmState !== state) return false;
442
+ state.scheduled = true;
443
+ const run = (deadline) => {
444
+ state.scheduled = false;
445
+ if (this._fullResCssFringePrewarmState !== state || this._disposed === true ||
446
+ this._module !== state.module || state.module?.nodeObjectsById !== state.nodeObjectsById) return;
447
+ if (this.isLoading === true || state.module?.isLoading === true || this.isInLODMode !== false) return;
448
+ if (this._isFullResCssFringePrewarmBlocked(state.module)) {
449
+ this._retryFullResCssFringePrewarm(state);
450
+ return;
451
+ }
452
+ const hasIdleTime = () =>
453
+ !deadline || typeof deadline.timeRemaining !== 'function' || deadline.timeRemaining() > 1;
454
+
455
+ if (!state.scanComplete) {
456
+ state.entryIterator ||= state.nodeObjectsById.values();
457
+ const scanStartedAt = performance.now();
458
+ let scanned = 0;
459
+ let iteratorDone = false;
460
+ while (scanned < 192 &&
461
+ (scanned === 0 || performance.now() - scanStartedAt < 2 || hasIdleTime())) {
462
+ const next = state.entryIterator.next();
463
+ if (next.done) {
464
+ iteratorDone = true;
465
+ break;
466
+ }
467
+ const entry = next.value;
468
+ const model = entry?.model || null;
469
+ const nodeId = String(model?.id || model?.Id || entry?.glObject?.userData?.nodeId || '').trim();
470
+ const cssAlreadyVisible = !!nodeId && (
471
+ entry?.cssObject?.visible === true || entry?.currentType === 'CSS' ||
472
+ this._nearCssVisibleIds.has(nodeId)
473
+ );
474
+ if (!model || !isTextLikeModel(model) || isLivePortalCssLodModel(model) ||
475
+ hasAgentConsoleOpenForEntry(entry) || cssAlreadyVisible) {
476
+ scanned++;
477
+ continue;
478
+ }
479
+ const position = entry.glObject?.position || entry.cssObject?.position || null;
480
+ const x = Number(position?.x ?? model.x ?? model.X ?? 0);
481
+ const y = Number(position?.y ?? model.y ?? model.Y ?? 0);
482
+ const width = Math.max(1, Number(model.width ?? model.Width ?? 400));
483
+ const height = Math.max(1, Number(model.height ?? model.Height ?? 200));
484
+ const halfW = width * 0.5;
485
+ const halfH = height * 0.5;
486
+ if (x + halfW >= state.rect.left && x - halfW <= state.rect.right &&
487
+ y + halfH >= state.rect.bottom && y - halfH <= state.rect.top && nodeId) {
488
+ const dx = x - state.centerX;
489
+ const dy = y - state.centerY;
490
+ state.candidates.push({ nodeId, distSq: dx * dx + dy * dy });
491
+ }
492
+ scanned++;
493
+ }
494
+ if (!iteratorDone) {
495
+ this._queueFullResCssFringePrewarm(state);
496
+ return;
497
+ }
498
+ state.candidates.sort((a, b) => a.distSq - b.distSq);
499
+ if (state.candidates.length > state.maxCandidates) state.candidates.length = state.maxCandidates;
500
+ const nextPreparedIds = new Set(state.candidates.map(candidate => candidate.nodeId));
501
+ const currentVisibleIds = state.module?._visibleIds || state.module?._prevVisibleIds || null;
502
+ for (const preparedNodeId of Array.from(this._fullResCssFringePreparedIds)) {
503
+ if (nextPreparedIds.has(preparedNodeId) || currentVisibleIds?.has?.(preparedNodeId)) continue;
504
+ const preparedEntry = state.nodeObjectsById.get(preparedNodeId) || null;
505
+ if (!preparedEntry) {
506
+ this._fullResCssFringePreparedIds.delete(preparedNodeId);
507
+ continue;
508
+ }
509
+ if (!this._releaseFullResCssFringeObject(preparedEntry)) {
510
+ this._clearFullResCssFringePrepared(preparedEntry);
511
+ this._detachCss3dObject(preparedEntry);
512
+ }
513
+ }
514
+ state.scanComplete = true;
515
+ this._fullResCssFringePrewarmCandidateCount = state.candidates.length;
516
+ }
517
+
518
+ const prepareStartedAt = performance.now();
519
+ let processed = 0;
520
+ while (state.candidateCursor < state.candidates.length && processed < 2 &&
521
+ (processed === 0 || (performance.now() - prepareStartedAt < 4 && hasIdleTime()))) {
522
+ const candidate = state.candidates[state.candidateCursor++];
523
+ processed++;
524
+ const entry = state.nodeObjectsById.get(candidate.nodeId) || null;
525
+ if (!entry || !isTextLikeModel(entry.model) || isLivePortalCssLodModel(entry.model) ||
526
+ hasAgentConsoleOpenForEntry(entry)) continue;
527
+ let didPrepare = false;
528
+ if (!entry.cssObject) {
529
+ didPrepare = this._ensureHiddenCss3dObject(entry, state.module) === true;
530
+ if (didPrepare && entry.cssObject?.userData) {
531
+ entry.cssObject.userData._fullResFringeCreated = true;
532
+ }
533
+ }
534
+ if (entry.cssObject && entry.isCssDirty === true &&
535
+ window.MindMapCss3DManager?.syncCss3dContent) {
536
+ entry._css3dDetailTargetCache = null;
537
+ window.MindMapCss3DManager.syncCss3dContent(entry.model, entry.cssObject);
538
+ entry.isCssDirty = false;
539
+ didPrepare = true;
540
+ }
541
+ this._prepareFullResCssFringeLayout(entry, state.module, candidate.nodeId);
542
+ if (didPrepare) {
543
+ this._fullResCssFringePrewarmCount = Number(this._fullResCssFringePrewarmCount || 0) + 1;
544
+ }
545
+ }
546
+ if (state.candidateCursor >= state.candidates.length) {
547
+ state.complete = true;
548
+ return;
549
+ }
550
+ this._queueFullResCssFringePrewarm(state);
551
+ };
552
+ if (typeof globalThis.requestIdleCallback === 'function') {
553
+ globalThis.requestIdleCallback(run, { timeout: 140 });
554
+ } else {
555
+ setTimeout(() => run({ timeRemaining: () => 4, didTimeout: true }), 16);
556
+ }
557
+ return true;
558
+ },
559
+
560
+ _scheduleFullResCssFringePrewarm(nodeObjectsById, module = this._module) {
561
+ if (!nodeObjectsById?.values || !module || this._disposed === true || this.isLoading === true ||
562
+ module.isLoading === true || this.isInLODMode !== false ||
563
+ this._isFullResCssFringePrewarmBlocked(module)) return false;
564
+ const normalBoundary = Number(this.constructor?.LOD_THRESHOLDS?.NORMAL || 9000);
565
+ const cameraZ = Number(module.camera?.position?.z || 0);
566
+ const viewportRect = module._lastVisibilityViewportWorldRect || null;
567
+ if (!(cameraZ > 0) || cameraZ >= normalBoundary || viewportRect?.mode !== 'full-res') return false;
568
+ const centerX = Number(module.camera?.position?.x || 0);
569
+ const centerY = Number(module.camera?.position?.y || 0);
570
+ const currentHalfW = Math.max(1, (Number(viewportRect.right) - Number(viewportRect.left)) * 0.5);
571
+ const currentHalfH = Math.max(1, (Number(viewportRect.top) - Number(viewportRect.bottom)) * 0.5);
572
+ if (!Number.isFinite(currentHalfW) || !Number.isFinite(currentHalfH)) return false;
573
+ const boundaryScale = Math.max(1.15, Math.min(4,
574
+ (normalBoundary / Math.max(2250, cameraZ)) * 1.08));
575
+ const halfW = currentHalfW * boundaryScale;
576
+ const halfH = currentHalfH * boundaryScale;
577
+ const visibleCount = Number(module._visibleIds?.size || module._prevVisibleIds?.size || 0);
578
+ const maxCandidates = Math.min(320, Math.max(160, Math.ceil(visibleCount * 3)));
579
+ const key = [
580
+ Number(nodeObjectsById.size || 0),
581
+ Math.round(centerX / 250),
582
+ Math.round(centerY / 250),
583
+ Math.round(halfW / 250),
584
+ Math.round(halfH / 250),
585
+ maxCandidates
586
+ ].join('|');
587
+ let state = this._fullResCssFringePrewarmState;
588
+ if (!state || state.key !== key || state.module !== module || state.nodeObjectsById !== nodeObjectsById) {
589
+ if (state?.retryTimer) clearTimeout(state.retryTimer);
590
+ state = {
591
+ key, module, nodeObjectsById, centerX, centerY, maxCandidates,
592
+ rect: {
593
+ left: centerX - halfW,
594
+ right: centerX + halfW,
595
+ bottom: centerY - halfH,
596
+ top: centerY + halfH
597
+ },
598
+ entryIterator: null,
599
+ scanComplete: false,
600
+ candidates: [],
601
+ candidateCursor: 0,
602
+ scheduled: false,
603
+ retryTimer: 0,
604
+ complete: false
605
+ };
606
+ this._fullResCssFringePrewarmState = state;
607
+ }
608
+ if (state.complete) return false;
609
+ return this._queueFullResCssFringePrewarm(state);
610
+ }
611
+ });
612
+
613
+ Object.defineProperty(prototype, '_normalBoundaryOptimizerBuild', {
614
+ configurable: true,
615
+ value: BUILD_ID
616
+ });
617
+ window.MindCanvasBuildInfo?.registerPart?.('normalBoundaryOptimizer', BUILD_ID, {
618
+ file: 'mind-map-normal-boundary-optimizer.js'
619
+ });
620
+ return true;
621
+ }
622
+
623
+ window.MindMapNormalBoundaryOptimizer = Object.freeze({ BUILD_ID, install });
624
+ })();