@2112-lab/central-plant 0.1.2 โ†’ 0.1.4

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 (119) hide show
  1. package/dist/bundle/index.js +1 -15498
  2. package/dist/cjs/_virtual/_rollupPluginBabelHelpers.js +1 -366
  3. package/dist/cjs/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -1448
  4. package/dist/cjs/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1292
  5. package/dist/cjs/node_modules/three/examples/jsm/exporters/GLTFExporter.js +1 -0
  6. package/dist/cjs/node_modules/three/examples/jsm/exporters/OBJExporter.js +1 -0
  7. package/dist/cjs/node_modules/three/examples/jsm/exporters/PLYExporter.js +1 -0
  8. package/dist/cjs/node_modules/three/examples/jsm/exporters/STLExporter.js +1 -0
  9. package/dist/cjs/node_modules/three/examples/jsm/loaders/DRACOLoader.js +1 -0
  10. package/dist/cjs/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4374
  11. package/dist/cjs/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -465
  12. package/dist/cjs/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +1 -0
  13. package/dist/cjs/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -117
  14. package/dist/cjs/src/analysis/analysis.js +1 -0
  15. package/dist/cjs/src/analysis/testing.js +1 -0
  16. package/dist/cjs/src/core/centralPlant.js +1 -0
  17. package/dist/cjs/src/core/debugLogger.js +1 -0
  18. package/dist/cjs/src/core/mathUtils.js +1 -0
  19. package/dist/cjs/src/core/nameUtils.js +1 -0
  20. package/dist/cjs/src/data/export.js +1 -0
  21. package/dist/cjs/src/data/import.js +1 -0
  22. package/dist/cjs/src/data/numerics.js +1 -0
  23. package/dist/cjs/src/helpers/sceneHelper.js +1 -0
  24. package/dist/cjs/src/index.js +1 -79
  25. package/dist/cjs/src/managers/components/animationManager.js +1 -0
  26. package/dist/cjs/src/managers/components/componentManager.js +1 -0
  27. package/dist/cjs/src/managers/components/pathfindingManager.js +1 -0
  28. package/dist/cjs/src/managers/controls/TransformControls.js +1 -0
  29. package/dist/cjs/src/managers/controls/cameraControlsManager.js +1 -0
  30. package/dist/cjs/src/managers/controls/dragDropManager.js +1 -0
  31. package/dist/cjs/src/managers/controls/keyboardControlsManager.js +1 -0
  32. package/dist/cjs/src/managers/controls/transformControlsManager.js +1 -0
  33. package/dist/cjs/src/managers/environment/environmentManager.js +1 -0
  34. package/dist/cjs/src/managers/environment/textureConfig.js +1 -0
  35. package/dist/cjs/src/managers/scene/sceneExportManager.js +1 -0
  36. package/dist/cjs/src/managers/scene/sceneInitializationManager.js +1 -0
  37. package/dist/cjs/src/managers/scene/sceneOperationsManager.js +1 -0
  38. package/dist/cjs/src/managers/scene/sceneTooltipsManager.js +1 -0
  39. package/dist/cjs/src/managers/system/disposalManager.js +1 -0
  40. package/dist/cjs/src/managers/system/hotReloadManager.js +1 -0
  41. package/dist/cjs/src/managers/system/performanceMonitor.js +1 -0
  42. package/dist/cjs/src/rendering/modelPreloader.js +1 -0
  43. package/dist/cjs/src/rendering/rendering2D.js +1 -0
  44. package/dist/cjs/src/rendering/rendering3D.js +1 -0
  45. package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +1 -339
  46. package/dist/esm/node_modules/@2112-lab/pathfinder/dist/index.esm.js +1 -1444
  47. package/dist/esm/node_modules/three/examples/jsm/controls/OrbitControls.js +1 -1287
  48. package/dist/esm/node_modules/three/examples/jsm/exporters/GLTFExporter.js +1 -0
  49. package/dist/esm/node_modules/three/examples/jsm/exporters/OBJExporter.js +1 -0
  50. package/dist/esm/node_modules/three/examples/jsm/exporters/PLYExporter.js +1 -0
  51. package/dist/esm/node_modules/three/examples/jsm/exporters/STLExporter.js +1 -0
  52. package/dist/esm/node_modules/three/examples/jsm/loaders/DRACOLoader.js +1 -0
  53. package/dist/esm/node_modules/three/examples/jsm/loaders/GLTFLoader.js +1 -4370
  54. package/dist/esm/node_modules/three/examples/jsm/loaders/RGBELoader.js +1 -461
  55. package/dist/esm/node_modules/three/examples/jsm/renderers/CSS2DRenderer.js +1 -0
  56. package/dist/esm/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js +1 -113
  57. package/dist/esm/src/analysis/analysis.js +1 -0
  58. package/dist/esm/src/analysis/testing.js +1 -0
  59. package/dist/esm/src/core/centralPlant.js +1 -0
  60. package/dist/esm/src/core/debugLogger.js +1 -0
  61. package/dist/esm/src/core/mathUtils.js +1 -0
  62. package/dist/esm/src/core/nameUtils.js +1 -0
  63. package/dist/esm/src/data/export.js +1 -0
  64. package/dist/esm/src/data/import.js +1 -0
  65. package/dist/esm/src/data/numerics.js +1 -0
  66. package/dist/esm/src/helpers/sceneHelper.js +1 -0
  67. package/dist/esm/src/index.js +1 -70
  68. package/dist/esm/src/managers/components/animationManager.js +1 -0
  69. package/dist/esm/src/managers/components/componentManager.js +1 -0
  70. package/dist/esm/src/managers/components/pathfindingManager.js +1 -0
  71. package/dist/esm/src/managers/controls/TransformControls.js +1 -0
  72. package/dist/esm/src/managers/controls/cameraControlsManager.js +1 -0
  73. package/dist/esm/src/managers/controls/dragDropManager.js +1 -0
  74. package/dist/esm/src/managers/controls/keyboardControlsManager.js +1 -0
  75. package/dist/esm/src/managers/controls/transformControlsManager.js +1 -0
  76. package/dist/esm/src/managers/environment/environmentManager.js +1 -0
  77. package/dist/esm/src/managers/environment/textureConfig.js +1 -0
  78. package/dist/esm/src/managers/scene/sceneExportManager.js +1 -0
  79. package/dist/esm/src/managers/scene/sceneInitializationManager.js +1 -0
  80. package/dist/esm/src/managers/scene/sceneOperationsManager.js +1 -0
  81. package/dist/esm/src/managers/scene/sceneTooltipsManager.js +1 -0
  82. package/dist/esm/src/managers/system/disposalManager.js +1 -0
  83. package/dist/esm/src/managers/system/hotReloadManager.js +1 -0
  84. package/dist/esm/src/managers/system/performanceMonitor.js +1 -0
  85. package/dist/esm/src/rendering/modelPreloader.js +1 -0
  86. package/dist/esm/src/rendering/rendering2D.js +1 -0
  87. package/dist/esm/src/rendering/rendering3D.js +1 -0
  88. package/dist/index.d.ts +52 -255
  89. package/package.json +3 -6
  90. package/dist/cjs/node_modules/three/examples/jsm/controls/TransformControls.js +0 -1543
  91. package/dist/cjs/src/animationManager.js +0 -121
  92. package/dist/cjs/src/componentManager.js +0 -151
  93. package/dist/cjs/src/debugLogger.js +0 -176
  94. package/dist/cjs/src/disposalManager.js +0 -185
  95. package/dist/cjs/src/environmentManager.js +0 -1308
  96. package/dist/cjs/src/hotReloadManager.js +0 -252
  97. package/dist/cjs/src/keyboardControlsManager.js +0 -206
  98. package/dist/cjs/src/nameUtils.js +0 -106
  99. package/dist/cjs/src/pathfindingManager.js +0 -503
  100. package/dist/cjs/src/performanceMonitor.js +0 -718
  101. package/dist/cjs/src/sceneExportManager.js +0 -292
  102. package/dist/cjs/src/sceneInitializationManager.js +0 -540
  103. package/dist/cjs/src/textureConfig.js +0 -624
  104. package/dist/cjs/src/transformControlsManager.js +0 -851
  105. package/dist/esm/node_modules/three/examples/jsm/controls/TransformControls.js +0 -1537
  106. package/dist/esm/src/animationManager.js +0 -112
  107. package/dist/esm/src/componentManager.js +0 -123
  108. package/dist/esm/src/debugLogger.js +0 -167
  109. package/dist/esm/src/disposalManager.js +0 -155
  110. package/dist/esm/src/environmentManager.js +0 -1282
  111. package/dist/esm/src/hotReloadManager.js +0 -244
  112. package/dist/esm/src/keyboardControlsManager.js +0 -196
  113. package/dist/esm/src/nameUtils.js +0 -99
  114. package/dist/esm/src/pathfindingManager.js +0 -479
  115. package/dist/esm/src/performanceMonitor.js +0 -712
  116. package/dist/esm/src/sceneExportManager.js +0 -286
  117. package/dist/esm/src/sceneInitializationManager.js +0 -513
  118. package/dist/esm/src/textureConfig.js +0 -595
  119. package/dist/esm/src/transformControlsManager.js +0 -827
@@ -1,461 +1 @@
1
- import { DataTextureLoader, HalfFloatType, FloatType, DataUtils, LinearEncoding, LinearFilter } from 'three';
2
-
3
- // https://github.com/mrdoob/three.js/issues/5552
4
- // http://en.wikipedia.org/wiki/RGBE_image_format
5
-
6
- class RGBELoader extends DataTextureLoader {
7
-
8
- constructor( manager ) {
9
-
10
- super( manager );
11
-
12
- this.type = HalfFloatType;
13
-
14
- }
15
-
16
- // adapted from http://www.graphics.cornell.edu/~bjw/rgbe.html
17
-
18
- parse( buffer ) {
19
-
20
- const
21
- /* return codes for rgbe routines */
22
- //RGBE_RETURN_SUCCESS = 0,
23
- RGBE_RETURN_FAILURE = - 1,
24
-
25
- /* default error routine. change this to change error handling */
26
- rgbe_read_error = 1,
27
- rgbe_write_error = 2,
28
- rgbe_format_error = 3,
29
- rgbe_memory_error = 4,
30
- rgbe_error = function ( rgbe_error_code, msg ) {
31
-
32
- switch ( rgbe_error_code ) {
33
-
34
- case rgbe_read_error: console.error( 'THREE.RGBELoader Read Error: ' + ( msg || '' ) );
35
- break;
36
- case rgbe_write_error: console.error( 'THREE.RGBELoader Write Error: ' + ( msg || '' ) );
37
- break;
38
- case rgbe_format_error: console.error( 'THREE.RGBELoader Bad File Format: ' + ( msg || '' ) );
39
- break;
40
- default:
41
- case rgbe_memory_error: console.error( 'THREE.RGBELoader: Error: ' + ( msg || '' ) );
42
-
43
- }
44
-
45
- return RGBE_RETURN_FAILURE;
46
-
47
- },
48
-
49
- /* offsets to red, green, and blue components in a data (float) pixel */
50
- //RGBE_DATA_RED = 0,
51
- //RGBE_DATA_GREEN = 1,
52
- //RGBE_DATA_BLUE = 2,
53
-
54
- /* number of floats per pixel, use 4 since stored in rgba image format */
55
- //RGBE_DATA_SIZE = 4,
56
-
57
- /* flags indicating which fields in an rgbe_header_info are valid */
58
- RGBE_VALID_PROGRAMTYPE = 1,
59
- RGBE_VALID_FORMAT = 2,
60
- RGBE_VALID_DIMENSIONS = 4,
61
-
62
- NEWLINE = '\n',
63
-
64
- fgets = function ( buffer, lineLimit, consume ) {
65
-
66
- const chunkSize = 128;
67
-
68
- lineLimit = ! lineLimit ? 1024 : lineLimit;
69
- let p = buffer.pos,
70
- i = - 1, len = 0, s = '',
71
- chunk = String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) );
72
-
73
- while ( ( 0 > ( i = chunk.indexOf( NEWLINE ) ) ) && ( len < lineLimit ) && ( p < buffer.byteLength ) ) {
74
-
75
- s += chunk; len += chunk.length;
76
- p += chunkSize;
77
- chunk += String.fromCharCode.apply( null, new Uint16Array( buffer.subarray( p, p + chunkSize ) ) );
78
-
79
- }
80
-
81
- if ( - 1 < i ) {
82
-
83
- /*for (i=l-1; i>=0; i--) {
84
- byteCode = m.charCodeAt(i);
85
- if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++;
86
- else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2;
87
- if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate
88
- }*/
89
- if ( false !== consume ) buffer.pos += len + i + 1;
90
- return s + chunk.slice( 0, i );
91
-
92
- }
93
-
94
- return false;
95
-
96
- },
97
-
98
- /* minimal header reading. modify if you want to parse more information */
99
- RGBE_ReadHeader = function ( buffer ) {
100
-
101
-
102
- // regexes to parse header info fields
103
- const magic_token_re = /^#\?(\S+)/,
104
- gamma_re = /^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,
105
- exposure_re = /^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,
106
- format_re = /^\s*FORMAT=(\S+)\s*$/,
107
- dimensions_re = /^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,
108
-
109
- // RGBE format header struct
110
- header = {
111
-
112
- valid: 0, /* indicate which fields are valid */
113
-
114
- string: '', /* the actual header string */
115
-
116
- comments: '', /* comments found in header */
117
-
118
- programtype: 'RGBE', /* listed at beginning of file to identify it after "#?". defaults to "RGBE" */
119
-
120
- format: '', /* RGBE format, default 32-bit_rle_rgbe */
121
-
122
- gamma: 1.0, /* image has already been gamma corrected with given gamma. defaults to 1.0 (no correction) */
123
-
124
- exposure: 1.0, /* a value of 1.0 in an image corresponds to <exposure> watts/steradian/m^2. defaults to 1.0 */
125
-
126
- width: 0, height: 0 /* image dimensions, width/height */
127
-
128
- };
129
-
130
- let line, match;
131
-
132
- if ( buffer.pos >= buffer.byteLength || ! ( line = fgets( buffer ) ) ) {
133
-
134
- return rgbe_error( rgbe_read_error, 'no header found' );
135
-
136
- }
137
-
138
- /* if you want to require the magic token then uncomment the next line */
139
- if ( ! ( match = line.match( magic_token_re ) ) ) {
140
-
141
- return rgbe_error( rgbe_format_error, 'bad initial token' );
142
-
143
- }
144
-
145
- header.valid |= RGBE_VALID_PROGRAMTYPE;
146
- header.programtype = match[ 1 ];
147
- header.string += line + '\n';
148
-
149
- while ( true ) {
150
-
151
- line = fgets( buffer );
152
- if ( false === line ) break;
153
- header.string += line + '\n';
154
-
155
- if ( '#' === line.charAt( 0 ) ) {
156
-
157
- header.comments += line + '\n';
158
- continue; // comment line
159
-
160
- }
161
-
162
- if ( match = line.match( gamma_re ) ) {
163
-
164
- header.gamma = parseFloat( match[ 1 ] );
165
-
166
- }
167
-
168
- if ( match = line.match( exposure_re ) ) {
169
-
170
- header.exposure = parseFloat( match[ 1 ] );
171
-
172
- }
173
-
174
- if ( match = line.match( format_re ) ) {
175
-
176
- header.valid |= RGBE_VALID_FORMAT;
177
- header.format = match[ 1 ];//'32-bit_rle_rgbe';
178
-
179
- }
180
-
181
- if ( match = line.match( dimensions_re ) ) {
182
-
183
- header.valid |= RGBE_VALID_DIMENSIONS;
184
- header.height = parseInt( match[ 1 ], 10 );
185
- header.width = parseInt( match[ 2 ], 10 );
186
-
187
- }
188
-
189
- if ( ( header.valid & RGBE_VALID_FORMAT ) && ( header.valid & RGBE_VALID_DIMENSIONS ) ) break;
190
-
191
- }
192
-
193
- if ( ! ( header.valid & RGBE_VALID_FORMAT ) ) {
194
-
195
- return rgbe_error( rgbe_format_error, 'missing format specifier' );
196
-
197
- }
198
-
199
- if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) {
200
-
201
- return rgbe_error( rgbe_format_error, 'missing image size specifier' );
202
-
203
- }
204
-
205
- return header;
206
-
207
- },
208
-
209
- RGBE_ReadPixels_RLE = function ( buffer, w, h ) {
210
-
211
- const scanline_width = w;
212
-
213
- if (
214
- // run length encoding is not allowed so read flat
215
- ( ( scanline_width < 8 ) || ( scanline_width > 0x7fff ) ) ||
216
- // this file is not run length encoded
217
- ( ( 2 !== buffer[ 0 ] ) || ( 2 !== buffer[ 1 ] ) || ( buffer[ 2 ] & 0x80 ) )
218
- ) {
219
-
220
- // return the flat buffer
221
- return new Uint8Array( buffer );
222
-
223
- }
224
-
225
- if ( scanline_width !== ( ( buffer[ 2 ] << 8 ) | buffer[ 3 ] ) ) {
226
-
227
- return rgbe_error( rgbe_format_error, 'wrong scanline width' );
228
-
229
- }
230
-
231
- const data_rgba = new Uint8Array( 4 * w * h );
232
-
233
- if ( ! data_rgba.length ) {
234
-
235
- return rgbe_error( rgbe_memory_error, 'unable to allocate buffer space' );
236
-
237
- }
238
-
239
- let offset = 0, pos = 0;
240
-
241
- const ptr_end = 4 * scanline_width;
242
- const rgbeStart = new Uint8Array( 4 );
243
- const scanline_buffer = new Uint8Array( ptr_end );
244
- let num_scanlines = h;
245
-
246
- // read in each successive scanline
247
- while ( ( num_scanlines > 0 ) && ( pos < buffer.byteLength ) ) {
248
-
249
- if ( pos + 4 > buffer.byteLength ) {
250
-
251
- return rgbe_error( rgbe_read_error );
252
-
253
- }
254
-
255
- rgbeStart[ 0 ] = buffer[ pos ++ ];
256
- rgbeStart[ 1 ] = buffer[ pos ++ ];
257
- rgbeStart[ 2 ] = buffer[ pos ++ ];
258
- rgbeStart[ 3 ] = buffer[ pos ++ ];
259
-
260
- if ( ( 2 != rgbeStart[ 0 ] ) || ( 2 != rgbeStart[ 1 ] ) || ( ( ( rgbeStart[ 2 ] << 8 ) | rgbeStart[ 3 ] ) != scanline_width ) ) {
261
-
262
- return rgbe_error( rgbe_format_error, 'bad rgbe scanline format' );
263
-
264
- }
265
-
266
- // read each of the four channels for the scanline into the buffer
267
- // first red, then green, then blue, then exponent
268
- let ptr = 0, count;
269
-
270
- while ( ( ptr < ptr_end ) && ( pos < buffer.byteLength ) ) {
271
-
272
- count = buffer[ pos ++ ];
273
- const isEncodedRun = count > 128;
274
- if ( isEncodedRun ) count -= 128;
275
-
276
- if ( ( 0 === count ) || ( ptr + count > ptr_end ) ) {
277
-
278
- return rgbe_error( rgbe_format_error, 'bad scanline data' );
279
-
280
- }
281
-
282
- if ( isEncodedRun ) {
283
-
284
- // a (encoded) run of the same value
285
- const byteValue = buffer[ pos ++ ];
286
- for ( let i = 0; i < count; i ++ ) {
287
-
288
- scanline_buffer[ ptr ++ ] = byteValue;
289
-
290
- }
291
- //ptr += count;
292
-
293
- } else {
294
-
295
- // a literal-run
296
- scanline_buffer.set( buffer.subarray( pos, pos + count ), ptr );
297
- ptr += count; pos += count;
298
-
299
- }
300
-
301
- }
302
-
303
-
304
- // now convert data from buffer into rgba
305
- // first red, then green, then blue, then exponent (alpha)
306
- const l = scanline_width; //scanline_buffer.byteLength;
307
- for ( let i = 0; i < l; i ++ ) {
308
-
309
- let off = 0;
310
- data_rgba[ offset ] = scanline_buffer[ i + off ];
311
- off += scanline_width; //1;
312
- data_rgba[ offset + 1 ] = scanline_buffer[ i + off ];
313
- off += scanline_width; //1;
314
- data_rgba[ offset + 2 ] = scanline_buffer[ i + off ];
315
- off += scanline_width; //1;
316
- data_rgba[ offset + 3 ] = scanline_buffer[ i + off ];
317
- offset += 4;
318
-
319
- }
320
-
321
- num_scanlines --;
322
-
323
- }
324
-
325
- return data_rgba;
326
-
327
- };
328
-
329
- const RGBEByteToRGBFloat = function ( sourceArray, sourceOffset, destArray, destOffset ) {
330
-
331
- const e = sourceArray[ sourceOffset + 3 ];
332
- const scale = Math.pow( 2.0, e - 128.0 ) / 255.0;
333
-
334
- destArray[ destOffset + 0 ] = sourceArray[ sourceOffset + 0 ] * scale;
335
- destArray[ destOffset + 1 ] = sourceArray[ sourceOffset + 1 ] * scale;
336
- destArray[ destOffset + 2 ] = sourceArray[ sourceOffset + 2 ] * scale;
337
- destArray[ destOffset + 3 ] = 1;
338
-
339
- };
340
-
341
- const RGBEByteToRGBHalf = function ( sourceArray, sourceOffset, destArray, destOffset ) {
342
-
343
- const e = sourceArray[ sourceOffset + 3 ];
344
- const scale = Math.pow( 2.0, e - 128.0 ) / 255.0;
345
-
346
- // clamping to 65504, the maximum representable value in float16
347
- destArray[ destOffset + 0 ] = DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 0 ] * scale, 65504 ) );
348
- destArray[ destOffset + 1 ] = DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 1 ] * scale, 65504 ) );
349
- destArray[ destOffset + 2 ] = DataUtils.toHalfFloat( Math.min( sourceArray[ sourceOffset + 2 ] * scale, 65504 ) );
350
- destArray[ destOffset + 3 ] = DataUtils.toHalfFloat( 1 );
351
-
352
- };
353
-
354
- const byteArray = new Uint8Array( buffer );
355
- byteArray.pos = 0;
356
- const rgbe_header_info = RGBE_ReadHeader( byteArray );
357
-
358
- if ( RGBE_RETURN_FAILURE !== rgbe_header_info ) {
359
-
360
- const w = rgbe_header_info.width,
361
- h = rgbe_header_info.height,
362
- image_rgba_data = RGBE_ReadPixels_RLE( byteArray.subarray( byteArray.pos ), w, h );
363
-
364
- if ( RGBE_RETURN_FAILURE !== image_rgba_data ) {
365
-
366
- let data, type;
367
- let numElements;
368
-
369
- switch ( this.type ) {
370
-
371
- case FloatType:
372
-
373
- numElements = image_rgba_data.length / 4;
374
- const floatArray = new Float32Array( numElements * 4 );
375
-
376
- for ( let j = 0; j < numElements; j ++ ) {
377
-
378
- RGBEByteToRGBFloat( image_rgba_data, j * 4, floatArray, j * 4 );
379
-
380
- }
381
-
382
- data = floatArray;
383
- type = FloatType;
384
- break;
385
-
386
- case HalfFloatType:
387
-
388
- numElements = image_rgba_data.length / 4;
389
- const halfArray = new Uint16Array( numElements * 4 );
390
-
391
- for ( let j = 0; j < numElements; j ++ ) {
392
-
393
- RGBEByteToRGBHalf( image_rgba_data, j * 4, halfArray, j * 4 );
394
-
395
- }
396
-
397
- data = halfArray;
398
- type = HalfFloatType;
399
- break;
400
-
401
- default:
402
-
403
- console.error( 'THREE.RGBELoader: unsupported type: ', this.type );
404
- break;
405
-
406
- }
407
-
408
- return {
409
- width: w, height: h,
410
- data: data,
411
- header: rgbe_header_info.string,
412
- gamma: rgbe_header_info.gamma,
413
- exposure: rgbe_header_info.exposure,
414
- type: type
415
- };
416
-
417
- }
418
-
419
- }
420
-
421
- return null;
422
-
423
- }
424
-
425
- setDataType( value ) {
426
-
427
- this.type = value;
428
- return this;
429
-
430
- }
431
-
432
- load( url, onLoad, onProgress, onError ) {
433
-
434
- function onLoadCallback( texture, texData ) {
435
-
436
- switch ( texture.type ) {
437
-
438
- case FloatType:
439
- case HalfFloatType:
440
-
441
- texture.encoding = LinearEncoding;
442
- texture.minFilter = LinearFilter;
443
- texture.magFilter = LinearFilter;
444
- texture.generateMipmaps = false;
445
- texture.flipY = true;
446
-
447
- break;
448
-
449
- }
450
-
451
- if ( onLoad ) onLoad( texture, texData );
452
-
453
- }
454
-
455
- return super.load( url, onLoadCallback, onProgress, onError );
456
-
457
- }
458
-
459
- }
460
-
461
- export { RGBELoader };
1
+ import{DataTextureLoader as r,HalfFloatType as t,FloatType as e,DataUtils as n,LinearSRGBColorSpace as a,LinearFilter as s}from"three";class o extends r{constructor(r){super(r),this.type=t}parse(r){const a=function(r,t){switch(r){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},s=function(r,t,e){t=t||1024;let n=r.pos,a=-1,s=0,o="",i=String.fromCharCode.apply(null,new Uint16Array(r.subarray(n,n+128)));for(;0>(a=i.indexOf("\n"))&&s<t&&n<r.byteLength;)o+=i,s+=i.length,n+=128,i+=String.fromCharCode.apply(null,new Uint16Array(r.subarray(n,n+128)));return-1<a&&(!1!==e&&(r.pos+=s+a+1),o+i.slice(0,a))},o=function(r,t,e,n){const a=r[t+3],s=Math.pow(2,a-128)/255;e[n+0]=r[t+0]*s,e[n+1]=r[t+1]*s,e[n+2]=r[t+2]*s,e[n+3]=1},i=function(r,t,e,a){const s=r[t+3],o=Math.pow(2,s-128)/255;e[a+0]=n.toHalfFloat(Math.min(r[t+0]*o,65504)),e[a+1]=n.toHalfFloat(Math.min(r[t+1]*o,65504)),e[a+2]=n.toHalfFloat(Math.min(r[t+2]*o,65504)),e[a+3]=n.toHalfFloat(1)},c=new Uint8Array(r);c.pos=0;const l=function(r){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,e=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,i={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,l;for((r.pos>=r.byteLength||!(c=s(r)))&&a(1,"no header found"),(l=c.match(/^#\?(\S+)/))||a(3,"bad initial token"),i.valid|=1,i.programtype=l[1],i.string+=c+"\n";c=s(r),!1!==c;)if(i.string+=c+"\n","#"!==c.charAt(0)){if((l=c.match(t))&&(i.gamma=parseFloat(l[1])),(l=c.match(e))&&(i.exposure=parseFloat(l[1])),(l=c.match(n))&&(i.valid|=2,i.format=l[1]),(l=c.match(o))&&(i.valid|=4,i.height=parseInt(l[1],10),i.width=parseInt(l[2],10)),2&i.valid&&4&i.valid)break}else i.comments+=c+"\n";return 2&i.valid||a(3,"missing format specifier"),4&i.valid||a(3,"missing image size specifier"),i}(c),d=l.width,f=l.height,h=function(r,t,e){const n=t;if(n<8||n>32767||2!==r[0]||2!==r[1]||128&r[2])return new Uint8Array(r);n!==(r[2]<<8|r[3])&&a(3,"wrong scanline width");const s=new Uint8Array(4*t*e);s.length||a(4,"unable to allocate buffer space");let o=0,i=0;const c=4*n,l=new Uint8Array(4),d=new Uint8Array(c);let f=e;for(;f>0&&i<r.byteLength;){i+4>r.byteLength&&a(1),l[0]=r[i++],l[1]=r[i++],l[2]=r[i++],l[3]=r[i++],2==l[0]&&2==l[1]&&(l[2]<<8|l[3])==n||a(3,"bad rgbe scanline format");let t,e=0;for(;e<c&&i<r.byteLength;){t=r[i++];const n=t>128;if(n&&(t-=128),(0===t||e+t>c)&&a(3,"bad scanline data"),n){const n=r[i++];for(let r=0;r<t;r++)d[e++]=n}else d.set(r.subarray(i,i+t),e),e+=t,i+=t}const h=n;for(let r=0;r<h;r++){let t=0;s[o]=d[r+t],t+=n,s[o+1]=d[r+t],t+=n,s[o+2]=d[r+t],t+=n,s[o+3]=d[r+t],o+=4}f--}return s}(c.subarray(c.pos),d,f);let u,w,E;switch(this.type){case e:E=h.length/4;const r=new Float32Array(4*E);for(let t=0;t<E;t++)o(h,4*t,r,4*t);u=r,w=e;break;case t:E=h.length/4;const n=new Uint16Array(4*E);for(let r=0;r<E;r++)i(h,4*r,n,4*r);u=n,w=t;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:d,height:f,data:u,header:l.string,gamma:l.gamma,exposure:l.exposure,type:w}}setDataType(r){return this.type=r,this}load(r,n,o,i){return super.load(r,function(r,o){switch(r.type){case e:case t:r.colorSpace=a,r.minFilter=s,r.magFilter=s,r.generateMipmaps=!1,r.flipY=!0}n&&n(r,o)},o,i)}}export{o as RGBELoader};
@@ -0,0 +1 @@
1
+ import{Object3D as t,Vector2 as n,Vector3 as e,Matrix4 as o}from"three";class i extends t{constructor(t=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new n(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element instanceof t.element.ownerDocument.defaultView.Element&&null!==t.element.parentNode&&t.element.remove()})})}copy(t,n){return super.copy(t,n),this.element=t.element.cloneNode(!0),this.center=t.center,this}}const s=new e,c=new o,r=new o,u=new e,h=new e;class f{constructor(t={}){const n=this;let e,o,i,f;const a={objects:new WeakMap},l=void 0!==t.element?t.element:document.createElement("div");function d(t){t.isCSS2DObject&&(t.element.style.display="none");for(let n=0,e=t.children.length;n<e;n++)d(t.children[n])}function p(t,e,o){if(!1!==t.visible){if(t.isCSS2DObject){s.setFromMatrixPosition(t.matrixWorld),s.applyMatrix4(r);const c=s.z>=-1&&s.z<=1&&!0===t.layers.test(o.layers),u=t.element;u.style.display=!0===c?"":"none",!0===c&&(t.onBeforeRender(n,e,o),u.style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(s.x*i+i)+"px,"+(-s.y*f+f)+"px)",u.parentNode!==l&&l.appendChild(u),t.onAfterRender(n,e,o));const h={distanceToCameraSquared:w(o,t)};a.objects.set(t,h)}for(let n=0,i=t.children.length;n<i;n++)p(t.children[n],e,o)}else d(t)}function w(t,n){return u.setFromMatrixPosition(t.matrixWorld),h.setFromMatrixPosition(n.matrixWorld),u.distanceToSquared(h)}l.style.overflow="hidden",this.domElement=l,this.getSize=function(){return{width:e,height:o}},this.render=function(t,n){!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===n.parent&&!0===n.matrixWorldAutoUpdate&&n.updateMatrixWorld(),c.copy(n.matrixWorldInverse),r.multiplyMatrices(n.projectionMatrix,c),p(t,t,n),function(t){const n=function(t){const n=[];return t.traverseVisible(function(t){t.isCSS2DObject&&n.push(t)}),n}(t).sort(function(t,n){if(t.renderOrder!==n.renderOrder)return n.renderOrder-t.renderOrder;return a.objects.get(t).distanceToCameraSquared-a.objects.get(n).distanceToCameraSquared}),e=n.length;for(let t=0,o=n.length;t<o;t++)n[t].element.style.zIndex=e-t}(t)},this.setSize=function(t,n){e=t,o=n,i=e/2,f=o/2,l.style.width=t+"px",l.style.height=n+"px"}}}export{i as CSS2DObject,f as CSS2DRenderer};
@@ -1,113 +1 @@
1
- import { TrianglesDrawMode, TriangleFanDrawMode, TriangleStripDrawMode } from 'three';
2
-
3
- /**
4
- * @param {BufferGeometry} geometry
5
- * @param {number} drawMode
6
- * @return {BufferGeometry}
7
- */
8
- function toTrianglesDrawMode( geometry, drawMode ) {
9
-
10
- if ( drawMode === TrianglesDrawMode ) {
11
-
12
- console.warn( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.' );
13
- return geometry;
14
-
15
- }
16
-
17
- if ( drawMode === TriangleFanDrawMode || drawMode === TriangleStripDrawMode ) {
18
-
19
- let index = geometry.getIndex();
20
-
21
- // generate index if not present
22
-
23
- if ( index === null ) {
24
-
25
- const indices = [];
26
-
27
- const position = geometry.getAttribute( 'position' );
28
-
29
- if ( position !== undefined ) {
30
-
31
- for ( let i = 0; i < position.count; i ++ ) {
32
-
33
- indices.push( i );
34
-
35
- }
36
-
37
- geometry.setIndex( indices );
38
- index = geometry.getIndex();
39
-
40
- } else {
41
-
42
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible.' );
43
- return geometry;
44
-
45
- }
46
-
47
- }
48
-
49
- //
50
-
51
- const numberOfTriangles = index.count - 2;
52
- const newIndices = [];
53
-
54
- if ( drawMode === TriangleFanDrawMode ) {
55
-
56
- // gl.TRIANGLE_FAN
57
-
58
- for ( let i = 1; i <= numberOfTriangles; i ++ ) {
59
-
60
- newIndices.push( index.getX( 0 ) );
61
- newIndices.push( index.getX( i ) );
62
- newIndices.push( index.getX( i + 1 ) );
63
-
64
- }
65
-
66
- } else {
67
-
68
- // gl.TRIANGLE_STRIP
69
-
70
- for ( let i = 0; i < numberOfTriangles; i ++ ) {
71
-
72
- if ( i % 2 === 0 ) {
73
-
74
- newIndices.push( index.getX( i ) );
75
- newIndices.push( index.getX( i + 1 ) );
76
- newIndices.push( index.getX( i + 2 ) );
77
-
78
- } else {
79
-
80
- newIndices.push( index.getX( i + 2 ) );
81
- newIndices.push( index.getX( i + 1 ) );
82
- newIndices.push( index.getX( i ) );
83
-
84
- }
85
-
86
- }
87
-
88
- }
89
-
90
- if ( ( newIndices.length / 3 ) !== numberOfTriangles ) {
91
-
92
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.' );
93
-
94
- }
95
-
96
- // build final geometry
97
-
98
- const newGeometry = geometry.clone();
99
- newGeometry.setIndex( newIndices );
100
- newGeometry.clearGroups();
101
-
102
- return newGeometry;
103
-
104
- } else {
105
-
106
- console.error( 'THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:', drawMode );
107
- return geometry;
108
-
109
- }
110
-
111
- }
112
-
113
- export { toTrianglesDrawMode };
1
+ import{TrianglesDrawMode as t,TriangleFanDrawMode as r,TriangleStripDrawMode as e}from"three";function o(o,n){if(n===t)return o;if(n===r||n===e){let t=o.getIndex();if(null===t){const r=[],e=o.getAttribute("position");if(void 0===e)return o;for(let t=0;t<e.count;t++)r.push(t);o.setIndex(r),t=o.getIndex()}const e=t.count-2,f=[];if(n===r)for(let r=1;r<=e;r++)f.push(t.getX(0)),f.push(t.getX(r)),f.push(t.getX(r+1));else for(let r=0;r<e;r++)r%2==0?(f.push(t.getX(r)),f.push(t.getX(r+1)),f.push(t.getX(r+2))):(f.push(t.getX(r+2)),f.push(t.getX(r+1)),f.push(t.getX(r)));f.length;const i=o.clone();return i.setIndex(f),i.clearGroups(),i}return o}export{o as toTrianglesDrawMode};
@@ -0,0 +1 @@
1
+ import{createClass as e,classCallCheck as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import*as n from"three";import{logger as i}from"../core/debugLogger.js";var a=function(){return e(function e(){t(this,e),this.analysisHistory=[],this.validationRules=new Map,this.adjustmentStrategies=new Map,this.initializeDefaultRules()},[{key:"initializeDefaultRules",value:function(){this.addValidationRule("component_bounds",{check:function(e){var t=(new n.Box3).setFromObject(e);return!t.isEmpty()&&t.getSize(new n.Vector3).length()>0},message:"Component has invalid bounding box"}),this.addValidationRule("component_position",{check:function(e){var t=e.position;return!isNaN(t.x)&&!isNaN(t.y)&&!isNaN(t.z)&&isFinite(t.x)&&isFinite(t.y)&&isFinite(t.z)},message:"Component has invalid position values"}),this.addValidationRule("component_scale",{check:function(e){var t=e.scale;return t.x>0&&t.y>0&&t.z>0&&t.x<1e3&&t.y<1e3&&t.z<1e3},message:"Component has invalid scale values"}),this.addValidationRule("scene_complexity",{check:function(e){var t=0;return e.traverse(function(e){e.isMesh&&t++}),t<1e4},message:"Scene complexity too high (too many meshes)"})}},{key:"addValidationRule",value:function(e,t){this.validationRules.set(e,t)}},{key:"addAdjustmentStrategy",value:function(e,t){this.adjustmentStrategies.set(e,t)}},{key:"analyzeScene",value:function(e){var t=performance.now();i.info("๐Ÿ” Starting scene analysis...");var n={timestamp:(new Date).toISOString(),performance:{},structure:{},quality:{},recommendations:[]},a=0,r=0,s=0,o=0,u=new Set,c=new Set;e.traverse(function(e){if(e.isMesh){if(a++,e.geometry){r++;var t=e.geometry.getAttribute("position");t&&(s+=t.count,e.geometry.index?o+=e.geometry.index.count/3:o+=t.count/3)}if(e.material)if(Array.isArray(e.material))e.material.forEach(function(e){return u.add(e.uuid)});else{u.add(e.material.uuid);var n=e.material;Object.keys(n).forEach(function(e){n[e]&&n[e].isTexture&&c.add(n[e].uuid)})}}}),n.performance={meshCount:a,geometryCount:r,materialCount:u.size,textureCount:c.size,vertexCount:s,triangleCount:o,memoryEstimate:this.estimateMemoryUsage(s,u.size,c.size)},n.structure=this.analyzeSceneStructure(e),n.quality=this.analyzeQuality(e),n.recommendations=this.generateRecommendations(n);var l=performance.now();return n.performance.analysisTime=l-t,i.info("โœ… Scene analysis complete in ".concat(n.performance.analysisTime.toFixed(2),"ms")),this.analysisHistory.push(n),n}},{key:"analyzeSceneStructure",value:function(e){var t={depth:0,branches:0,emptyNodes:0,namedObjects:0,groups:0},n=function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t.depth=Math.max(t.depth,i),e.children.length>0&&t.branches++,0!==e.children.length||e.isMesh||e.isLight||e.isCamera||t.emptyNodes++,e.name&&""!==e.name.trim()&&t.namedObjects++,e.isGroup&&t.groups++,e.children.forEach(function(e){return n(e,i+1)})};return n(e),t}},{key:"analyzeQuality",value:function(e){var t=this,n={duplicateMaterials:0,unusedMaterials:0,missingTextures:0,invalidTransforms:0,memoryLeaks:[],optimization:{mergeable:[],instancingCandidates:[]}},i=new Map,a=new Map;return e.traverse(function(e){if(e.material){var r=t.getMaterialSignature(e.material);i.has(r)?n.duplicateMaterials++:i.set(r,e.material)}if(e.geometry){var s=t.getGeometrySignature(e.geometry);a.has(s)||a.set(s,[]),a.get(s).push(e)}!e.position||isFinite(e.position.x)&&isFinite(e.position.y)&&isFinite(e.position.z)||n.invalidTransforms++}),a.forEach(function(e,t){e.length>1&&n.optimization.instancingCandidates.push({geometry:t,count:e.length,objects:e.map(function(e){return e.uuid})})}),n}},{key:"generateRecommendations",value:function(e){var t=[];return e.performance.triangleCount>5e5&&t.push({type:"performance",priority:"high",message:"Consider using Level of Detail (LOD) for high polygon models",action:"implement_lod"}),e.performance.materialCount>50&&t.push({type:"performance",priority:"medium",message:"High material count detected. Consider material atlasing",action:"optimize_materials"}),e.quality.duplicateMaterials>10&&t.push({type:"optimization",priority:"medium",message:"Duplicate materials found. Consider material sharing",action:"merge_materials"}),e.quality.optimization.instancingCandidates.length>0&&t.push({type:"optimization",priority:"high",message:"Instancing opportunities detected for repeated geometries",action:"implement_instancing"}),t}},{key:"validateScene",value:function(e){var t=this;i.info("๐Ÿ” Validating scene components...");var n={passed:[],failed:[],warnings:[]};return this.validationRules.forEach(function(t,i){try{t.check(e)?n.passed.push({rule:i,target:"scene"}):n.failed.push({rule:i,target:"scene",message:t.message})}catch(e){n.warnings.push({rule:i,target:"scene",message:"Validation error: ".concat(e.message)})}}),e.traverse(function(e){e.isMesh&&t.validationRules.forEach(function(t,i){try{t.check(e)?n.passed.push({rule:i,target:e.uuid}):n.failed.push({rule:i,target:e.uuid,message:t.message,objectName:e.name||"Unnamed Object"})}catch(t){n.warnings.push({rule:i,target:e.uuid,message:"Validation error: ".concat(t.message),objectName:e.name||"Unnamed Object"})}})}),i.info("โœ… Validation complete: ".concat(n.passed.length," passed, ").concat(n.failed.length," failed, ").concat(n.warnings.length," warnings")),n}},{key:"applyAdjustments",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];i.info("๐Ÿ”ง Applying scene adjustments...");var a={applied:[],failed:[],skipped:[]};return n.forEach(function(n){var i=t.adjustmentStrategies.get(n.type);if(i)try{var r=i(e,n.options||{});a.applied.push({adjustment:n.type,result:r})}catch(e){a.failed.push({adjustment:n.type,error:e.message})}else a.skipped.push({adjustment:n.type,reason:"No strategy found"})}),i.info("โœ… Adjustments complete: ".concat(a.applied.length," applied, ").concat(a.failed.length," failed, ").concat(a.skipped.length," skipped")),a}},{key:"getMaterialSignature",value:function(e){var t={type:e.type,color:e.color?e.color.getHex():null,metalness:e.metalness,roughness:e.roughness,transparent:e.transparent,opacity:e.opacity};return JSON.stringify(t)}},{key:"getGeometrySignature",value:function(e){var t,n=Object.keys(e.attributes),i=(null===(t=e.getAttribute("position"))||void 0===t?void 0:t.count)||0,a=!!e.index;return"".concat(e.type,"_").concat(i,"_").concat(a,"_").concat(n.join(","))}},{key:"estimateMemoryUsage",value:function(e,t,n){var i=32*e,a=1024*t,r=1048576*n,s=i+a+r;return{geometry:this.formatBytes(i),materials:this.formatBytes(a),textures:this.formatBytes(r),total:this.formatBytes(s),totalBytes:s}}},{key:"formatBytes",value:function(e){if(0===e)return"0 Bytes";var t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["Bytes","KB","MB","GB"][t]}},{key:"getAnalysisHistory",value:function(){return this.analysisHistory}},{key:"clearHistory",value:function(){this.analysisHistory=[]}},{key:"dispose",value:function(){this.clearHistory(),this.validationRules.clear(),this.adjustmentStrategies.clear(),i.info("Analysis disposed")}}])}();export{a as Analysis};
@@ -0,0 +1 @@
1
+ import{createClass as e,typeof as t,createForOfIteratorHelper as r,slicedToArray as n,classCallCheck as o,defineProperty as s,objectSpread2 as i,asyncToGenerator as a,regenerator as u}from"../../_virtual/_rollupPluginBabelHelpers.js";import{logger as c}from"../core/debugLogger.js";var f=function(){return e(function e(){var t,r=this;o(this,e),s(this,"mock",{create:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=i({calls:[],callCount:0},e);return Object.keys(e).forEach(function(r){var n=e[r];t[r]=function(){for(var e=arguments.length,o=new Array(e),s=0;s<e;s++)o[s]=arguments[s];return t.calls.push({method:r,args:o,timestamp:Date.now()}),t.callCount++,n.apply(void 0,o)}}),t},spy:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){},t=function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.calls.push({args:n,timestamp:Date.now()}),t.callCount++,void 0!==t.returnValue?t.returnValue:e.apply(void 0,n)};return t.calls=[],t.callCount=0,t.returnValue=void 0,t.returns=function(e){return t.returnValue=e,t},t.throws=function(e){return t.throwError=e,t},t},three:{vector3:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{x:e,y:t,z:r,set:function(n,o,s){e=n,t=o,r=s},clone:function(){return{x:e,y:t,z:r}},add:function(n){return{x:e+n.x,y:t+n.y,z:r+n.z}},sub:function(n){return{x:e-n.x,y:t-n.y,z:r-n.z}},length:function(){return Math.sqrt(e*e+t*t+r*r)},normalize:function(){var n=Math.sqrt(e*e+t*t+r*r);return{x:e/n,y:t/n,z:r/n}}}},object3D:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{position:{x:0,y:0,z:0},rotation:{x:0,y:0,z:0},scale:{x:1,y:1,z:1},children:[],parent:null,name:e.name||"",uuid:e.uuid||Math.random().toString(36),add:function(e){this.children.push(e),e.parent=this},remove:function(e){var t=this.children.indexOf(e);t>-1&&this.children.splice(t,1)},traverse:function(e){e(this),this.children.forEach(function(t){return t.traverse(e)})}}},scene:function(){return i(i({},r.mock.three.object3D()),{},{background:null,environment:null,fog:null,type:"Scene"})}}}),s(this,"benchmark",{run:(t=a(u().m(function e(t,n){var o,s,i,a,f,h,d,l,p,m,w,v,E,g,y,b,k,x,T,M=arguments;return u().w(function(e){for(;;)switch(e.n){case 0:s=(o=M.length>2&&void 0!==M[2]?M[2]:{}).iterations,i=void 0===s?1e3:s,a=o.warmupIterations,f=void 0===a?10:a,h=o.timeout,d=void 0===h?5e3:h,c.info("โฑ๏ธ Running benchmark: ".concat(t)),l=0;case 1:if(!(l<f)){e.n=3;break}return e.n=2,n();case 2:l++,e.n=1;break;case 3:p=[],m=performance.now(),w=0;case 4:if(!(w<i)){e.n=7;break}return v=performance.now(),e.n=5,n();case 5:if(E=performance.now(),p.push(E-v),!(performance.now()-m>d)){e.n=6;break}return c.warn('โš ๏ธ Benchmark "'.concat(t,'" timed out after ').concat(w+1," iterations")),e.a(3,7);case 6:w++,e.n=4;break;case 7:return g=performance.now()-m,y=p.reduce(function(e,t){return e+t},0)/p.length,b=Math.min.apply(Math,p),k=Math.max.apply(Math,p),x=p.sort()[Math.floor(p.length/2)],T={name:t,iterations:p.length,totalTime:g,avgTime:y,minTime:b,maxTime:k,medianTime:x,opsPerSecond:1e3/y},r.benchmarks.set(t,T),c.info('โœ… Benchmark "'.concat(t,'" completed: ').concat(T.opsPerSecond.toFixed(2)," ops/sec")),e.a(2,T)}},e)})),function(e,r){return t.apply(this,arguments)}),compare:function(e){var t=e.map(function(e){return r.benchmarks.get(e)}).filter(Boolean);if(t.length<2)throw new Error("Need at least 2 benchmarks to compare");var n=t.reduce(function(e,t){return e.opsPerSecond>t.opsPerSecond?e:t}),o=t.map(function(e){return{name:e.name,opsPerSecond:e.opsPerSecond,relativeSpeed:e.opsPerSecond/n.opsPerSecond,slower:n.opsPerSecond/e.opsPerSecond}});return{fastest:n.name,comparison:o}}}),this.testSuites=new Map,this.testResults=[],this.mockData=new Map,this.assertions=new Map,this.benchmarks=new Map,this.setupDefaultAssertions()},[{key:"setupDefaultAssertions",value:function(){this.addAssertion("equals",function(e,t,r){if(e!==t)throw new Error(r||"Expected ".concat(t,", got ").concat(e))}),this.addAssertion("notEquals",function(e,t,r){if(e===t)throw new Error(r||"Expected not ".concat(t,", got ").concat(e))}),this.addAssertion("deepEquals",function(e,t,r){if(JSON.stringify(e)!==JSON.stringify(t))throw new Error(r||"Deep equality failed")}),this.addAssertion("true",function(e,t){if(!0!==e)throw new Error(t||"Expected true, got ".concat(e))}),this.addAssertion("false",function(e,t){if(!1!==e)throw new Error(t||"Expected false, got ".concat(e))}),this.addAssertion("truthy",function(e,t){if(!e)throw new Error(t||"Expected truthy value, got ".concat(e))}),this.addAssertion("falsy",function(e,t){if(e)throw new Error(t||"Expected falsy value, got ".concat(e))}),this.addAssertion("null",function(e,t){if(null!==e)throw new Error(t||"Expected null, got ".concat(e))}),this.addAssertion("undefined",function(e,t){if(void 0!==e)throw new Error(t||"Expected undefined, got ".concat(e))}),this.addAssertion("defined",function(e,t){if(void 0===e)throw new Error(t||"Expected defined value, got undefined")}),this.addAssertion("instanceOf",function(e,r,n){if(!(e instanceof r))throw new Error(n||"Expected instance of ".concat(r.name,", got ").concat(t(e)))}),this.addAssertion("typeof",function(e,r,n){if(t(e)!==r)throw new Error(n||"Expected type ".concat(r,", got ").concat(t(e)))}),this.addAssertion("greaterThan",function(e,t,r){if(e<=t)throw new Error(r||"Expected ".concat(e," > ").concat(t))}),this.addAssertion("lessThan",function(e,t,r){if(e>=t)throw new Error(r||"Expected ".concat(e," < ").concat(t))}),this.addAssertion("greaterThanOrEqual",function(e,t,r){if(e<t)throw new Error(r||"Expected ".concat(e," >= ").concat(t))}),this.addAssertion("lessThanOrEqual",function(e,t,r){if(e>t)throw new Error(r||"Expected ".concat(e," <= ").concat(t))}),this.addAssertion("approximately",function(e,t,r,n){if(Math.abs(e-t)>r)throw new Error(n||"Expected ".concat(e," โ‰ˆ ").concat(t," (ยฑ").concat(r,")"))}),this.addAssertion("includes",function(e,t,r){if(!e.includes(t))throw new Error(r||'Expected "'.concat(e,'" to include "').concat(t,'"'))}),this.addAssertion("startsWith",function(e,t,r){if(!e.startsWith(t))throw new Error(r||'Expected "'.concat(e,'" to start with "').concat(t,'"'))}),this.addAssertion("endsWith",function(e,t,r){if(!e.endsWith(t))throw new Error(r||'Expected "'.concat(e,'" to end with "').concat(t,'"'))}),this.addAssertion("matches",function(e,t,r){if(!t.test(e))throw new Error(r||'Expected "'.concat(e,'" to match pattern ').concat(t))}),this.addAssertion("hasLength",function(e,t,r){if(e.length!==t)throw new Error(r||"Expected length ".concat(t,", got ").concat(e.length))}),this.addAssertion("isEmpty",function(e,t){if(0!==e.length)throw new Error(t||"Expected empty array/string, got length ".concat(e.length))}),this.addAssertion("isNotEmpty",function(e,t){if(0===e.length)throw new Error(t||"Expected non-empty array/string")}),this.addAssertion("hasProperty",function(e,t,r){if(!e.hasOwnProperty(t))throw new Error(r||'Expected object to have property "'.concat(t,'"'))}),this.addAssertion("hasMethod",function(e,t,r){if("function"!=typeof e[t])throw new Error(r||'Expected object to have method "'.concat(t,'"'))}),this.addAssertion("resolves",function(){var e=a(u().m(function e(t,r){var n;return u().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t;case 1:e.n=3;break;case 2:throw e.p=2,n=e.v,new Error(r||"Expected promise to resolve, but it rejected: ".concat(n.message));case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,r){return e.apply(this,arguments)}}()),this.addAssertion("rejects",function(){var e=a(u().m(function e(t,r){return u().w(function(e){for(;;)switch(e.n){case 0:return e.p=0,e.n=1,t;case 1:throw new Error(r||"Expected promise to reject, but it resolved");case 2:e.p=2,e.v;case 3:return e.a(2)}},e,null,[[0,2]])}));return function(t,r){return e.apply(this,arguments)}}()),this.addAssertion("throws",function(e,t){try{throw e(),new Error(t||"Expected function to throw, but it didn't")}catch(e){}})}},{key:"addAssertion",value:function(e,t){this.assertions.set(e,t)}},{key:"createTestSuite",value:function(e){var t=this,r={name:e,tests:[],beforeEach:null,afterEach:null,beforeAll:null,afterAll:null,setup:arguments.length>1&&void 0!==arguments[1]?arguments[1]:null};return this.testSuites.set(e,r),{test:function(r,n){return t.addTest(e,r,n)},beforeEach:function(e){r.beforeEach=e},afterEach:function(e){r.afterEach=e},beforeAll:function(e){r.beforeAll=e},afterAll:function(e){r.afterAll=e}}}},{key:"addTest",value:function(e,t,r){var n=this.testSuites.get(e);if(!n)throw new Error('Test suite "'.concat(e,'" not found'));n.tests.push({name:t,fn:r,skip:!1,only:!1})}},{key:"runAllTests",value:(d=a(u().m(function e(){var t,o,s,i,a,f,h,d;return u().w(function(e){for(;;)switch(e.n){case 0:c.info("๐Ÿงช Running all test suites..."),t=performance.now(),o={suites:[],totalTests:0,passedTests:0,failedTests:0,skippedTests:0,duration:0},s=r(this.testSuites),e.p=1,s.s();case 2:if((i=s.n()).done){e.n=5;break}return a=n(i.value,2),f=a[0],a[1],e.n=3,this.runTestSuite(f);case 3:h=e.v,o.suites.push(h),o.totalTests+=h.totalTests,o.passedTests+=h.passedTests,o.failedTests+=h.failedTests,o.skippedTests+=h.skippedTests;case 4:e.n=2;break;case 5:e.n=7;break;case 6:e.p=6,d=e.v,s.e(d);case 7:return e.p=7,s.f(),e.f(7);case 8:return o.duration=performance.now()-t,c.info("โœ… All tests completed: ".concat(o.passedTests,"/").concat(o.totalTests," passed in ").concat(o.duration.toFixed(2),"ms")),this.testResults.push(o),e.a(2,o)}},e,this,[[1,6,7,8]])})),function(){return d.apply(this,arguments)})},{key:"runTestSuite",value:(h=a(u().m(function e(t){var n,o,s,i,a,f,h,d,l;return u().w(function(e){for(;;)switch(e.n){case 0:if(n=this.testSuites.get(t)){e.n=1;break}throw new Error('Test suite "'.concat(t,'" not found'));case 1:if(c.info("๐Ÿงช Running test suite: ".concat(t)),o=performance.now(),s={name:t,tests:[],totalTests:n.tests.length,passedTests:0,failedTests:0,skippedTests:0,duration:0},e.p=2,!n.setup){e.n=3;break}return e.n=3,n.setup();case 3:if(!n.beforeAll){e.n=4;break}return e.n=4,n.beforeAll();case 4:i=r(n.tests),e.p=5,i.s();case 6:if((a=i.n()).done){e.n=9;break}return f=a.value,e.n=7,this.runTest(n,f);case 7:h=e.v,s.tests.push(h),"passed"===h.status?s.passedTests++:"failed"===h.status?s.failedTests++:"skipped"===h.status&&s.skippedTests++;case 8:e.n=6;break;case 9:e.n=11;break;case 10:e.p=10,d=e.v,i.e(d);case 11:return e.p=11,i.f(),e.f(11);case 12:if(!n.afterAll){e.n=13;break}return e.n=13,n.afterAll();case 13:e.n=15;break;case 14:e.p=14,l=e.v,c.error('โŒ Test suite "'.concat(t,'" setup failed:'),l);case 15:return s.duration=performance.now()-o,c.info('โœ… Suite "'.concat(t,'" completed: ').concat(s.passedTests,"/").concat(s.totalTests," passed")),e.a(2,s)}},e,this,[[5,10,11,12],[2,14]])})),function(e){return h.apply(this,arguments)})},{key:"runTest",value:(f=a(u().m(function e(t,r){var n,o,s,i;return u().w(function(e){for(;;)switch(e.n){case 0:if(!r.skip){e.n=1;break}return e.a(2,{name:r.name,status:"skipped",duration:0,error:null});case 1:if(n=performance.now(),o={name:r.name,status:"passed",duration:0,error:null},e.p=2,!t.beforeEach){e.n=3;break}return e.n=3,t.beforeEach();case 3:return s=this.createAssertionContext(),e.n=4,r.fn(s);case 4:if(!t.afterEach){e.n=5;break}return e.n=5,t.afterEach();case 5:e.n=7;break;case 6:e.p=6,i=e.v,o.status="failed",o.error={message:i.message,stack:i.stack},c.error('โŒ Test "'.concat(r.name,'" failed:'),i.message);case 7:return o.duration=performance.now()-n,e.a(2,o)}},e,this,[[2,6]])})),function(e,t){return f.apply(this,arguments)})},{key:"createAssertionContext",value:function(){var e,t={},o=r(this.assertions);try{for(o.s();!(e=o.n()).done;){var s=n(e.value,2),i=s[0],a=s[1];t[i]=a}}catch(e){o.e(e)}finally{o.f()}return t}},{key:"generateReport",value:function(e){var t=(e.passedTests/e.totalTests*100).toFixed(1),r='\n<!DOCTYPE html>\n<html>\n<head>\n <title>Test Report</title>\n <style>\n body { font-family: Arial, sans-serif; margin: 20px; }\n .summary { background: #f5f5f5; padding: 15px; border-radius: 5px; margin-bottom: 20px; }\n .suite { margin-bottom: 20px; border: 1px solid #ddd; border-radius: 5px; }\n .suite-header { background: #e9e9e9; padding: 10px; font-weight: bold; }\n .test { padding: 10px; border-bottom: 1px solid #eee; }\n .test:last-child { border-bottom: none; }\n .passed { color: green; }\n .failed { color: red; }\n .skipped { color: orange; }\n .error { background: #ffe6e6; padding: 10px; margin-top: 5px; border-radius: 3px; }\n </style>\n</head>\n<body>\n <h1>Test Report</h1>\n \n <div class="summary">\n <h2>Summary</h2>\n <p><strong>Total Tests:</strong> '.concat(e.totalTests,'</p>\n <p><strong>Passed:</strong> <span class="passed">').concat(e.passedTests,'</span></p>\n <p><strong>Failed:</strong> <span class="failed">').concat(e.failedTests,'</span></p>\n <p><strong>Skipped:</strong> <span class="skipped">').concat(e.skippedTests,"</span></p>\n <p><strong>Pass Rate:</strong> ").concat(t,"%</p>\n <p><strong>Duration:</strong> ").concat(e.duration.toFixed(2),"ms</p>\n </div>\n \n <h2>Test Suites</h2>\n");return e.suites.forEach(function(e){r+='\n <div class="suite">\n <div class="suite-header">\n '.concat(e.name," (").concat(e.passedTests,"/").concat(e.totalTests," passed)\n </div>\n"),e.tests.forEach(function(e){r+='\n <div class="test">\n <span class="'.concat(e.status,'">').concat(e.status.toUpperCase(),"</span>\n <strong>").concat(e.name,"</strong>\n <small>(").concat(e.duration.toFixed(2),"ms)</small>\n"),e.error&&(r+='\n <div class="error">\n <strong>Error:</strong> '.concat(e.error.message,"\n </div>\n")),r+=" </div>"}),r+=" </div>"}),r+="\n</body>\n</html>\n"}},{key:"clearResults",value:function(){this.testResults=[]}},{key:"getResults",value:function(){return this.testResults}},{key:"getBenchmarks",value:function(){return this.benchmarks}},{key:"dispose",value:function(){this.testSuites.clear(),this.clearResults(),this.mockData.clear(),this.benchmarks.clear(),c.info("Testing disposed")}}]);var f,h,d}();export{f as Testing};
@@ -0,0 +1 @@
1
+ import{createClass as e,objectSpread2 as t,typeof as n,classCallCheck as i}from"../../_virtual/_rollupPluginBabelHelpers.js";import{createTransformControls as a}from"../managers/controls/transformControlsManager.js";import{HotReloadManager as o}from"../managers/system/hotReloadManager.js";import{DisposalManager as s}from"../managers/system/disposalManager.js";import{SceneExportManager as r}from"../managers/scene/sceneExportManager.js";import{ComponentManager as l}from"../managers/components/componentManager.js";import{SceneInitializationManager as u}from"../managers/scene/sceneInitializationManager.js";import{EnvironmentManager as c}from"../managers/environment/environmentManager.js";import{KeyboardControlsManager as h}from"../managers/controls/keyboardControlsManager.js";import{PathfindingManager as m}from"../managers/components/pathfindingManager.js";import{SceneOperationsManager as d}from"../managers/scene/sceneOperationsManager.js";import{AnimationManager as f}from"../managers/components/animationManager.js";import{CameraControlsManager as v}from"../managers/controls/cameraControlsManager.js";import{SceneTooltipsManager as p}from"../managers/scene/sceneTooltipsManager.js";import{generateUuidFromName as g,getHardcodedUuid as y}from"./nameUtils.js";import{logger as k,transformLogger as w,pathfinderLogger as M,modelLogger as S}from"./debugLogger.js";import j from"../rendering/modelPreloader.js";import b from"../managers/controls/dragDropManager.js";import{SceneHelper as C}from"../helpers/sceneHelper.js";var D=function(){return e(function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;i(this,e),this.sceneViewer=t,this.managers={},this.utilities={},this.isInitialized=!1,this.importedSceneData=null,this.metadata={},this.transformHistory={lastTransform:null},this.setDefaultSceneMetadata(),this.initializeUtilities(),t&&(this.initializeManagers(),this.isInitialized=!0)},[{key:"setSceneViewer",value:function(e){this.sceneViewer=e,!this.isInitialized&&e&&(this.initializeManagers(),this.isInitialized=!0)}},{key:"initializeManagers",value:function(){this.sceneViewer&&(this.managers.hotReloadManager=new o(this.sceneViewer),this.managers.disposalManager=new s(this.sceneViewer),this.managers.sceneExportManager=new r(this.sceneViewer),this.managers.componentManager=new l(this.sceneViewer),this.managers.sceneInitializationManager=new u(this.sceneViewer),this.managers.environmentManager=new c(this.sceneViewer),this.managers.keyboardControlsManager=new h(this.sceneViewer),this.managers.pathfindingManager=new m(this.sceneViewer),this.managers.sceneOperationsManager=new d(this.sceneViewer),this.managers.animationManager=new f(this.sceneViewer),this.managers.cameraControlsManager=new v(this.sceneViewer))}},{key:"initializeUtilities",value:function(){this.utilities.createTransformControls=a,this.utilities.generateUuidFromName=g,this.utilities.getHardcodedUuid=y,this.utilities.logger=k,this.utilities.transformLogger=w,this.utilities.pathfinderLogger=M,this.utilities.modelLogger=S,this.utilities.modelPreloader=j,this.utilities.SceneHelper=C,this.utilities.DragDropManager=b}},{key:"attachToComponent",value:function(){var e=this;this.sceneViewer&&(this.isInitialized||this.initializeManagers(),Object.keys(this.managers).forEach(function(t){e.sceneViewer[t]=e.managers[t]}),Object.keys(this.utilities).forEach(function(t){e.sceneViewer[t]=e.utilities[t]}))}},{key:"initializePostSceneManagers",value:function(){this.sceneViewer.$refs.container&&this.sceneViewer.camera&&this.sceneViewer.scene&&(this.managers.tooltipsManager=new p(this.sceneViewer.$refs.container,this.sceneViewer.camera,this.sceneViewer.scene),this.sceneViewer.tooltipsManager=this.managers.tooltipsManager),this.sceneViewer.scene&&this.sceneViewer.camera&&(this.managers.dragDropManager=new b({scene:this.sceneViewer.scene,camera:this.sceneViewer.camera,transformManager:this.sceneViewer.transformManager,modelPreloader:this.utilities.modelPreloader,componentManager:this.sceneViewer.componentManager}),this.sceneViewer.dragDropManager=this.managers.dragDropManager),this.sceneViewer.scene&&this.sceneViewer.camera&&this.sceneViewer.renderer&&(this.utilities.sceneHelper=new C({scene:this.sceneViewer.scene,camera:this.sceneViewer.camera,renderer:this.sceneViewer.renderer,controls:this.sceneViewer.controls,transformManager:this.sceneViewer.transformManager,componentManager:this.sceneViewer.componentManager,pathfindingManager:this.sceneViewer.pathfindingManager,currentSceneData:this.sceneViewer.currentSceneData,logger:this.utilities.logger}),this.sceneViewer.sceneHelper=this.utilities.sceneHelper)}},{key:"updateSceneHelperData",value:function(e){this.utilities.sceneHelper&&"function"==typeof this.utilities.sceneHelper.updateSceneData&&this.utilities.sceneHelper.updateSceneData(e)}},{key:"setImportedSceneData",value:function(e){this.importedSceneData=t({},e),this.setDefaultImportedSceneMetadata(e),this.utilities.sceneHelper&&"function"==typeof this.utilities.sceneHelper.updateSceneData&&this.utilities.sceneHelper.updateSceneData(e)}},{key:"getImportedSceneData",value:function(){return this.importedSceneData}},{key:"getImportedConnections",value:function(){var e;return(null===(e=this.importedSceneData)||void 0===e?void 0:e.connections)||[]}},{key:"getImportedSceneObjects",value:function(){var e;return(null===(e=this.importedSceneData)||void 0===e||null===(e=e.scene)||void 0===e?void 0:e.object)||null}},{key:"clearImportedSceneData",value:function(){this.importedSceneData=null}},{key:"setMetadata",value:function(e,t){this.metadata[e]=t}},{key:"getMetadata",value:function(e){return this.metadata[e]}},{key:"getAllMetadata",value:function(){return t({},this.metadata)}},{key:"removeMetadata",value:function(e){delete this.metadata[e]}},{key:"clearAllMetadata",value:function(){this.metadata={}}},{key:"clearAllData",value:function(){this.metadata={},this.transformHistory.lastTransform=null}},{key:"recordTransform",value:function(e){var t,n;if(e&&e.object){e.previousValues;var i={type:e.type,object:e.object,values:e.values,previousValues:e.previousValues,timestamp:(new Date).toISOString(),objectId:(null===(t=e.object)||void 0===t?void 0:t.uuid)||(null===(n=e.object)||void 0===n?void 0:n.id)||"unknown"};this.transformHistory.lastTransform=i}}},{key:"getLastTransform",value:function(){return this.transformHistory.lastTransform}},{key:"getTransformHistory",value:function(){return t({},this.transformHistory)}},{key:"clearTransformHistory",value:function(){this.transformHistory.lastTransform=null}},{key:"hasMetadata",value:function(e){return e in this.metadata}},{key:"setDefaultSceneMetadata",value:function(){var e=this,t={sceneInfo:{name:"Untitled Central Plant Scene",description:"A central plant facility scene",version:"1.0.0",created:(new Date).toISOString(),lastModified:(new Date).toISOString(),author:"Engineering Team"},projectSettings:{units:"metric",scale:1,gridSize:1,snapToGrid:!0,showGrid:!0,showAxes:!0},viewportSettings:{defaultViewMode:"perspective",backgroundType:"skybox",showEnvironment:!0,autoRotate:!1,cameraPosition:{x:10,y:10,z:10},cameraTarget:{x:0,y:0,z:0}},componentSettings:{defaultComponentScale:1,showBoundingBoxes:!1,showConnectionPaths:!0,highlightOnHover:!0,selectionOutlineColor:"#00ff00"},spatialBoundaries:{min:{x:-60,y:-16,z:-60},max:{x:60,y:16,z:60},center:{x:0,y:4,z:0}},systemInfo:{centralPlantVersion:"2.0.0",buildDate:(new Date).toISOString(),platform:"undefined"!=typeof window?window.navigator.platform:"Unknown",userAgent:"undefined"!=typeof window?window.navigator.userAgent:"Unknown"}};Object.keys(t).forEach(function(n){e.hasMetadata(n)||e.setMetadata(n,t[n])})}},{key:"setDefaultImportedSceneMetadata",value:function(e){var n,i,a,o=(new Date).toISOString(),s=(null===(n=e.connections)||void 0===n?void 0:n.length)||0,r=(null===(i=e.scene)||void 0===i||null===(i=i.object)||void 0===i||null===(i=i.children)||void 0===i?void 0:i.length)||0,l={};null!==(a=e.scene)&&void 0!==a&&null!==(a=a.object)&&void 0!==a&&a.children&&e.scene.object.children.forEach(function(e){var t,n=(null===(t=e.userData)||void 0===t?void 0:t.componentType)||"unknown";l[n]=(l[n]||0)+1});var u={importInfo:{importTimestamp:o,originalFileName:null,fileSize:null,importMethod:"file-upload",importVersion:"1.0.0"},sceneAnalysis:{totalComponents:r,totalConnections:s,componentTypes:l,sceneComplexity:this.calculateSceneComplexity(s,r),hasValidStructure:this.validateImportedSceneStructure(e)},dataQuality:{hasConnections:s>0,hasComponents:r>0,hasValidScene:!!e.scene,missingData:this.identifyMissingData(e),warnings:this.generateImportWarnings(e)},processingStats:{processedAt:o,processingDuration:null,memoryUsage:this.estimateMemoryUsage(e),cacheStatus:"pending"}};if(this.setMetadata("lastImport",u),this.hasMetadata("sceneInfo")){var c=this.getMetadata("sceneInfo");this.setMetadata("sceneInfo",t(t({},c),{},{lastModified:o,importSource:"file-import",dataSourceType:"json"}))}}},{key:"calculateSceneComplexity",value:function(e,t){var n=e+t;return n<=10?"simple":n<=50?"moderate":n<=200?"complex":"very-complex"}},{key:"validateImportedSceneStructure",value:function(e){return!!(e&&e.scene&&e.scene.object&&Array.isArray(e.connections))}},{key:"identifyMissingData",value:function(e){var t,n=[];return e.connections&&0!==e.connections.length||n.push("No connection data found"),null!==(t=e.scene)&&void 0!==t&&null!==(t=t.object)&&void 0!==t&&t.children&&0!==e.scene.object.children.length||n.push("No component data found"),e.metadata||n.push("No metadata found"),e.version||n.push("No version information"),n}},{key:"generateImportWarnings",value:function(e){var t,n,i=[],a=(null===(t=e.scene)||void 0===t||null===(t=t.object)||void 0===t||null===(t=t.children)||void 0===t?void 0:t.length)||0;a>100&&i.push("Large scene detected (".concat(a," components) - may impact performance"));var o=(null===(n=e.connections)||void 0===n?void 0:n.length)||0;return a>0&&0===o&&i.push("Components found but no connections - scene may be incomplete"),e.version&&parseFloat(e.version)<1&&i.push("Scene data version is older than current - some features may not work correctly"),i}},{key:"estimateMemoryUsage",value:function(e){var t=JSON.stringify(e).length,n=(t/1024/1024).toFixed(2);return{jsonSizeBytes:t,estimatedMB:parseFloat(n),category:n<1?"small":n<10?"medium":"large"}}},{key:"updateMetadataCategory",value:function(e,n){if(this.hasMetadata(e)){var i=this.getMetadata(e);this.setMetadata(e,t(t({},i),n))}else this.setMetadata(e,n)}},{key:"undoTransform",value:function(){var e=this.getLastTransform();if(!e)return!1;try{var t,n=e.object,i=e.type,a=e.previousValues;if(!n||!a)return!1;if(this.debugTransformState(n,"Before Undo"),this.sceneViewer&&this.sceneViewer.scene){var o=!1;if(this.sceneViewer.scene.traverse(function(e){e===n&&(o=!0)}),!o)return!1}switch(i){case"translate":case"position":a.position?(void 0!==a.position.x&&(n.position.x=a.position.x),void 0!==a.position.y&&(n.position.y=a.position.y),void 0!==a.position.z&&(n.position.z=a.position.z)):(void 0!==a.x&&(n.position.x=a.x),void 0!==a.y&&(n.position.y=a.y),void 0!==a.z&&(n.position.z=a.z));break;case"rotate":case"rotation":a.rotation?(void 0!==a.rotation.x&&(n.rotation.x=a.rotation.x),void 0!==a.rotation.y&&(n.rotation.y=a.rotation.y),void 0!==a.rotation.z&&(n.rotation.z=a.rotation.z)):(void 0!==a.x&&(n.rotation.x=a.x),void 0!==a.y&&(n.rotation.y=a.y),void 0!==a.z&&(n.rotation.z=a.z));break;case"scale":a.scale?(void 0!==a.scale.x&&(n.scale.x=a.scale.x),void 0!==a.scale.y&&(n.scale.y=a.scale.y),void 0!==a.scale.z&&(n.scale.z=a.scale.z)):(void 0!==a.x&&(n.scale.x=a.x),void 0!==a.y&&(n.scale.y=a.y),void 0!==a.z&&(n.scale.z=a.z));break;default:return!1}n.updateMatrix(),n.updateMatrixWorld(!0);var s=null===(t=this.sceneViewer)||void 0===t?void 0:t.transformManager;if(s&&s.transformControls){var r=s.transformControls;r.object===n&&(r.detach(),s.ensureSceneAttachment&&s.ensureSceneAttachment(!0),r.attach(n),s.selectedObject=n,s.updateBoundingBox&&s.updateBoundingBox(),s.boundingBoxCache&&s.boundingBoxCache.has(n)&&s.boundingBoxCache.delete(n))}if(this.sceneViewer&&this.sceneViewer.sceneOperationsManager&&this.sceneViewer.currentSceneData)try{this.sceneViewer.onTransformEnd(n)}catch(e){}if("undefined"!=typeof window){var l=new CustomEvent("sceneUpdateComplete",{detail:{timestamp:Date.now(),action:"undo-transform",objectId:n.uuid||n.id||"unknown"}});window.dispatchEvent(l)}return this.clearTransformHistory(),this.ensureObjectSelectable(n),this.debugTransformState(n,"After Undo"),!0}catch(e){return!1}}},{key:"ensureObjectSelectable",value:function(e){if(!e||!this.sceneViewer)return!1;try{var t=this.sceneViewer.transformManager;return!!t&&(t.recoverTransformControls?t.recoverTransformControls(e):(e.updateMatrixWorld(!0),t.boundingBoxCache&&t.boundingBoxCache.has(e)&&t.boundingBoxCache.delete(e),t.ensureSceneAttachment&&t.ensureSceneAttachment(!0),t.selectedObject===e&&(t.deselectObject(),requestAnimationFrame(function(){t.selectObjectForTransformOnly(e)})),!0))}catch(e){return!1}}},{key:"debugTransformState",value:function(e){}},{key:"fixTransformControlsSelection",value:function(){if(!this.sceneViewer||!this.sceneViewer.transformManager)return!1;var e=this.sceneViewer.transformManager;if(e.recoverTransformControls&&e.recoverTransformControls())return!0;try{var t=e.currentMode,n=e.currentSpace;return e.transformControls&&(e.transformControls.detach(),e.scene.remove(e.transformControls),e.transformControls.dispose(),e.transformControls=null),e.createTransformControls(),e.setupEventListeners(),e.setMode(t),e.setSpace(n),!0}catch(e){return!1}}},{key:"isObjectInScene",value:function(e){if(!this.sceneViewer||!this.sceneViewer.scene)return!1;var t=!1;return this.sceneViewer.scene.traverse(function(n){n===e&&(t=!0)}),t}}])}();export{D as CentralPlant,D as default};