@wovvmap/renderer-three 0.0.0-stage → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/controllers/ImageController.d.ts +95 -0
- package/dist/controllers/ImageController.d.ts.map +1 -0
- package/dist/controllers/ImageController.js +129 -0
- package/dist/controllers/ShapeController.d.ts +95 -0
- package/dist/controllers/ShapeController.d.ts.map +1 -0
- package/dist/controllers/ShapeController.js +139 -0
- package/dist/controllers/TextController.d.ts +120 -0
- package/dist/controllers/TextController.d.ts.map +1 -0
- package/dist/controllers/TextController.js +161 -0
- package/dist/controllers/ViewerElementsController.d.ts +254 -0
- package/dist/controllers/ViewerElementsController.d.ts.map +1 -0
- package/dist/controllers/ViewerElementsController.js +490 -0
- package/dist/engine/CameraFollow.d.ts +13 -0
- package/dist/engine/CameraFollow.d.ts.map +1 -0
- package/dist/engine/CameraFollow.js +52 -0
- package/dist/engine/CameraManager.d.ts +143 -0
- package/dist/engine/CameraManager.d.ts.map +1 -0
- package/dist/engine/CameraManager.js +566 -0
- package/dist/engine/ControlsManager.d.ts +123 -0
- package/dist/engine/ControlsManager.d.ts.map +1 -0
- package/dist/engine/ControlsManager.js +604 -0
- package/dist/engine/InteractionManager.d.ts +45 -0
- package/dist/engine/InteractionManager.d.ts.map +1 -0
- package/dist/engine/InteractionManager.js +99 -0
- package/dist/engine/LightingManager.d.ts +25 -0
- package/dist/engine/LightingManager.d.ts.map +1 -0
- package/dist/engine/LightingManager.js +74 -0
- package/dist/engine/MapViewerEngine.d.ts +350 -0
- package/dist/engine/MapViewerEngine.d.ts.map +1 -0
- package/dist/engine/MapViewerEngine.js +1041 -0
- package/dist/engine/RendererManager.d.ts +77 -0
- package/dist/engine/RendererManager.d.ts.map +1 -0
- package/dist/engine/RendererManager.js +243 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/services/image-services/ImageCacheService.d.ts +49 -0
- package/dist/services/image-services/ImageCacheService.d.ts.map +1 -0
- package/dist/services/image-services/ImageCacheService.js +121 -0
- package/dist/services/image-services/ImagePlaneService.d.ts +29 -0
- package/dist/services/image-services/ImagePlaneService.d.ts.map +1 -0
- package/dist/services/image-services/ImagePlaneService.js +82 -0
- package/dist/services/image-services/ImageService.d.ts +170 -0
- package/dist/services/image-services/ImageService.d.ts.map +1 -0
- package/dist/services/image-services/ImageService.js +537 -0
- package/dist/services/image-services/ImageSpriteService.d.ts +39 -0
- package/dist/services/image-services/ImageSpriteService.d.ts.map +1 -0
- package/dist/services/image-services/ImageSpriteService.js +135 -0
- package/dist/services/routes/RouteArrows.d.ts +34 -0
- package/dist/services/routes/RouteArrows.d.ts.map +1 -0
- package/dist/services/routes/RouteArrows.js +157 -0
- package/dist/services/routes/RouteCursor.d.ts +19 -0
- package/dist/services/routes/RouteCursor.d.ts.map +1 -0
- package/dist/services/routes/RouteCursor.js +68 -0
- package/dist/services/routes/RouteMotion.d.ts +31 -0
- package/dist/services/routes/RouteMotion.d.ts.map +1 -0
- package/dist/services/routes/RouteMotion.js +132 -0
- package/dist/services/routes/RouteRenderer.d.ts +52 -0
- package/dist/services/routes/RouteRenderer.d.ts.map +1 -0
- package/dist/services/routes/RouteRenderer.js +445 -0
- package/dist/services/routes/RouteStepHighlight.d.ts +22 -0
- package/dist/services/routes/RouteStepHighlight.d.ts.map +1 -0
- package/dist/services/routes/RouteStepHighlight.js +84 -0
- package/dist/services/routes/routeMarkers.d.ts +6 -0
- package/dist/services/routes/routeMarkers.d.ts.map +1 -0
- package/dist/services/routes/routeMarkers.js +41 -0
- package/dist/services/selectionPaint.d.ts +12 -0
- package/dist/services/selectionPaint.d.ts.map +1 -0
- package/dist/services/selectionPaint.js +8 -0
- package/dist/services/shape-services/ExtrudeShapeService.d.ts +54 -0
- package/dist/services/shape-services/ExtrudeShapeService.d.ts.map +1 -0
- package/dist/services/shape-services/ExtrudeShapeService.js +204 -0
- package/dist/services/shape-services/FlatShapeService.d.ts +25 -0
- package/dist/services/shape-services/FlatShapeService.d.ts.map +1 -0
- package/dist/services/shape-services/FlatShapeService.js +49 -0
- package/dist/services/shape-services/IShapeService.d.ts +24 -0
- package/dist/services/shape-services/IShapeService.d.ts.map +1 -0
- package/dist/services/shape-services/IShapeService.js +6 -0
- package/dist/services/shape-services/MaterialUtils.d.ts +15 -0
- package/dist/services/shape-services/MaterialUtils.d.ts.map +1 -0
- package/dist/services/shape-services/MaterialUtils.js +71 -0
- package/dist/services/shape-services/ShapeFactory.d.ts +20 -0
- package/dist/services/shape-services/ShapeFactory.d.ts.map +1 -0
- package/dist/services/shape-services/ShapeFactory.js +28 -0
- package/dist/services/shape-services/ShapeHighlightService.d.ts +13 -0
- package/dist/services/shape-services/ShapeHighlightService.d.ts.map +1 -0
- package/dist/services/shape-services/ShapeHighlightService.js +57 -0
- package/dist/services/shape-services/ShapeService.d.ts +129 -0
- package/dist/services/shape-services/ShapeService.d.ts.map +1 -0
- package/dist/services/shape-services/ShapeService.js +480 -0
- package/dist/services/shape-services/preparedGeometry.d.ts +13 -0
- package/dist/services/shape-services/preparedGeometry.d.ts.map +1 -0
- package/dist/services/shape-services/preparedGeometry.js +37 -0
- package/dist/services/text-services/ITextRenderStrategy.d.ts +79 -0
- package/dist/services/text-services/ITextRenderStrategy.d.ts.map +1 -0
- package/dist/services/text-services/ITextRenderStrategy.js +7 -0
- package/dist/services/text-services/Text2DService.d.ts +66 -0
- package/dist/services/text-services/Text2DService.d.ts.map +1 -0
- package/dist/services/text-services/Text2DService.js +483 -0
- package/dist/services/text-services/Text3DService.d.ts +51 -0
- package/dist/services/text-services/Text3DService.d.ts.map +1 -0
- package/dist/services/text-services/Text3DService.js +246 -0
- package/dist/services/text-services/TextCollisionService.d.ts +29 -0
- package/dist/services/text-services/TextCollisionService.d.ts.map +1 -0
- package/dist/services/text-services/TextCollisionService.js +117 -0
- package/dist/services/text-services/TextService.d.ts +159 -0
- package/dist/services/text-services/TextService.d.ts.map +1 -0
- package/dist/services/text-services/TextService.js +398 -0
- package/dist/services/text-services/TextStrategyRegistry.d.ts +36 -0
- package/dist/services/text-services/TextStrategyRegistry.d.ts.map +1 -0
- package/dist/services/text-services/TextStrategyRegistry.js +44 -0
- package/dist/services/threeDisposeHelper.d.ts +12 -0
- package/dist/services/threeDisposeHelper.d.ts.map +1 -0
- package/dist/services/threeDisposeHelper.js +57 -0
- package/package.json +40 -3
- package/README.md +0 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Text3DService.ts
|
|
3
|
+
* @description 3D Text rendering service using Troika SDF text meshes positioned on unit roofs and floor surfaces.
|
|
4
|
+
* English: Implements ITextRenderStrategy for flat-on-surface 3D text meshes using troika-three-text with token and type-based coloring.
|
|
5
|
+
* Hinglish: Store roofs aur floor surfaces par flat 3D text meshes render karne wali service jisme theme tokens aur types ke hisab se colors apply hote hain.
|
|
6
|
+
*/
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import type { NodePoint, DynamicDepthConfig, MapViewMode } from '@wovvmap/contracts';
|
|
9
|
+
import type { ITextRenderStrategy, TextRenderOptions, TextType } from './ITextRenderStrategy.js';
|
|
10
|
+
export declare class Text3DService implements ITextRenderStrategy {
|
|
11
|
+
static readonly EXTRA_DEPTH_3D = 1.2;
|
|
12
|
+
static readonly EXTRA_DEPTH_2D = 0.5;
|
|
13
|
+
readonly type: TextType;
|
|
14
|
+
readonly supportsCollision: boolean;
|
|
15
|
+
private readonly selections;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a 3D troika text mesh flat on the store roof or floor surface.
|
|
18
|
+
* Store roof ya floor surface par flat 3D text mesh create karein.
|
|
19
|
+
*/
|
|
20
|
+
createText(node: NodePoint, options?: TextRenderOptions): THREE.Object3D | null;
|
|
21
|
+
/**
|
|
22
|
+
* Adjusts vertical elevation of 3D text when switching 2D/3D view modes.
|
|
23
|
+
* View mode switch hone par 3D text ki vertical unchai update karein.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Resolves target vertical elevation of 3D text for 2D/3D mode transitions.
|
|
27
|
+
* 3D text ki target elevation calculate karein taaki instant aur animated result exact match karein.
|
|
28
|
+
*/
|
|
29
|
+
resolveTargetElevation(child: THREE.Object3D, mode?: MapViewMode, depthConfig?: Partial<DynamicDepthConfig>): number;
|
|
30
|
+
applyViewMode(child: THREE.Object3D, mode?: MapViewMode, depthConfig?: Partial<DynamicDepthConfig>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Flips 3D text orientation when the camera is behind the text so text is never upside-down.
|
|
33
|
+
* Camera peeche aane par 3D text ko auto-flip karein taaki hamesha seedha padha ja sake.
|
|
34
|
+
*/
|
|
35
|
+
updateRotation(rotationRad: number, floorGroup?: THREE.Group, onInvalidate?: () => void): void;
|
|
36
|
+
/**
|
|
37
|
+
* Updates color on a 3D Troika text mesh supporting single color, node types, categories, and theme tokens.
|
|
38
|
+
* 3D Troika text mesh ka color update karein (theme tokens aur direct types support karta hai).
|
|
39
|
+
*/
|
|
40
|
+
updateTextColor(object: THREE.Object3D, colorOrMap?: string | number | Record<string, string | number>): void;
|
|
41
|
+
private applyBaseColor;
|
|
42
|
+
/** Troika color changes need no material swap, geometry sync or visibility override.
|
|
43
|
+
* Hinglish: Selection sirf Text.color badalta hai; clear par latest base rang restore hota hai. */
|
|
44
|
+
setSelected(object: THREE.Object3D, selected: boolean, color: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Safely disposes Troika text mesh GPU resources.
|
|
47
|
+
* Troika text mesh ke GPU resources dispose karein.
|
|
48
|
+
*/
|
|
49
|
+
disposeText(object: THREE.Object3D): void;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=Text3DService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text3DService.d.ts","sourceRoot":"","sources":["../../../src/services/text-services/Text3DService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAA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AAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAalF;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,GAAG,IAAI;CAQjD"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Text3DService.ts
|
|
3
|
+
* @description 3D Text rendering service using Troika SDF text meshes positioned on unit roofs and floor surfaces.
|
|
4
|
+
* English: Implements ITextRenderStrategy for flat-on-surface 3D text meshes using troika-three-text with token and type-based coloring.
|
|
5
|
+
* Hinglish: Store roofs aur floor surfaces par flat 3D text meshes render karne wali service jisme theme tokens aur types ke hisab se colors apply hote hain.
|
|
6
|
+
*/
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import { Text } from 'troika-three-text';
|
|
9
|
+
import { resolveModeDepth, resolveSurfaceElevation } from '@wovvmap/contracts';
|
|
10
|
+
export class Text3DService {
|
|
11
|
+
static EXTRA_DEPTH_3D = 1.2;
|
|
12
|
+
static EXTRA_DEPTH_2D = 0.5;
|
|
13
|
+
type = '3D';
|
|
14
|
+
supportsCollision = false;
|
|
15
|
+
selections = new WeakMap();
|
|
16
|
+
/**
|
|
17
|
+
* Creates a 3D troika text mesh flat on the store roof or floor surface.
|
|
18
|
+
* Store roof ya floor surface par flat 3D text mesh create karein.
|
|
19
|
+
*/
|
|
20
|
+
createText(node, options = {}) {
|
|
21
|
+
const locationName = node.assets?.locationName;
|
|
22
|
+
if (!locationName || !locationName.text || locationName.text.trim() === '') {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const { text, area, rotate, width, textSize, textColor } = locationName;
|
|
26
|
+
const scale = options.scale ?? 0.1;
|
|
27
|
+
const viewMode = options.viewMode ?? '3D';
|
|
28
|
+
const depthConfig = options.depthConfig;
|
|
29
|
+
const surfaceElevation = resolveSurfaceElevation(node, viewMode, depthConfig);
|
|
30
|
+
const extra = viewMode === '2D' ? Text3DService.EXTRA_DEPTH_2D : Text3DService.EXTRA_DEPTH_3D;
|
|
31
|
+
const y = surfaceElevation + extra;
|
|
32
|
+
const textMesh = new Text();
|
|
33
|
+
textMesh.text = text;
|
|
34
|
+
textMesh.fontSize = textSize ? Number(textSize) * scale : 10 * scale;
|
|
35
|
+
textMesh.color = textColor || 0x000000;
|
|
36
|
+
textMesh.anchorX = 'center';
|
|
37
|
+
textMesh.anchorY = 'middle';
|
|
38
|
+
textMesh.maxWidth = (width ?? 100) * scale * 1.08;
|
|
39
|
+
textMesh.textAlign = 'center';
|
|
40
|
+
const posX = (area?.x ?? node.x) * scale;
|
|
41
|
+
const posZ = (area?.y ?? node.y) * scale;
|
|
42
|
+
textMesh.position.set(posX, y, posZ);
|
|
43
|
+
textMesh.rotation.set(-Math.PI / 2, 0, -((rotate ?? 0) * Math.PI) / 180);
|
|
44
|
+
if (typeof document !== 'undefined') {
|
|
45
|
+
textMesh.sync(() => {
|
|
46
|
+
// A late font completion must not revive a retired label/viewer.
|
|
47
|
+
// Hinglish: Dispose hue label ka late font callback redraw dobara na maange.
|
|
48
|
+
if (!textMesh.userData.isDisposed)
|
|
49
|
+
options.onInvalidate?.();
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const depth = node.shapeDetail?.depth ?? 0;
|
|
53
|
+
textMesh.name = `text-${node.key}`;
|
|
54
|
+
textMesh.userData = {
|
|
55
|
+
id: node.key,
|
|
56
|
+
nodeId: node.key,
|
|
57
|
+
nodeType: node.type,
|
|
58
|
+
category: node.categoryCode !== undefined ? String(node.categoryCode) : undefined,
|
|
59
|
+
subCategory: node.subCategoryCode !== undefined ? String(node.subCategoryCode) : undefined,
|
|
60
|
+
type: 'text',
|
|
61
|
+
is3D: true,
|
|
62
|
+
originalColor: textColor || 0x000000,
|
|
63
|
+
originalFontSize: textSize || 10,
|
|
64
|
+
originalDepth: depth,
|
|
65
|
+
rotate: rotate ?? 0,
|
|
66
|
+
floorBash: Boolean(node.shapeDetail?.floorBash),
|
|
67
|
+
isFloorBase: Boolean(node.shapeDetail?.floorBash),
|
|
68
|
+
};
|
|
69
|
+
return textMesh;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Adjusts vertical elevation of 3D text when switching 2D/3D view modes.
|
|
73
|
+
* View mode switch hone par 3D text ki vertical unchai update karein.
|
|
74
|
+
*/
|
|
75
|
+
/**
|
|
76
|
+
* Resolves target vertical elevation of 3D text for 2D/3D mode transitions.
|
|
77
|
+
* 3D text ki target elevation calculate karein taaki instant aur animated result exact match karein.
|
|
78
|
+
*/
|
|
79
|
+
resolveTargetElevation(child, mode = '3D', depthConfig) {
|
|
80
|
+
if (child.userData.type === 'text' && child.userData.originalDepth !== undefined) {
|
|
81
|
+
const modeConfig = resolveModeDepth(mode, depthConfig);
|
|
82
|
+
const isFloorBase = child.userData.floorBash === true ||
|
|
83
|
+
child.userData.isFloorBase === true ||
|
|
84
|
+
Number(child.userData.originalDepth) <= 0.2;
|
|
85
|
+
// English: Distinguish floor base from units to keep text at the exact effective surface elevation.
|
|
86
|
+
// Hinglish: Floor base aur units me antar rakhein taaki text hamesha correct surface elevation par baithe.
|
|
87
|
+
const baseHeight = isFloorBase
|
|
88
|
+
? mode === '2D'
|
|
89
|
+
? modeConfig.unitDepth
|
|
90
|
+
: (depthConfig?.floorBaseDepth ?? 0.1)
|
|
91
|
+
: mode === '2D'
|
|
92
|
+
? modeConfig.unitDepth
|
|
93
|
+
: (depthConfig?.defaultUnitDepth ?? Number(child.userData.originalDepth));
|
|
94
|
+
const extra = mode === '2D' ? Text3DService.EXTRA_DEPTH_2D : Text3DService.EXTRA_DEPTH_3D;
|
|
95
|
+
return baseHeight + extra;
|
|
96
|
+
}
|
|
97
|
+
return child.position.y;
|
|
98
|
+
}
|
|
99
|
+
applyViewMode(child, mode = '3D', depthConfig) {
|
|
100
|
+
child.position.y = this.resolveTargetElevation(child, mode, depthConfig);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Flips 3D text orientation when the camera is behind the text so text is never upside-down.
|
|
104
|
+
* Camera peeche aane par 3D text ko auto-flip karein taaki hamesha seedha padha ja sake.
|
|
105
|
+
*/
|
|
106
|
+
updateRotation(rotationRad, floorGroup, onInvalidate) {
|
|
107
|
+
if (!floorGroup)
|
|
108
|
+
return;
|
|
109
|
+
const cameraDeg = THREE.MathUtils.radToDeg(rotationRad);
|
|
110
|
+
floorGroup.children.forEach((child) => {
|
|
111
|
+
if (child.userData.type === 'text' && child.userData.is3D) {
|
|
112
|
+
const textRotate = Number(child.userData.rotate || 0);
|
|
113
|
+
const relativeAngle = (cameraDeg + textRotate + 360) % 360;
|
|
114
|
+
const shouldFlip = relativeAngle > 90 && relativeAngle < 270;
|
|
115
|
+
const desiredScale = shouldFlip ? -1 : 1;
|
|
116
|
+
if (child.scale.x !== desiredScale) {
|
|
117
|
+
child.scale.set(desiredScale, desiredScale, 1);
|
|
118
|
+
onInvalidate?.();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Updates color on a 3D Troika text mesh supporting single color, node types, categories, and theme tokens.
|
|
125
|
+
* 3D Troika text mesh ka color update karein (theme tokens aur direct types support karta hai).
|
|
126
|
+
*/
|
|
127
|
+
updateTextColor(object, colorOrMap) {
|
|
128
|
+
const textMesh = object;
|
|
129
|
+
if (!textMesh || typeof textMesh.sync !== 'function')
|
|
130
|
+
return;
|
|
131
|
+
if (colorOrMap === undefined) {
|
|
132
|
+
this.applyBaseColor(object, object.userData.originalColor ?? 0x000000);
|
|
133
|
+
if (typeof document !== 'undefined') {
|
|
134
|
+
textMesh.sync();
|
|
135
|
+
}
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const nodeType = object.userData.nodeType;
|
|
139
|
+
const category = object.userData.category;
|
|
140
|
+
const subCategory = object.userData.subCategory;
|
|
141
|
+
const nodeId = (object.userData.nodeId ?? object.userData.id);
|
|
142
|
+
let newColor;
|
|
143
|
+
if (typeof colorOrMap === 'object' && colorOrMap !== null) {
|
|
144
|
+
// 1. Direct match by node ID or key
|
|
145
|
+
if (nodeId && colorOrMap[nodeId] !== undefined) {
|
|
146
|
+
newColor = colorOrMap[nodeId];
|
|
147
|
+
}
|
|
148
|
+
// 2. Special roles precedence (StartPoint, EndPoint, Transit, Amenity)
|
|
149
|
+
else if ((nodeType === 'StartPoint' || nodeType === 'startPoint') &&
|
|
150
|
+
(colorOrMap['startPoint3D'] !== undefined ||
|
|
151
|
+
colorOrMap['StartPoint'] !== undefined ||
|
|
152
|
+
colorOrMap['startPoint'] !== undefined)) {
|
|
153
|
+
newColor =
|
|
154
|
+
colorOrMap['startPoint3D'] ?? colorOrMap['StartPoint'] ?? colorOrMap['startPoint'];
|
|
155
|
+
}
|
|
156
|
+
else if ((nodeType === 'EndPoint' || nodeType === 'endPoint') &&
|
|
157
|
+
(colorOrMap['endPoint3D'] !== undefined ||
|
|
158
|
+
colorOrMap['EndPoint'] !== undefined ||
|
|
159
|
+
colorOrMap['endPoint'] !== undefined)) {
|
|
160
|
+
newColor = colorOrMap['endPoint3D'] ?? colorOrMap['EndPoint'] ?? colorOrMap['endPoint'];
|
|
161
|
+
}
|
|
162
|
+
else if ((nodeType === 'Transit' || nodeType === 'transit') &&
|
|
163
|
+
(colorOrMap['transit3D'] !== undefined ||
|
|
164
|
+
colorOrMap['Transit'] !== undefined ||
|
|
165
|
+
colorOrMap['transit'] !== undefined)) {
|
|
166
|
+
newColor = colorOrMap['transit3D'] ?? colorOrMap['Transit'] ?? colorOrMap['transit'];
|
|
167
|
+
}
|
|
168
|
+
else if ((nodeType === 'Amenity' || nodeType === 'amenity') &&
|
|
169
|
+
(colorOrMap['amenity3D'] !== undefined ||
|
|
170
|
+
colorOrMap['Amenity'] !== undefined ||
|
|
171
|
+
colorOrMap['amenity'] !== undefined)) {
|
|
172
|
+
newColor = colorOrMap['amenity3D'] ?? colorOrMap['Amenity'] ?? colorOrMap['amenity'];
|
|
173
|
+
}
|
|
174
|
+
else if (nodeType && colorOrMap[nodeType] !== undefined) {
|
|
175
|
+
newColor = colorOrMap[nodeType];
|
|
176
|
+
}
|
|
177
|
+
// 3. SubCategory tokens (subCategory3D, specific subCategory code)
|
|
178
|
+
else if (subCategory && colorOrMap[subCategory] !== undefined) {
|
|
179
|
+
newColor = colorOrMap[subCategory];
|
|
180
|
+
}
|
|
181
|
+
else if (subCategory && colorOrMap['subCategory3D'] !== undefined) {
|
|
182
|
+
newColor = colorOrMap['subCategory3D'];
|
|
183
|
+
}
|
|
184
|
+
else if (subCategory && colorOrMap['subCategory'] !== undefined) {
|
|
185
|
+
newColor = colorOrMap['subCategory'];
|
|
186
|
+
}
|
|
187
|
+
// 4. Category tokens (category3D, specific category code)
|
|
188
|
+
else if (category && colorOrMap[category] !== undefined) {
|
|
189
|
+
newColor = colorOrMap[category];
|
|
190
|
+
}
|
|
191
|
+
else if ((category || nodeType === 'Store') &&
|
|
192
|
+
(colorOrMap['category3D'] !== undefined || colorOrMap['category'] !== undefined)) {
|
|
193
|
+
newColor = colorOrMap['category3D'] ?? colorOrMap['category'];
|
|
194
|
+
}
|
|
195
|
+
// 5. Default fallback
|
|
196
|
+
else if (colorOrMap['default'] !== undefined) {
|
|
197
|
+
newColor = colorOrMap['default'];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else if (colorOrMap !== undefined) {
|
|
201
|
+
newColor = colorOrMap;
|
|
202
|
+
}
|
|
203
|
+
// If newColor is resolved, use it; otherwise fallback to original base color
|
|
204
|
+
// Mapping replace hone par unmatched existing labels ka effective base color restore karein.
|
|
205
|
+
const effectiveColor = newColor ?? object.userData.originalColor ?? 0x000000;
|
|
206
|
+
this.applyBaseColor(object, effectiveColor);
|
|
207
|
+
if (typeof document !== 'undefined') {
|
|
208
|
+
textMesh.sync();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
applyBaseColor(object, color) {
|
|
212
|
+
const selection = this.selections.get(object);
|
|
213
|
+
if (selection)
|
|
214
|
+
selection.baseColor = color;
|
|
215
|
+
const text = object;
|
|
216
|
+
text.color = selection?.color ?? color;
|
|
217
|
+
}
|
|
218
|
+
/** Troika color changes need no material swap, geometry sync or visibility override.
|
|
219
|
+
* Hinglish: Selection sirf Text.color badalta hai; clear par latest base rang restore hota hai. */
|
|
220
|
+
setSelected(object, selected, color) {
|
|
221
|
+
const text = object;
|
|
222
|
+
if (typeof text.sync !== 'function')
|
|
223
|
+
return;
|
|
224
|
+
const previous = this.selections.get(object);
|
|
225
|
+
if (selected) {
|
|
226
|
+
this.selections.set(object, { baseColor: previous?.baseColor ?? text.color, color });
|
|
227
|
+
text.color = color;
|
|
228
|
+
}
|
|
229
|
+
else if (previous) {
|
|
230
|
+
text.color = previous.baseColor;
|
|
231
|
+
this.selections.delete(object);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Safely disposes Troika text mesh GPU resources.
|
|
236
|
+
* Troika text mesh ke GPU resources dispose karein.
|
|
237
|
+
*/
|
|
238
|
+
disposeText(object) {
|
|
239
|
+
object.userData.isDisposed = true;
|
|
240
|
+
this.selections.delete(object);
|
|
241
|
+
const troika = object;
|
|
242
|
+
if (typeof troika.dispose === 'function') {
|
|
243
|
+
troika.dispose();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file TextCollisionService.ts
|
|
3
|
+
* @description Dynamic camera-driven text label decluttering and collision resolution service.
|
|
4
|
+
* Zoom in / zoom out par labels aapas me takraye nahi (auto-decluttering) uske liye collision service.
|
|
5
|
+
*/
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
export declare class TextCollisionService {
|
|
8
|
+
private readonly frustum;
|
|
9
|
+
private readonly projectionMatrix;
|
|
10
|
+
private readonly worldPosition;
|
|
11
|
+
/**
|
|
12
|
+
* Resolves label collision and visibility states based on camera viewport and frustum.
|
|
13
|
+
* Camera ke viewport ke mutabik labels ki collision check karke unhe declutter karein.
|
|
14
|
+
*
|
|
15
|
+
* @param textMap Map of all active text labels.
|
|
16
|
+
* @param camera Active scene camera.
|
|
17
|
+
* @param activeFloor Optional active floor index filter.
|
|
18
|
+
*/
|
|
19
|
+
update(textMap: Map<string, THREE.Object3D>, camera: THREE.Camera, activeFloor?: number): void;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves collision state for an individual label against already occupied screen spaces.
|
|
22
|
+
*/
|
|
23
|
+
private resolveLabelCollision;
|
|
24
|
+
/**
|
|
25
|
+
* Checks if target bounding box intersects with any occupied rectangle.
|
|
26
|
+
*/
|
|
27
|
+
private hasCollision;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=TextCollisionService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextCollisionService.d.ts","sourceRoot":"","sources":["../../../src/services/text-services/TextCollisionService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsB;IAC9C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAsB;IACvD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;IAEpD;;;;;;;OAOG;IACI,MAAM,CACX,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,EACpC,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,WAAW,CAAC,EAAE,MAAM,GACnB,IAAI;IAuDP;;OAEG;IACH,OAAO,CAAC,qBAAqB;IA2C7B;;OAEG;IACH,OAAO,CAAC,YAAY;CAWrB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file TextCollisionService.ts
|
|
3
|
+
* @description Dynamic camera-driven text label decluttering and collision resolution service.
|
|
4
|
+
* Zoom in / zoom out par labels aapas me takraye nahi (auto-decluttering) uske liye collision service.
|
|
5
|
+
*/
|
|
6
|
+
import * as THREE from 'three';
|
|
7
|
+
export class TextCollisionService {
|
|
8
|
+
frustum = new THREE.Frustum();
|
|
9
|
+
projectionMatrix = new THREE.Matrix4();
|
|
10
|
+
worldPosition = new THREE.Vector3();
|
|
11
|
+
/**
|
|
12
|
+
* Resolves label collision and visibility states based on camera viewport and frustum.
|
|
13
|
+
* Camera ke viewport ke mutabik labels ki collision check karke unhe declutter karein.
|
|
14
|
+
*
|
|
15
|
+
* @param textMap Map of all active text labels.
|
|
16
|
+
* @param camera Active scene camera.
|
|
17
|
+
* @param activeFloor Optional active floor index filter.
|
|
18
|
+
*/
|
|
19
|
+
update(textMap, camera, activeFloor) {
|
|
20
|
+
if (typeof document === 'undefined')
|
|
21
|
+
return;
|
|
22
|
+
camera.updateMatrixWorld();
|
|
23
|
+
this.projectionMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
|
|
24
|
+
this.frustum.setFromProjectionMatrix(this.projectionMatrix);
|
|
25
|
+
const activeFloorGroupName = activeFloor !== undefined ? `floor-text-${activeFloor}` : undefined;
|
|
26
|
+
const labels = [];
|
|
27
|
+
textMap.forEach((object) => {
|
|
28
|
+
if (!object.userData.is2D || !object.visible)
|
|
29
|
+
return;
|
|
30
|
+
if (activeFloorGroupName && object.parent?.name !== activeFloorGroupName)
|
|
31
|
+
return;
|
|
32
|
+
const element = object.element;
|
|
33
|
+
if (!element || (element.isConnected !== undefined && !element.isConnected))
|
|
34
|
+
return;
|
|
35
|
+
object.updateWorldMatrix(true, false);
|
|
36
|
+
object.getWorldPosition(this.worldPosition);
|
|
37
|
+
// Frustum culling: hide labels outside visible camera frustum
|
|
38
|
+
if (!this.frustum.containsPoint(this.worldPosition)) {
|
|
39
|
+
element.classList.add('state-hidden');
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
element.classList.remove('state-icon-only', 'state-dot-only', 'state-hidden');
|
|
43
|
+
if (typeof element.getBoundingClientRect !== 'function')
|
|
44
|
+
return;
|
|
45
|
+
const rect = element.getBoundingClientRect();
|
|
46
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
47
|
+
return;
|
|
48
|
+
labels.push({
|
|
49
|
+
rect,
|
|
50
|
+
distance: this.worldPosition.distanceTo(camera.position),
|
|
51
|
+
hasIcon: Boolean(object.userData.hasIcon),
|
|
52
|
+
element,
|
|
53
|
+
isHighlighted: element.classList.contains('state-highlighted'),
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
// Priority sorting: Selected/highlighted first, then nearest to camera
|
|
57
|
+
labels.sort((a, b) => {
|
|
58
|
+
if (a.isHighlighted !== b.isHighlighted) {
|
|
59
|
+
return a.isHighlighted ? -1 : 1;
|
|
60
|
+
}
|
|
61
|
+
return a.distance - b.distance;
|
|
62
|
+
});
|
|
63
|
+
const occupiedRects = [];
|
|
64
|
+
labels.forEach((label) => {
|
|
65
|
+
this.resolveLabelCollision(label, occupiedRects);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Resolves collision state for an individual label against already occupied screen spaces.
|
|
70
|
+
*/
|
|
71
|
+
resolveLabelCollision(label, occupiedRects) {
|
|
72
|
+
const { element, rect, hasIcon, isHighlighted } = label;
|
|
73
|
+
// 1. Highlighted / Selected label always preserves full text with generous boundary
|
|
74
|
+
if (isHighlighted) {
|
|
75
|
+
if (typeof DOMRect !== 'undefined') {
|
|
76
|
+
occupiedRects.push(new DOMRect(rect.x - 15, rect.y - 15, rect.width + 30, rect.height + 30));
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// 2. Full text fits without collision
|
|
81
|
+
if (!this.hasCollision(rect, occupiedRects)) {
|
|
82
|
+
occupiedRects.push(rect);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// 3. Fallback: Check if smaller icon (28x28) fits
|
|
86
|
+
if (hasIcon && typeof DOMRect !== 'undefined') {
|
|
87
|
+
const iconRect = new DOMRect(rect.x, rect.y, 28, 28);
|
|
88
|
+
if (!this.hasCollision(iconRect, occupiedRects)) {
|
|
89
|
+
element.classList.add('state-icon-only');
|
|
90
|
+
occupiedRects.push(iconRect);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// 4. Fallback: Check if tiny dot (12x12) fits
|
|
95
|
+
if (typeof DOMRect !== 'undefined') {
|
|
96
|
+
const dotRect = new DOMRect(rect.x, rect.y, 12, 12);
|
|
97
|
+
if (!this.hasCollision(dotRect, occupiedRects)) {
|
|
98
|
+
element.classList.remove('state-icon-only');
|
|
99
|
+
element.classList.add('state-dot-only');
|
|
100
|
+
occupiedRects.push(dotRect);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
// 5. Crowded space: completely hide label
|
|
105
|
+
element.classList.remove('state-icon-only', 'state-dot-only');
|
|
106
|
+
element.classList.add('state-hidden');
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Checks if target bounding box intersects with any occupied rectangle.
|
|
110
|
+
*/
|
|
111
|
+
hasCollision(target, occupied) {
|
|
112
|
+
return occupied.some((rect) => !(target.right < rect.left ||
|
|
113
|
+
target.left > rect.right ||
|
|
114
|
+
target.bottom < rect.top ||
|
|
115
|
+
target.top > rect.bottom));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file TextService.ts
|
|
3
|
+
* @description Central coordinator service for 2D DOM labels and 3D Troika mesh text labels.
|
|
4
|
+
* English: Text coordinator applying saved overrides to new labels with typed strategy contracts.
|
|
5
|
+
* Hinglish: 2D aur 3D text labels ko manage karne wali service jo naye labels par bhi saved color overrides lagati hai.
|
|
6
|
+
*/
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import { type SelectionPaintMap } from '../selectionPaint.js';
|
|
9
|
+
import type { NodePoint, DynamicDepthConfig, MapViewMode } from '@wovvmap/contracts';
|
|
10
|
+
import { TextCollisionService } from './TextCollisionService.js';
|
|
11
|
+
import { TextStrategyRegistry } from './TextStrategyRegistry.js';
|
|
12
|
+
import type { ITextRenderStrategy, TextType } from './ITextRenderStrategy.js';
|
|
13
|
+
export interface TextCreateOptions {
|
|
14
|
+
scale?: number;
|
|
15
|
+
showIcon?: boolean;
|
|
16
|
+
viewMode?: MapViewMode;
|
|
17
|
+
depthConfig?: Partial<DynamicDepthConfig>;
|
|
18
|
+
mallId?: string;
|
|
19
|
+
onInvalidate?: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Central coordinator service managing text render strategies, floor groupings, rotation, and collisions.
|
|
23
|
+
* SOLID principles ke anusar sabhi text strategies (2D DOM aur 3D Mesh), floor groupings aur collision culling ko manage karne wali central coordinator service.
|
|
24
|
+
*/
|
|
25
|
+
export declare class TextService {
|
|
26
|
+
private readonly textMap;
|
|
27
|
+
private readonly floorWiseTextMap;
|
|
28
|
+
private textType;
|
|
29
|
+
private isLabelsVisible;
|
|
30
|
+
private readonly strategyRegistry;
|
|
31
|
+
private readonly textCollisionService;
|
|
32
|
+
private onInvalidate?;
|
|
33
|
+
private currentTextColor?;
|
|
34
|
+
private currentTextColors?;
|
|
35
|
+
private selectionPaint;
|
|
36
|
+
constructor(strategyRegistry?: TextStrategyRegistry, collisionService?: TextCollisionService);
|
|
37
|
+
/**
|
|
38
|
+
* Sets callback to trigger redraw when asynchronous text assets or flips occur.
|
|
39
|
+
* Asynchronous text assets sync hone par redraw trigger karne wala callback.
|
|
40
|
+
*/
|
|
41
|
+
setOnInvalidate(callback?: () => void): void;
|
|
42
|
+
/**
|
|
43
|
+
* Returns currently active text rendering type ('2D' or '3D').
|
|
44
|
+
* Current active text display type prapt karein.
|
|
45
|
+
*/
|
|
46
|
+
getTextType(): TextType;
|
|
47
|
+
/**
|
|
48
|
+
* Switches active text rendering type ('2D' or '3D').
|
|
49
|
+
* Active text display type switch karein.
|
|
50
|
+
*/
|
|
51
|
+
setTextType(type: TextType): void;
|
|
52
|
+
/**
|
|
53
|
+
* Exposes strategy registry for extension with custom text strategies (Open/Closed Principle).
|
|
54
|
+
* Custom text strategies register karne ke liye strategy registry prapt karein.
|
|
55
|
+
*/
|
|
56
|
+
getStrategyRegistry(): TextStrategyRegistry;
|
|
57
|
+
/**
|
|
58
|
+
* Registers a new or custom text render strategy (Open/Closed Principle).
|
|
59
|
+
* Nayi text rendering strategy register karein.
|
|
60
|
+
*/
|
|
61
|
+
registerStrategy(strategy: ITextRenderStrategy): void;
|
|
62
|
+
/**
|
|
63
|
+
* Constructs a text label object using the registered strategy for current textType.
|
|
64
|
+
* Current textType ki registered strategy use karke text label banayein.
|
|
65
|
+
*/
|
|
66
|
+
createText(node: NodePoint, options?: TextCreateOptions): THREE.Object3D | null;
|
|
67
|
+
/**
|
|
68
|
+
* Toggles visibility across all floor-wise text label groups and retains state for future floors/regenerations.
|
|
69
|
+
* English: Synchronizes visibility across all floor text groups and stores visibility intent for newly created groups.
|
|
70
|
+
* Hinglish: Sabhi floor text groups ki visibility update karein aur naye floors ke liye state save rakhein.
|
|
71
|
+
*/
|
|
72
|
+
toggleLabels(visible: boolean): void;
|
|
73
|
+
/**
|
|
74
|
+
* Retrieves container group for text labels on a specific floor.
|
|
75
|
+
* Specific floor ke text labels ka group prapt karein.
|
|
76
|
+
*/
|
|
77
|
+
getFloorTexts(z: number): THREE.Group | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Convenience alias matching getFloorWiseShapes / getFloorWiseImages.
|
|
80
|
+
* getFloorTexts ka alias method.
|
|
81
|
+
*/
|
|
82
|
+
getFloorWiseTexts(z: number): THREE.Group | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Returns all active text label objects.
|
|
85
|
+
* Sabhi text labels ki array prapt karein.
|
|
86
|
+
*/
|
|
87
|
+
getAllTexts(): THREE.Object3D[];
|
|
88
|
+
/**
|
|
89
|
+
* Looks up a text label object by node key.
|
|
90
|
+
* Unique key se specific text label dhoondein.
|
|
91
|
+
*/
|
|
92
|
+
getTextByKey(key: string): THREE.Object3D | undefined;
|
|
93
|
+
/** Preserve the single-key API through the shared selection projection.
|
|
94
|
+
* Hinglish: Purana single-key API bhi isi common selection projection ko use karta hai. */
|
|
95
|
+
setSelection(key: string | null, colors: {
|
|
96
|
+
text2D: string;
|
|
97
|
+
text3D: string;
|
|
98
|
+
}): void;
|
|
99
|
+
/** Diff selected keys only; unchanged members keep their paint and future labels inherit it.
|
|
100
|
+
* Hinglish: Sirf selection keys ka farak dekhein; same members dobara paint nahi hote. */
|
|
101
|
+
setSelectionKeys(keys: readonly string[], colors: {
|
|
102
|
+
text2D: string;
|
|
103
|
+
text3D: string;
|
|
104
|
+
}): void;
|
|
105
|
+
/** Resolve colors once upstream; this owner diffs only affected label keys and keeps base colors.
|
|
106
|
+
* Hinglish: Role colors upstream resolve hon; yahan sirf changed labels paint hon, base safe rahe. */
|
|
107
|
+
setSelectionPaint(next: SelectionPaintMap): void;
|
|
108
|
+
private paintSelection;
|
|
109
|
+
/**
|
|
110
|
+
* Removes a text label and disposes its resources via its owning strategy.
|
|
111
|
+
* Text label ko remove aur uske resources clean karein.
|
|
112
|
+
*/
|
|
113
|
+
removeText(key: string): boolean;
|
|
114
|
+
private activeViewModeAnimationId;
|
|
115
|
+
private activeAnimationRafId;
|
|
116
|
+
/**
|
|
117
|
+
* Cancels active view mode text height animations.
|
|
118
|
+
* Chalu view mode text height animation ko cancel karein.
|
|
119
|
+
*/
|
|
120
|
+
cancelAnimation(): void;
|
|
121
|
+
/**
|
|
122
|
+
* Smoothly animates vertical position of text labels between 2D and 3D mode.
|
|
123
|
+
* Mode ke aadhar par text labels ki height smoothly animate karein.
|
|
124
|
+
*/
|
|
125
|
+
animateViewModeToGroup(group: THREE.Object3D, mode?: MapViewMode, depthConfig?: Partial<DynamicDepthConfig>, onUpdate?: () => void, durationMs?: number, onComplete?: () => void): void;
|
|
126
|
+
applyViewModeToGroup(group: THREE.Object3D, mode?: MapViewMode, depthConfig?: Partial<DynamicDepthConfig>): void;
|
|
127
|
+
/**
|
|
128
|
+
* Updates text colors across all active 3D Troika text meshes (single color or per-type mapping).
|
|
129
|
+
* Typed strategy contract ke zariye sabhi text meshes ka color update karein.
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* Compares two per-type text color mapping objects for shallow equality.
|
|
133
|
+
* English: Compares key-value pairs between text color records to prevent redundant scene updates.
|
|
134
|
+
* Hinglish: Text color maps ke beech equality check karta hai taaki duplicate update skip ho sakein.
|
|
135
|
+
*/
|
|
136
|
+
private areTextColorsEqual;
|
|
137
|
+
updateTextColors(colorOrMap?: string | number | Record<string, string | number>): void;
|
|
138
|
+
/**
|
|
139
|
+
* Flips or rotates text objects when camera rotates (e.g. 3D text auto-flip).
|
|
140
|
+
* Camera angle ke anusaar text rotation update karein.
|
|
141
|
+
*/
|
|
142
|
+
updateTextRotation(rotation: number, activeFloor?: number): void;
|
|
143
|
+
/**
|
|
144
|
+
* Runs collision resolution if the active strategy supports collision decluttering.
|
|
145
|
+
* Agar active strategy collision support karti hai to labels ko auto-declutter karein.
|
|
146
|
+
*/
|
|
147
|
+
updateCollision(camera: THREE.Camera, activeFloor?: number): void;
|
|
148
|
+
/**
|
|
149
|
+
* Disposes all text labels and removes associated resources.
|
|
150
|
+
* Sabhi labels aur resources ko clean karein.
|
|
151
|
+
*/
|
|
152
|
+
clear(): void;
|
|
153
|
+
/**
|
|
154
|
+
* Cleans up orphaned DOM elements from the document tree on floor switch without disposing 3D WebGL meshes.
|
|
155
|
+
* Floor switch par sirf DOM elements detach karta hai; reusable 3D Troika meshes dispose nahi hote.
|
|
156
|
+
*/
|
|
157
|
+
cleanupTextDOM(): void;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=TextService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextService.d.ts","sourceRoot":"","sources":["../../../src/services/text-services/T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