@mlightcad/common 1.0.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/LICENSE +21 -0
- package/dist/common.js +1226 -0
- package/dist/common.umd.cjs +1 -0
- package/lib/AcCmColor.d.ts +42 -0
- package/lib/AcCmColor.d.ts.map +1 -0
- package/lib/AcCmColor.js +456 -0
- package/lib/AcCmColor.js.map +1 -0
- package/lib/AcCmColorUtil.d.ts +9 -0
- package/lib/AcCmColorUtil.d.ts.map +1 -0
- package/lib/AcCmColorUtil.js +54 -0
- package/lib/AcCmColorUtil.js.map +1 -0
- package/lib/AcCmErrors.d.ts +23 -0
- package/lib/AcCmErrors.d.ts.map +1 -0
- package/lib/AcCmErrors.js +37 -0
- package/lib/AcCmErrors.js.map +1 -0
- package/lib/AcCmEventDispatcher.d.ts +48 -0
- package/lib/AcCmEventDispatcher.d.ts.map +1 -0
- package/lib/AcCmEventDispatcher.js +60 -0
- package/lib/AcCmEventDispatcher.js.map +1 -0
- package/lib/AcCmEventManager.d.ts +27 -0
- package/lib/AcCmEventManager.d.ts.map +1 -0
- package/lib/AcCmEventManager.js +94 -0
- package/lib/AcCmEventManager.js.map +1 -0
- package/lib/AcCmLogUtil.d.ts +31 -0
- package/lib/AcCmLogUtil.d.ts.map +1 -0
- package/lib/AcCmLogUtil.js +23 -0
- package/lib/AcCmLogUtil.js.map +1 -0
- package/lib/AcCmObject.d.ts +96 -0
- package/lib/AcCmObject.d.ts.map +1 -0
- package/lib/AcCmObject.js +175 -0
- package/lib/AcCmObject.js.map +1 -0
- package/lib/AcCmPerformanceCollector.d.ts +68 -0
- package/lib/AcCmPerformanceCollector.d.ts.map +1 -0
- package/lib/AcCmPerformanceCollector.js +110 -0
- package/lib/AcCmPerformanceCollector.js.map +1 -0
- package/lib/AcCmStringUtil.d.ts +11 -0
- package/lib/AcCmStringUtil.d.ts.map +1 -0
- package/lib/AcCmStringUtil.js +25 -0
- package/lib/AcCmStringUtil.js.map +1 -0
- package/lib/AcCmTaskScheduler.d.ts +70 -0
- package/lib/AcCmTaskScheduler.d.ts.map +1 -0
- package/lib/AcCmTaskScheduler.js +173 -0
- package/lib/AcCmTaskScheduler.js.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/loader/AcCmFileLoader.d.ts +58 -0
- package/lib/loader/AcCmFileLoader.d.ts.map +1 -0
- package/lib/loader/AcCmFileLoader.js +225 -0
- package/lib/loader/AcCmFileLoader.js.map +1 -0
- package/lib/loader/AcCmLoader.d.ts +92 -0
- package/lib/loader/AcCmLoader.d.ts.map +1 -0
- package/lib/loader/AcCmLoader.js +88 -0
- package/lib/loader/AcCmLoader.js.map +1 -0
- package/lib/loader/AcCmLoadingManager.d.ts +119 -0
- package/lib/loader/AcCmLoadingManager.d.ts.map +1 -0
- package/lib/loader/AcCmLoadingManager.js +133 -0
- package/lib/loader/AcCmLoadingManager.js.map +1 -0
- package/lib/loader/index.d.ts +3 -0
- package/lib/loader/index.d.ts.map +1 -0
- package/lib/loader/index.js +3 -0
- package/lib/loader/index.js.map +1 -0
- package/package.json +44 -0
package/dist/common.js
ADDED
|
@@ -0,0 +1,1226 @@
|
|
|
1
|
+
import { defaults as H, clone as I, isEqual as T, isEmpty as z, has as K } from "lodash-es";
|
|
2
|
+
function W(h, e) {
|
|
3
|
+
for (var t = 0; t < e.length; t++) {
|
|
4
|
+
const r = e[t];
|
|
5
|
+
if (typeof r != "string" && !Array.isArray(r)) {
|
|
6
|
+
for (const o in r)
|
|
7
|
+
if (o !== "default" && !(o in h)) {
|
|
8
|
+
const s = Object.getOwnPropertyDescriptor(r, o);
|
|
9
|
+
s && Object.defineProperty(h, o, s.get ? s : {
|
|
10
|
+
enumerable: !0,
|
|
11
|
+
get: () => r[o]
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return Object.freeze(Object.defineProperty(h, Symbol.toStringTag, { value: "Module" }));
|
|
17
|
+
}
|
|
18
|
+
const k = {
|
|
19
|
+
aliceblue: 15792383,
|
|
20
|
+
antiquewhite: 16444375,
|
|
21
|
+
aqua: 65535,
|
|
22
|
+
aquamarine: 8388564,
|
|
23
|
+
azure: 15794175,
|
|
24
|
+
beige: 16119260,
|
|
25
|
+
bisque: 16770244,
|
|
26
|
+
black: 0,
|
|
27
|
+
blanchedalmond: 16772045,
|
|
28
|
+
blue: 255,
|
|
29
|
+
blueviolet: 9055202,
|
|
30
|
+
brown: 10824234,
|
|
31
|
+
burlywood: 14596231,
|
|
32
|
+
cadetblue: 6266528,
|
|
33
|
+
chartreuse: 8388352,
|
|
34
|
+
chocolate: 13789470,
|
|
35
|
+
coral: 16744272,
|
|
36
|
+
cornflowerblue: 6591981,
|
|
37
|
+
cornsilk: 16775388,
|
|
38
|
+
crimson: 14423100,
|
|
39
|
+
cyan: 65535,
|
|
40
|
+
darkblue: 139,
|
|
41
|
+
darkcyan: 35723,
|
|
42
|
+
darkgoldenrod: 12092939,
|
|
43
|
+
darkgray: 11119017,
|
|
44
|
+
darkgreen: 25600,
|
|
45
|
+
darkkhaki: 12433259,
|
|
46
|
+
darkmagenta: 9109643,
|
|
47
|
+
darkolivegreen: 5597999,
|
|
48
|
+
darkorange: 16747520,
|
|
49
|
+
darkorchid: 10040012,
|
|
50
|
+
darkred: 9109504,
|
|
51
|
+
darksalmon: 15308410,
|
|
52
|
+
darkseagreen: 9419919,
|
|
53
|
+
darkslateblue: 4734347,
|
|
54
|
+
darkslategray: 3100495,
|
|
55
|
+
darkturquoise: 52945,
|
|
56
|
+
darkviolet: 9699539,
|
|
57
|
+
deeppink: 16716947,
|
|
58
|
+
deepskyblue: 49151,
|
|
59
|
+
dimgrey: 6908265,
|
|
60
|
+
dodgerblue: 2003199,
|
|
61
|
+
firebrick: 11674146,
|
|
62
|
+
floralwhite: 16775920,
|
|
63
|
+
forestgreen: 2263842,
|
|
64
|
+
fuchsia: 16711935,
|
|
65
|
+
gainsboro: 14474460,
|
|
66
|
+
ghostwhite: 16316671,
|
|
67
|
+
gold: 16766720,
|
|
68
|
+
goldenrod: 14329120,
|
|
69
|
+
gray: 8421504,
|
|
70
|
+
green: 32768,
|
|
71
|
+
greenyellow: 11403055,
|
|
72
|
+
grey: 8421504,
|
|
73
|
+
honeydew: 15794160,
|
|
74
|
+
hotpink: 16738740,
|
|
75
|
+
indianred: 13458524,
|
|
76
|
+
indigo: 4915330,
|
|
77
|
+
ivory: 16777200,
|
|
78
|
+
khaki: 15787660,
|
|
79
|
+
lavender: 15132410,
|
|
80
|
+
lavenderblush: 16773365,
|
|
81
|
+
lawngreen: 8190976,
|
|
82
|
+
lemonchiffon: 16775885,
|
|
83
|
+
lightblue: 11393254,
|
|
84
|
+
lightcoral: 15761536,
|
|
85
|
+
lightcyan: 14745599,
|
|
86
|
+
lightgoldenrodyellow: 16448210,
|
|
87
|
+
lightgray: 13882323,
|
|
88
|
+
lightgreen: 9498256,
|
|
89
|
+
lightgrey: 13882323,
|
|
90
|
+
lightpink: 16758465,
|
|
91
|
+
lightsalmon: 16752762,
|
|
92
|
+
lightseagreen: 2142890,
|
|
93
|
+
lightskyblue: 8900346,
|
|
94
|
+
lightslategray: 7833753,
|
|
95
|
+
lightslategrey: 7833753,
|
|
96
|
+
lightsteelblue: 11584734,
|
|
97
|
+
lightyellow: 16777184,
|
|
98
|
+
lime: 65280,
|
|
99
|
+
limegreen: 3329330,
|
|
100
|
+
linen: 16445670,
|
|
101
|
+
magenta: 16711935,
|
|
102
|
+
maroon: 8388608,
|
|
103
|
+
mediumaquamarine: 6737322,
|
|
104
|
+
mediumblue: 205,
|
|
105
|
+
mediumorchid: 12211667,
|
|
106
|
+
mediumpurple: 9662683,
|
|
107
|
+
mediumseagreen: 3978097,
|
|
108
|
+
mediumslateblue: 8087790,
|
|
109
|
+
mediumspringgreen: 64154,
|
|
110
|
+
mediumturquoise: 4772300,
|
|
111
|
+
mediumvioletred: 13047173,
|
|
112
|
+
midnightblue: 1644912,
|
|
113
|
+
mintcream: 16121850,
|
|
114
|
+
mistyrose: 16770273,
|
|
115
|
+
moccasin: 16770229,
|
|
116
|
+
navajowhite: 16768685,
|
|
117
|
+
navy: 128,
|
|
118
|
+
oldlace: 16643558,
|
|
119
|
+
olive: 8421376,
|
|
120
|
+
olivedrab: 7048739,
|
|
121
|
+
orange: 16753920,
|
|
122
|
+
orangered: 16729344,
|
|
123
|
+
orchid: 14315734,
|
|
124
|
+
palegoldenrod: 15657130,
|
|
125
|
+
palegreen: 10025880,
|
|
126
|
+
paleturquoise: 11529966,
|
|
127
|
+
palevioletred: 14381203,
|
|
128
|
+
papayawhip: 16773077,
|
|
129
|
+
peachpuff: 16767673,
|
|
130
|
+
peru: 13468991,
|
|
131
|
+
pink: 16761035,
|
|
132
|
+
plum: 14524637,
|
|
133
|
+
powderblue: 11591910,
|
|
134
|
+
purple: 8388736,
|
|
135
|
+
rebeccapurple: 6697881,
|
|
136
|
+
red: 16711680,
|
|
137
|
+
rosybrown: 12357519,
|
|
138
|
+
royalblue: 4286945,
|
|
139
|
+
saddlebrown: 9127187,
|
|
140
|
+
salmon: 16416882,
|
|
141
|
+
sandybrown: 16032864,
|
|
142
|
+
seagreen: 3050327,
|
|
143
|
+
seashell: 16774638,
|
|
144
|
+
sienna: 10506797,
|
|
145
|
+
silver: 12632256,
|
|
146
|
+
skyblue: 8900331,
|
|
147
|
+
slateblue: 6970061,
|
|
148
|
+
slategrey: 7372944,
|
|
149
|
+
snow: 16775930,
|
|
150
|
+
springgreen: 65407,
|
|
151
|
+
steelblue: 4620980,
|
|
152
|
+
tan: 13808780,
|
|
153
|
+
teal: 32896,
|
|
154
|
+
thistle: 14204888,
|
|
155
|
+
tomato: 16737095,
|
|
156
|
+
turquoise: 4251856,
|
|
157
|
+
violet: 15631086,
|
|
158
|
+
wheat: 16113331,
|
|
159
|
+
white: 16777215,
|
|
160
|
+
whitesmoke: 16119285,
|
|
161
|
+
yellow: 16776960,
|
|
162
|
+
yellowgreen: 10145074
|
|
163
|
+
}, O = [
|
|
164
|
+
0,
|
|
165
|
+
16711680,
|
|
166
|
+
16776960,
|
|
167
|
+
65280,
|
|
168
|
+
65535,
|
|
169
|
+
255,
|
|
170
|
+
16711935,
|
|
171
|
+
16777215,
|
|
172
|
+
8421504,
|
|
173
|
+
12632256,
|
|
174
|
+
16711680,
|
|
175
|
+
16744319,
|
|
176
|
+
13369344,
|
|
177
|
+
13395558,
|
|
178
|
+
10027008,
|
|
179
|
+
10046540,
|
|
180
|
+
8323072,
|
|
181
|
+
8339263,
|
|
182
|
+
4980736,
|
|
183
|
+
4990502,
|
|
184
|
+
16727808,
|
|
185
|
+
16752511,
|
|
186
|
+
13382400,
|
|
187
|
+
13401958,
|
|
188
|
+
10036736,
|
|
189
|
+
10051404,
|
|
190
|
+
8331008,
|
|
191
|
+
8343359,
|
|
192
|
+
4985600,
|
|
193
|
+
4992806,
|
|
194
|
+
16744192,
|
|
195
|
+
16760703,
|
|
196
|
+
13395456,
|
|
197
|
+
13408614,
|
|
198
|
+
10046464,
|
|
199
|
+
10056268,
|
|
200
|
+
8339200,
|
|
201
|
+
8347455,
|
|
202
|
+
4990464,
|
|
203
|
+
4995366,
|
|
204
|
+
16760576,
|
|
205
|
+
16768895,
|
|
206
|
+
13408512,
|
|
207
|
+
13415014,
|
|
208
|
+
10056192,
|
|
209
|
+
10061132,
|
|
210
|
+
8347392,
|
|
211
|
+
8351551,
|
|
212
|
+
4995328,
|
|
213
|
+
4997670,
|
|
214
|
+
16776960,
|
|
215
|
+
16777087,
|
|
216
|
+
13421568,
|
|
217
|
+
13421670,
|
|
218
|
+
10000384,
|
|
219
|
+
10000460,
|
|
220
|
+
8355584,
|
|
221
|
+
8355647,
|
|
222
|
+
5000192,
|
|
223
|
+
5000230,
|
|
224
|
+
12582656,
|
|
225
|
+
14679935,
|
|
226
|
+
10079232,
|
|
227
|
+
11717734,
|
|
228
|
+
7510016,
|
|
229
|
+
8755276,
|
|
230
|
+
6258432,
|
|
231
|
+
7307071,
|
|
232
|
+
3755008,
|
|
233
|
+
4344870,
|
|
234
|
+
8388352,
|
|
235
|
+
12582783,
|
|
236
|
+
6736896,
|
|
237
|
+
10079334,
|
|
238
|
+
5019648,
|
|
239
|
+
7510092,
|
|
240
|
+
4161280,
|
|
241
|
+
6258495,
|
|
242
|
+
2509824,
|
|
243
|
+
3755046,
|
|
244
|
+
4194048,
|
|
245
|
+
10485631,
|
|
246
|
+
3394560,
|
|
247
|
+
8375398,
|
|
248
|
+
2529280,
|
|
249
|
+
6264908,
|
|
250
|
+
2064128,
|
|
251
|
+
5209919,
|
|
252
|
+
1264640,
|
|
253
|
+
3099686,
|
|
254
|
+
65280,
|
|
255
|
+
8388479,
|
|
256
|
+
52224,
|
|
257
|
+
6736998,
|
|
258
|
+
38912,
|
|
259
|
+
5019724,
|
|
260
|
+
32512,
|
|
261
|
+
4161343,
|
|
262
|
+
19456,
|
|
263
|
+
2509862,
|
|
264
|
+
65343,
|
|
265
|
+
8388511,
|
|
266
|
+
52275,
|
|
267
|
+
6737023,
|
|
268
|
+
38950,
|
|
269
|
+
5019743,
|
|
270
|
+
32543,
|
|
271
|
+
4161359,
|
|
272
|
+
19475,
|
|
273
|
+
2509871,
|
|
274
|
+
65407,
|
|
275
|
+
8388543,
|
|
276
|
+
52326,
|
|
277
|
+
6737049,
|
|
278
|
+
38988,
|
|
279
|
+
5019762,
|
|
280
|
+
32575,
|
|
281
|
+
4161375,
|
|
282
|
+
19494,
|
|
283
|
+
2509881,
|
|
284
|
+
65471,
|
|
285
|
+
8388575,
|
|
286
|
+
52377,
|
|
287
|
+
6737074,
|
|
288
|
+
39026,
|
|
289
|
+
5019781,
|
|
290
|
+
32607,
|
|
291
|
+
4161391,
|
|
292
|
+
19513,
|
|
293
|
+
2509890,
|
|
294
|
+
65535,
|
|
295
|
+
8388607,
|
|
296
|
+
52428,
|
|
297
|
+
6737100,
|
|
298
|
+
39064,
|
|
299
|
+
5019800,
|
|
300
|
+
32639,
|
|
301
|
+
4161407,
|
|
302
|
+
19532,
|
|
303
|
+
2509900,
|
|
304
|
+
49151,
|
|
305
|
+
8380415,
|
|
306
|
+
39372,
|
|
307
|
+
6730444,
|
|
308
|
+
29336,
|
|
309
|
+
5014936,
|
|
310
|
+
24447,
|
|
311
|
+
4157311,
|
|
312
|
+
14668,
|
|
313
|
+
2507340,
|
|
314
|
+
32767,
|
|
315
|
+
8372223,
|
|
316
|
+
26316,
|
|
317
|
+
6724044,
|
|
318
|
+
19608,
|
|
319
|
+
5010072,
|
|
320
|
+
16255,
|
|
321
|
+
4153215,
|
|
322
|
+
9804,
|
|
323
|
+
2505036,
|
|
324
|
+
16383,
|
|
325
|
+
8364031,
|
|
326
|
+
13260,
|
|
327
|
+
6717388,
|
|
328
|
+
9880,
|
|
329
|
+
5005208,
|
|
330
|
+
8063,
|
|
331
|
+
4149119,
|
|
332
|
+
4940,
|
|
333
|
+
2502476,
|
|
334
|
+
255,
|
|
335
|
+
8355839,
|
|
336
|
+
204,
|
|
337
|
+
6710988,
|
|
338
|
+
152,
|
|
339
|
+
5000344,
|
|
340
|
+
127,
|
|
341
|
+
4145023,
|
|
342
|
+
76,
|
|
343
|
+
2500172,
|
|
344
|
+
4129023,
|
|
345
|
+
10452991,
|
|
346
|
+
3342540,
|
|
347
|
+
8349388,
|
|
348
|
+
2490520,
|
|
349
|
+
6245528,
|
|
350
|
+
2031743,
|
|
351
|
+
5193599,
|
|
352
|
+
1245260,
|
|
353
|
+
3089996,
|
|
354
|
+
8323327,
|
|
355
|
+
12550143,
|
|
356
|
+
6684876,
|
|
357
|
+
10053324,
|
|
358
|
+
4980888,
|
|
359
|
+
7490712,
|
|
360
|
+
4128895,
|
|
361
|
+
6242175,
|
|
362
|
+
2490444,
|
|
363
|
+
3745356,
|
|
364
|
+
12517631,
|
|
365
|
+
14647295,
|
|
366
|
+
10027212,
|
|
367
|
+
11691724,
|
|
368
|
+
7471256,
|
|
369
|
+
8735896,
|
|
370
|
+
6226047,
|
|
371
|
+
7290751,
|
|
372
|
+
3735628,
|
|
373
|
+
4335180,
|
|
374
|
+
16711935,
|
|
375
|
+
16744447,
|
|
376
|
+
13369548,
|
|
377
|
+
13395660,
|
|
378
|
+
9961624,
|
|
379
|
+
9981080,
|
|
380
|
+
8323199,
|
|
381
|
+
8339327,
|
|
382
|
+
4980812,
|
|
383
|
+
4990540,
|
|
384
|
+
16711871,
|
|
385
|
+
16744415,
|
|
386
|
+
13369497,
|
|
387
|
+
13395634,
|
|
388
|
+
9961586,
|
|
389
|
+
9981061,
|
|
390
|
+
8323167,
|
|
391
|
+
8339311,
|
|
392
|
+
4980793,
|
|
393
|
+
4990530,
|
|
394
|
+
16711807,
|
|
395
|
+
16744383,
|
|
396
|
+
13369446,
|
|
397
|
+
13395609,
|
|
398
|
+
9961548,
|
|
399
|
+
9981042,
|
|
400
|
+
8323135,
|
|
401
|
+
8339295,
|
|
402
|
+
4980774,
|
|
403
|
+
4990521,
|
|
404
|
+
16711743,
|
|
405
|
+
16744351,
|
|
406
|
+
13369395,
|
|
407
|
+
13395583,
|
|
408
|
+
9961510,
|
|
409
|
+
9981023,
|
|
410
|
+
8323103,
|
|
411
|
+
8339279,
|
|
412
|
+
4980755,
|
|
413
|
+
4990511,
|
|
414
|
+
3355443,
|
|
415
|
+
5987163,
|
|
416
|
+
8684676,
|
|
417
|
+
11382189,
|
|
418
|
+
14079702,
|
|
419
|
+
16777215,
|
|
420
|
+
0
|
|
421
|
+
];
|
|
422
|
+
function b(h, e, t) {
|
|
423
|
+
return Math.max(e, Math.min(t, h));
|
|
424
|
+
}
|
|
425
|
+
const x = class x {
|
|
426
|
+
constructor() {
|
|
427
|
+
this._colorIndex = 256, this._color = null, this._colorName = null;
|
|
428
|
+
}
|
|
429
|
+
get color() {
|
|
430
|
+
return this._color;
|
|
431
|
+
}
|
|
432
|
+
set color(e) {
|
|
433
|
+
e == null ? this._color = null : (this._color = Math.round(b(e, 0, 256 * 256 * 256 - 1)), this._colorIndex = this.getColorIndexByValue(this._color), this._colorName = this.getColorNameByValue(this._color));
|
|
434
|
+
}
|
|
435
|
+
get hexColor() {
|
|
436
|
+
if (this._color && this._color > 0 && this._color <= 16777215) {
|
|
437
|
+
let e = this._color.toString(16).toUpperCase();
|
|
438
|
+
for (; e.length < 6; )
|
|
439
|
+
e = "0" + e;
|
|
440
|
+
return `0x${e}`;
|
|
441
|
+
}
|
|
442
|
+
return "";
|
|
443
|
+
}
|
|
444
|
+
get cssColor() {
|
|
445
|
+
return `rgb(${this.red},${this.green},${this.blue})`;
|
|
446
|
+
}
|
|
447
|
+
get red() {
|
|
448
|
+
return this.color ? this.color >> 16 & 255 : null;
|
|
449
|
+
}
|
|
450
|
+
get green() {
|
|
451
|
+
return this.color ? this.color >> 8 & 255 : null;
|
|
452
|
+
}
|
|
453
|
+
get blue() {
|
|
454
|
+
return this.color ? this.color & 255 : null;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* AutoCAD color index value. The index value will be in the range 0 to 256. 0 and 256 are special values.
|
|
458
|
+
* If value less than 0 is set, 0 will be used. If value greater than 256 is set, 256 will be used.
|
|
459
|
+
* - 0 indicates that the entity uses the color of the BlockReference that's displaying it. If the entity
|
|
460
|
+
* is not displayed through a block reference (for example, it is directly owned by the model space
|
|
461
|
+
* block table record) and its color is 0, then it will display as though its color were 7.
|
|
462
|
+
* - 256 indicates that the entity uses the color specified in the layer table record it references.
|
|
463
|
+
*/
|
|
464
|
+
get colorIndex() {
|
|
465
|
+
return this._colorIndex;
|
|
466
|
+
}
|
|
467
|
+
set colorIndex(e) {
|
|
468
|
+
e == null ? this._colorIndex = null : (this._colorIndex = b(e, 0, 256), this._color = O[e], this._colorName = this.getColorNameByValue(this._color));
|
|
469
|
+
}
|
|
470
|
+
get colorName() {
|
|
471
|
+
return this._colorName;
|
|
472
|
+
}
|
|
473
|
+
set colorName(e) {
|
|
474
|
+
if (e) {
|
|
475
|
+
const t = k[e.toLowerCase()];
|
|
476
|
+
t !== void 0 ? (this._colorName = e, this._color = t, this._colorIndex = this.getColorIndexByValue(this._color)) : console.warn("Unknown color: " + e);
|
|
477
|
+
} else
|
|
478
|
+
this._colorName = null;
|
|
479
|
+
}
|
|
480
|
+
get hasColorName() {
|
|
481
|
+
return this._colorName == null;
|
|
482
|
+
}
|
|
483
|
+
get hasColorIndex() {
|
|
484
|
+
return this._colorIndex == null;
|
|
485
|
+
}
|
|
486
|
+
get isByLayer() {
|
|
487
|
+
return this.colorIndex == 256;
|
|
488
|
+
}
|
|
489
|
+
setByLayer() {
|
|
490
|
+
return this.colorIndex = 256, this;
|
|
491
|
+
}
|
|
492
|
+
get isByBlock() {
|
|
493
|
+
return this.colorIndex == 0;
|
|
494
|
+
}
|
|
495
|
+
setByBlock() {
|
|
496
|
+
return this.colorIndex = 0, this;
|
|
497
|
+
}
|
|
498
|
+
setScalar(e) {
|
|
499
|
+
return this.setRGB(e, e, e), this;
|
|
500
|
+
}
|
|
501
|
+
setRGB(e, t, r) {
|
|
502
|
+
const o = Math.round(b(e, 0, 255)), s = Math.round(b(t, 0, 255)), i = Math.round(b(r, 0, 255));
|
|
503
|
+
return this.color = (o << 16) + (s << 8) + i, this;
|
|
504
|
+
}
|
|
505
|
+
setColorName(e) {
|
|
506
|
+
const t = k[e.toLowerCase()];
|
|
507
|
+
return t !== void 0 ? this.color = t : console.warn("Unknown color " + e), this;
|
|
508
|
+
}
|
|
509
|
+
clone() {
|
|
510
|
+
const e = new x();
|
|
511
|
+
return e.colorIndex = this.colorIndex, e.color = this.color, e._colorName = this._colorName, this;
|
|
512
|
+
}
|
|
513
|
+
copy(e) {
|
|
514
|
+
return this.colorIndex = e.colorIndex, this.color = e.color, this._colorName = e._colorName, this;
|
|
515
|
+
}
|
|
516
|
+
equals(e) {
|
|
517
|
+
return e.color == this.color && e.colorIndex == this.colorIndex && e._colorName == this._colorName;
|
|
518
|
+
}
|
|
519
|
+
toString() {
|
|
520
|
+
return this.isByLayer ? "ByLayer" : this.isByBlock ? "ByBlock" : this.colorName ? this.colorName : this.hexColor;
|
|
521
|
+
}
|
|
522
|
+
getColorNameByValue(e) {
|
|
523
|
+
for (const [t, r] of Object.entries(k))
|
|
524
|
+
if (r === e)
|
|
525
|
+
return t;
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
getColorIndexByValue(e) {
|
|
529
|
+
const t = O.length - 1;
|
|
530
|
+
for (let r = 1; r < t; ++r)
|
|
531
|
+
if (O[r] === e)
|
|
532
|
+
return r;
|
|
533
|
+
return null;
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
x.NAMES = k;
|
|
537
|
+
let P = x;
|
|
538
|
+
const re = {
|
|
539
|
+
/**
|
|
540
|
+
* Throw error ILLEGAL_PARAMETERS when cannot instantiate from given parameter
|
|
541
|
+
*/
|
|
542
|
+
get ILLEGAL_PARAMETERS() {
|
|
543
|
+
return new ReferenceError("Illegal Parameters");
|
|
544
|
+
},
|
|
545
|
+
/**
|
|
546
|
+
* Throw error ZERO_DIVISION to catch situation of zero division
|
|
547
|
+
*/
|
|
548
|
+
get ZERO_DIVISION() {
|
|
549
|
+
return new Error("Zero division");
|
|
550
|
+
},
|
|
551
|
+
/**
|
|
552
|
+
* Error to throw from BooleanOperations module in case when fixBoundaryConflicts not capable to fix it
|
|
553
|
+
*/
|
|
554
|
+
get UNRESOLVED_BOUNDARY_CONFLICT() {
|
|
555
|
+
return new Error("Unresolved boundary conflict in boolean operation");
|
|
556
|
+
},
|
|
557
|
+
/**
|
|
558
|
+
* Error to throw from LinkedList:testInfiniteLoop static method
|
|
559
|
+
* in case when circular loop detected in linked list
|
|
560
|
+
*/
|
|
561
|
+
get INFINITE_LOOP() {
|
|
562
|
+
return new Error("Infinite loop");
|
|
563
|
+
},
|
|
564
|
+
get CANNOT_INVOKE_ABSTRACT_METHOD() {
|
|
565
|
+
return new Error("Abstract method cannot be invoked");
|
|
566
|
+
},
|
|
567
|
+
get OPERATION_IS_NOT_SUPPORTED() {
|
|
568
|
+
return new Error("Operation is not supported");
|
|
569
|
+
},
|
|
570
|
+
get NOT_IMPLEMENTED() {
|
|
571
|
+
return new Error("Not implemented yet");
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
class oe {
|
|
575
|
+
/**
|
|
576
|
+
* Creates {@link AcCmEventDispatcher} object.
|
|
577
|
+
*/
|
|
578
|
+
constructor() {
|
|
579
|
+
this._listeners = {};
|
|
580
|
+
}
|
|
581
|
+
addEventListener(e, t) {
|
|
582
|
+
this._listeners === void 0 && (this._listeners = {});
|
|
583
|
+
const r = this._listeners;
|
|
584
|
+
r[e] === void 0 && (r[e] = []), r[e].indexOf(t) === -1 && r[e].push(t);
|
|
585
|
+
}
|
|
586
|
+
hasEventListener(e, t) {
|
|
587
|
+
if (this._listeners === void 0) return !1;
|
|
588
|
+
const r = this._listeners;
|
|
589
|
+
return r[e] !== void 0 && r[e].indexOf(t) !== -1;
|
|
590
|
+
}
|
|
591
|
+
removeEventListener(e, t) {
|
|
592
|
+
if (this._listeners === void 0) return;
|
|
593
|
+
const o = this._listeners[e];
|
|
594
|
+
if (o !== void 0) {
|
|
595
|
+
const s = o.indexOf(t);
|
|
596
|
+
s !== -1 && o.splice(s, 1);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
/**
|
|
600
|
+
* Fire an event type.
|
|
601
|
+
* @param event The event that gets fired.
|
|
602
|
+
*/
|
|
603
|
+
dispatchEvent(e) {
|
|
604
|
+
if (this._listeners === void 0) return;
|
|
605
|
+
const r = this._listeners[e.type];
|
|
606
|
+
if (r !== void 0) {
|
|
607
|
+
e.target = this;
|
|
608
|
+
const o = r.slice(0);
|
|
609
|
+
for (let s = 0, i = o.length; s < i; s++)
|
|
610
|
+
o[s].call(this, e);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
class U {
|
|
615
|
+
constructor() {
|
|
616
|
+
this.listeners = [];
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Add the event listener
|
|
620
|
+
* @param listener Input listener to be added
|
|
621
|
+
*/
|
|
622
|
+
addEventListener(e) {
|
|
623
|
+
this.listeners.push(e);
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Remove the listener
|
|
627
|
+
* @param listener Input listener to be removed
|
|
628
|
+
*/
|
|
629
|
+
removeEventListener(e) {
|
|
630
|
+
this.listeners = this.listeners.filter((t) => t !== e);
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Remove all listeners bound to the target and add one new listener
|
|
634
|
+
* @param listener Input listener to be added
|
|
635
|
+
*/
|
|
636
|
+
replaceEventListener(e) {
|
|
637
|
+
this.removeEventListener(e), this.addEventListener(e);
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Notify all listeners
|
|
641
|
+
* @param payload Input payload passed to listener
|
|
642
|
+
*/
|
|
643
|
+
dispatch(e, ...t) {
|
|
644
|
+
for (const r of this.listeners)
|
|
645
|
+
r.call(null, e, ...t);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
var Y = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
649
|
+
function Z(h) {
|
|
650
|
+
return h && h.__esModule && Object.prototype.hasOwnProperty.call(h, "default") ? h.default : h;
|
|
651
|
+
}
|
|
652
|
+
var D = { exports: {} };
|
|
653
|
+
(function(h) {
|
|
654
|
+
(function(e, t) {
|
|
655
|
+
h.exports ? h.exports = t() : e.log = t();
|
|
656
|
+
})(Y, function() {
|
|
657
|
+
var e = function() {
|
|
658
|
+
}, t = "undefined", r = typeof window !== t && typeof window.navigator !== t && /Trident\/|MSIE /.test(window.navigator.userAgent), o = [
|
|
659
|
+
"trace",
|
|
660
|
+
"debug",
|
|
661
|
+
"info",
|
|
662
|
+
"warn",
|
|
663
|
+
"error"
|
|
664
|
+
], s = {}, i = null;
|
|
665
|
+
function g(l, c) {
|
|
666
|
+
var n = l[c];
|
|
667
|
+
if (typeof n.bind == "function")
|
|
668
|
+
return n.bind(l);
|
|
669
|
+
try {
|
|
670
|
+
return Function.prototype.bind.call(n, l);
|
|
671
|
+
} catch {
|
|
672
|
+
return function() {
|
|
673
|
+
return Function.prototype.apply.apply(n, [l, arguments]);
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
function p() {
|
|
678
|
+
console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
|
|
679
|
+
}
|
|
680
|
+
function m(l) {
|
|
681
|
+
return l === "debug" && (l = "log"), typeof console === t ? !1 : l === "trace" && r ? p : console[l] !== void 0 ? g(console, l) : console.log !== void 0 ? g(console, "log") : e;
|
|
682
|
+
}
|
|
683
|
+
function v() {
|
|
684
|
+
for (var l = this.getLevel(), c = 0; c < o.length; c++) {
|
|
685
|
+
var n = o[c];
|
|
686
|
+
this[n] = c < l ? e : this.methodFactory(n, l, this.name);
|
|
687
|
+
}
|
|
688
|
+
if (this.log = this.debug, typeof console === t && l < this.levels.SILENT)
|
|
689
|
+
return "No console available for logging";
|
|
690
|
+
}
|
|
691
|
+
function N(l) {
|
|
692
|
+
return function() {
|
|
693
|
+
typeof console !== t && (v.call(this), this[l].apply(this, arguments));
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function d(l, c, n) {
|
|
697
|
+
return m(l) || N.apply(this, arguments);
|
|
698
|
+
}
|
|
699
|
+
function M(l, c) {
|
|
700
|
+
var n = this, L, A, y, f = "loglevel";
|
|
701
|
+
typeof l == "string" ? f += ":" + l : typeof l == "symbol" && (f = void 0);
|
|
702
|
+
function j(a) {
|
|
703
|
+
var u = (o[a] || "silent").toUpperCase();
|
|
704
|
+
if (!(typeof window === t || !f)) {
|
|
705
|
+
try {
|
|
706
|
+
window.localStorage[f] = u;
|
|
707
|
+
return;
|
|
708
|
+
} catch {
|
|
709
|
+
}
|
|
710
|
+
try {
|
|
711
|
+
window.document.cookie = encodeURIComponent(f) + "=" + u + ";";
|
|
712
|
+
} catch {
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
function B() {
|
|
717
|
+
var a;
|
|
718
|
+
if (!(typeof window === t || !f)) {
|
|
719
|
+
try {
|
|
720
|
+
a = window.localStorage[f];
|
|
721
|
+
} catch {
|
|
722
|
+
}
|
|
723
|
+
if (typeof a === t)
|
|
724
|
+
try {
|
|
725
|
+
var u = window.document.cookie, E = encodeURIComponent(f), R = u.indexOf(E + "=");
|
|
726
|
+
R !== -1 && (a = /^([^;]+)/.exec(
|
|
727
|
+
u.slice(R + E.length + 1)
|
|
728
|
+
)[1]);
|
|
729
|
+
} catch {
|
|
730
|
+
}
|
|
731
|
+
return n.levels[a] === void 0 && (a = void 0), a;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
function $() {
|
|
735
|
+
if (!(typeof window === t || !f)) {
|
|
736
|
+
try {
|
|
737
|
+
window.localStorage.removeItem(f);
|
|
738
|
+
} catch {
|
|
739
|
+
}
|
|
740
|
+
try {
|
|
741
|
+
window.document.cookie = encodeURIComponent(f) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
|
|
742
|
+
} catch {
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
function w(a) {
|
|
747
|
+
var u = a;
|
|
748
|
+
if (typeof u == "string" && n.levels[u.toUpperCase()] !== void 0 && (u = n.levels[u.toUpperCase()]), typeof u == "number" && u >= 0 && u <= n.levels.SILENT)
|
|
749
|
+
return u;
|
|
750
|
+
throw new TypeError("log.setLevel() called with invalid level: " + a);
|
|
751
|
+
}
|
|
752
|
+
n.name = l, n.levels = {
|
|
753
|
+
TRACE: 0,
|
|
754
|
+
DEBUG: 1,
|
|
755
|
+
INFO: 2,
|
|
756
|
+
WARN: 3,
|
|
757
|
+
ERROR: 4,
|
|
758
|
+
SILENT: 5
|
|
759
|
+
}, n.methodFactory = c || d, n.getLevel = function() {
|
|
760
|
+
return y ?? A ?? L;
|
|
761
|
+
}, n.setLevel = function(a, u) {
|
|
762
|
+
return y = w(a), u !== !1 && j(y), v.call(n);
|
|
763
|
+
}, n.setDefaultLevel = function(a) {
|
|
764
|
+
A = w(a), B() || n.setLevel(a, !1);
|
|
765
|
+
}, n.resetLevel = function() {
|
|
766
|
+
y = null, $(), v.call(n);
|
|
767
|
+
}, n.enableAll = function(a) {
|
|
768
|
+
n.setLevel(n.levels.TRACE, a);
|
|
769
|
+
}, n.disableAll = function(a) {
|
|
770
|
+
n.setLevel(n.levels.SILENT, a);
|
|
771
|
+
}, n.rebuild = function() {
|
|
772
|
+
if (i !== n && (L = w(i.getLevel())), v.call(n), i === n)
|
|
773
|
+
for (var a in s)
|
|
774
|
+
s[a].rebuild();
|
|
775
|
+
}, L = w(
|
|
776
|
+
i ? i.getLevel() : "WARN"
|
|
777
|
+
);
|
|
778
|
+
var S = B();
|
|
779
|
+
S != null && (y = w(S)), v.call(n);
|
|
780
|
+
}
|
|
781
|
+
i = new M(), i.getLogger = function(c) {
|
|
782
|
+
if (typeof c != "symbol" && typeof c != "string" || c === "")
|
|
783
|
+
throw new TypeError("You must supply a name when creating a logger.");
|
|
784
|
+
var n = s[c];
|
|
785
|
+
return n || (n = s[c] = new M(
|
|
786
|
+
c,
|
|
787
|
+
i.methodFactory
|
|
788
|
+
)), n;
|
|
789
|
+
};
|
|
790
|
+
var V = typeof window !== t ? window.log : void 0;
|
|
791
|
+
return i.noConflict = function() {
|
|
792
|
+
return typeof window !== t && window.log === i && (window.log = V), i;
|
|
793
|
+
}, i.getLoggers = function() {
|
|
794
|
+
return s;
|
|
795
|
+
}, i.default = i, i;
|
|
796
|
+
});
|
|
797
|
+
})(D);
|
|
798
|
+
var q = D.exports;
|
|
799
|
+
const J = /* @__PURE__ */ Z(q), X = /* @__PURE__ */ W({
|
|
800
|
+
__proto__: null,
|
|
801
|
+
default: J
|
|
802
|
+
}, [q]), ne = !0, C = X;
|
|
803
|
+
C.setLevel("debug");
|
|
804
|
+
const se = (h) => {
|
|
805
|
+
try {
|
|
806
|
+
C.setLevel(h);
|
|
807
|
+
} catch (e) {
|
|
808
|
+
C.setLevel("error"), C.error(e);
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
class F {
|
|
812
|
+
/**
|
|
813
|
+
* Create one object to store attributes. For performance reason, values of attributes passed to constructor
|
|
814
|
+
* will not be cloned to `attributes` property. So it means that value of `attributes` property in this object
|
|
815
|
+
* is just a reference to arguments `attributes` passed to constructor.
|
|
816
|
+
* @param attributes Input attributes to store in this object
|
|
817
|
+
*/
|
|
818
|
+
constructor(e, t) {
|
|
819
|
+
this.events = {
|
|
820
|
+
attrChanged: new U(),
|
|
821
|
+
modelChanged: new U()
|
|
822
|
+
}, this._changing = !1, this._previousAttributes = {}, this._pending = !1;
|
|
823
|
+
const r = e || {};
|
|
824
|
+
t && H(r, t), this.attributes = r, this.changed = {};
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* For strongly-typed access to attributes, use the `get` method only privately in public getter properties.
|
|
828
|
+
* @example
|
|
829
|
+
* get name(): string {
|
|
830
|
+
* return super.get("name")
|
|
831
|
+
* }
|
|
832
|
+
*/
|
|
833
|
+
get(e) {
|
|
834
|
+
return this.attributes[e];
|
|
835
|
+
}
|
|
836
|
+
set(e, t, r) {
|
|
837
|
+
if (e == null) return this;
|
|
838
|
+
let o;
|
|
839
|
+
typeof e == "object" ? (o = e, r = t) : (o = {}, o[e] = t), r || (r = {});
|
|
840
|
+
const s = r.unset, i = r.silent, g = [], p = this._changing;
|
|
841
|
+
this._changing = !0, p || (this._previousAttributes = I(this.attributes), this.changed = {});
|
|
842
|
+
const m = this.attributes, v = this.changed, N = this._previousAttributes;
|
|
843
|
+
for (const d in o)
|
|
844
|
+
t = o[d], T(m[d], t) || g.push(d), T(N[d], t) ? delete v[d] : v[d] = t, s ? delete m[d] : m[d] = t;
|
|
845
|
+
if (!i) {
|
|
846
|
+
g.length && (this._pending = r);
|
|
847
|
+
for (let d = 0; d < g.length; d++)
|
|
848
|
+
this.events.attrChanged.dispatch({
|
|
849
|
+
object: this,
|
|
850
|
+
attrName: g[d],
|
|
851
|
+
attrValue: m[g[d]],
|
|
852
|
+
options: r
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
if (p) return this;
|
|
856
|
+
if (!i)
|
|
857
|
+
for (; this._pending; )
|
|
858
|
+
r = this._pending, this._pending = !1, this.events.modelChanged.dispatch({
|
|
859
|
+
object: this,
|
|
860
|
+
options: r
|
|
861
|
+
});
|
|
862
|
+
return this._pending = !1, this._changing = !1, this;
|
|
863
|
+
}
|
|
864
|
+
has(e) {
|
|
865
|
+
return this.get(e) != null;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Determine if the model has changed since the last `"change"` event.
|
|
869
|
+
* If you specify an attribute name, determine if that attribute has changed.
|
|
870
|
+
*/
|
|
871
|
+
hasChanged(e) {
|
|
872
|
+
return e == null ? !z(this.changed) : K(this.changed, e);
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* Return an object containing all the attributes that have changed. Useful for determining what parts
|
|
876
|
+
* of a view need to be updated and/or what attributes need to be persisted to the server.
|
|
877
|
+
*
|
|
878
|
+
* Unset attributes will be set to undefined. You can also pass an attributes object to diff against
|
|
879
|
+
* the model, determining if there *would be* a change.
|
|
880
|
+
*/
|
|
881
|
+
changedAttributes(e) {
|
|
882
|
+
if (!e) return this.hasChanged() ? I(this.changed) : {};
|
|
883
|
+
const t = this._changing ? this._previousAttributes : this.attributes, r = {};
|
|
884
|
+
for (const o in e) {
|
|
885
|
+
const s = e[o];
|
|
886
|
+
T(t[o], s) || (r[o] = s);
|
|
887
|
+
}
|
|
888
|
+
return r;
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Get the previous value of an attribute, recorded at the time the last `"change"` event was fired.
|
|
892
|
+
*/
|
|
893
|
+
previous(e) {
|
|
894
|
+
return e == null || !this._previousAttributes ? null : this._previousAttributes[e];
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Get all of the attributes of the model at the time of the previous `"change"` event.
|
|
898
|
+
*/
|
|
899
|
+
previousAttributes() {
|
|
900
|
+
return I(this._previousAttributes);
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Create a new model with identical attributes to this one.
|
|
904
|
+
*/
|
|
905
|
+
clone() {
|
|
906
|
+
const e = I(this.attributes);
|
|
907
|
+
return new F(e);
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
class _ {
|
|
911
|
+
/**
|
|
912
|
+
* Private constructor to enforce singleton pattern.
|
|
913
|
+
*/
|
|
914
|
+
constructor() {
|
|
915
|
+
this.entries = /* @__PURE__ */ new Map();
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Retrieves the singleton instance of the AcCmPerformanceCollector.
|
|
919
|
+
* @returns The shared AcCmPerformanceCollector instance.
|
|
920
|
+
*/
|
|
921
|
+
static getInstance() {
|
|
922
|
+
return _.instance || (_.instance = new _()), _.instance;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* Adds or replaces a performance entry by name.
|
|
926
|
+
* @template T The type of the performance data.
|
|
927
|
+
* @param entry A performance entry object with name, data, and format method.
|
|
928
|
+
*/
|
|
929
|
+
collect(e) {
|
|
930
|
+
this.entries.set(e.name, e);
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Logs all performance entries to the console using their format method.
|
|
934
|
+
*/
|
|
935
|
+
printAll() {
|
|
936
|
+
for (const [e, t] of this.entries)
|
|
937
|
+
console.log(`${e}:`), console.log(t.format());
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Clears all collected performance entries.
|
|
941
|
+
*/
|
|
942
|
+
clear() {
|
|
943
|
+
this.entries.clear();
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Retrieves all entries as an array.
|
|
947
|
+
* @returns A copy of all performance entries.
|
|
948
|
+
*/
|
|
949
|
+
getAll() {
|
|
950
|
+
return Array.from(this.entries.values());
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Gets a single entry by name.
|
|
954
|
+
* @param name The unique name of the entry.
|
|
955
|
+
* @returns The matching entry or undefined.
|
|
956
|
+
*/
|
|
957
|
+
getEntry(e) {
|
|
958
|
+
return this.entries.get(e);
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Removes an entry by name.
|
|
962
|
+
* @param name The name of the entry to remove.
|
|
963
|
+
* @returns True if the entry was removed; false if not found.
|
|
964
|
+
*/
|
|
965
|
+
remove(e) {
|
|
966
|
+
return this.entries.delete(e);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
class ie {
|
|
970
|
+
/**
|
|
971
|
+
* Converts a byte count to a human-readable string using KB, MB, or GB.
|
|
972
|
+
*
|
|
973
|
+
* @param bytes - The number of bytes.
|
|
974
|
+
* @param decimals - Number of decimal places to include (default is 2).
|
|
975
|
+
* @returns A formatted string with the appropriate unit.
|
|
976
|
+
*/
|
|
977
|
+
static formatBytes(e, t = 2) {
|
|
978
|
+
if (e === 0) return "0 B";
|
|
979
|
+
const r = 1024, o = Math.max(0, t), s = ["B", "KB", "MB", "GB", "TB"], i = Math.floor(Math.log(e) / Math.log(r)), g = e / Math.pow(r, i);
|
|
980
|
+
return `${parseFloat(g.toFixed(o))} ${s[i]}`;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
class le {
|
|
984
|
+
constructor(e) {
|
|
985
|
+
this.name = e;
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* Executes the task.
|
|
989
|
+
*/
|
|
990
|
+
run(e) {
|
|
991
|
+
throw new Error("run() must be implemented by subclass");
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
class ae {
|
|
995
|
+
constructor() {
|
|
996
|
+
this.tasks = [], this.onProgress = () => {
|
|
997
|
+
}, this.onComplete = () => {
|
|
998
|
+
}, this.onError = () => {
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Adds a task to the execution queue.
|
|
1003
|
+
*
|
|
1004
|
+
* @param task Task instance with name and run function
|
|
1005
|
+
*/
|
|
1006
|
+
addTask(e) {
|
|
1007
|
+
this.tasks.push(e);
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Sets a callback to receive progress updates.
|
|
1011
|
+
*/
|
|
1012
|
+
setProgressCallback(e) {
|
|
1013
|
+
this.onProgress = e;
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Sets a callback to be called after successful completion of all tasks.
|
|
1017
|
+
*/
|
|
1018
|
+
setCompleteCallback(e) {
|
|
1019
|
+
this.onComplete = e;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Sets a callback to be called if any task throws an error.
|
|
1023
|
+
*/
|
|
1024
|
+
setErrorCallback(e) {
|
|
1025
|
+
this.onError = e;
|
|
1026
|
+
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Starts execution of the task queue with the given initial input.
|
|
1029
|
+
*/
|
|
1030
|
+
async run(e) {
|
|
1031
|
+
const t = this.tasks.length;
|
|
1032
|
+
let r = e;
|
|
1033
|
+
for (let o = 0; o < t; o++) {
|
|
1034
|
+
const s = this.tasks[o];
|
|
1035
|
+
try {
|
|
1036
|
+
r = await new Promise((i, g) => {
|
|
1037
|
+
setTimeout(async () => {
|
|
1038
|
+
try {
|
|
1039
|
+
const p = await s.run(r);
|
|
1040
|
+
this.onProgress((o + 1) / t, s), i(p);
|
|
1041
|
+
} catch (p) {
|
|
1042
|
+
g(p);
|
|
1043
|
+
}
|
|
1044
|
+
}, 0);
|
|
1045
|
+
});
|
|
1046
|
+
} catch (i) {
|
|
1047
|
+
this.onError(i, o, s);
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
this.onComplete(r);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
class Q {
|
|
1055
|
+
/**
|
|
1056
|
+
* Create a new AcCmLoadingManager instance
|
|
1057
|
+
* @param onLoad this function will be called when all loaders are done.
|
|
1058
|
+
* @param onProgress this function will be called when an item is complete.
|
|
1059
|
+
* @param onError this function will be called a loader encounters errors.
|
|
1060
|
+
*/
|
|
1061
|
+
constructor(e, t, r) {
|
|
1062
|
+
this.isLoading = !1, this.itemsLoaded = 0, this.itemsTotal = 0, this.urlModifier = void 0, this.handlers = [], this.onStart = void 0, this.onLoad = e, this.onProgress = t, this.onError = r;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* This should be called by any loader using the manager when the loader starts loading an url.
|
|
1066
|
+
* @param url The loaded url
|
|
1067
|
+
*/
|
|
1068
|
+
itemStart(e) {
|
|
1069
|
+
this.itemsTotal++, this.isLoading === !1 && this.onStart !== void 0 && this.onStart(e, this.itemsLoaded, this.itemsTotal), this.isLoading = !0;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* This should be called by any loader using the manager when the loader ended loading an url.
|
|
1073
|
+
* @param url The loaded url
|
|
1074
|
+
*/
|
|
1075
|
+
itemEnd(e) {
|
|
1076
|
+
this.itemsLoaded++, this.onProgress !== void 0 && this.onProgress(e, this.itemsLoaded, this.itemsTotal), this.itemsLoaded === this.itemsTotal && (this.isLoading = !1, this.onLoad !== void 0 && this.onLoad());
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* This should be called by any loader using the manager when the loader errors loading an url.
|
|
1080
|
+
* @param url The loaded url
|
|
1081
|
+
*/
|
|
1082
|
+
itemError(e) {
|
|
1083
|
+
this.onError !== void 0 && this.onError(e);
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Given a URL, uses the URL modifier callback (if any) and returns a resolved URL. If no URL
|
|
1087
|
+
* modifier is set, returns the original URL.
|
|
1088
|
+
* @param url The url to load
|
|
1089
|
+
* @returns Return resolved URL
|
|
1090
|
+
*/
|
|
1091
|
+
resolveURL(e) {
|
|
1092
|
+
return this.urlModifier ? this.urlModifier(e) : e;
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* If provided, the callback will be passed each resource URL before a request is sent. The callback
|
|
1096
|
+
* may return the original URL, or a new URL to override loading behavior. This behavior can be used
|
|
1097
|
+
* to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.
|
|
1098
|
+
* @param transform URL modifier callback. Called with url argument, and must return resolvedURL.
|
|
1099
|
+
* @returns Return this object
|
|
1100
|
+
*/
|
|
1101
|
+
setURLModifier(e) {
|
|
1102
|
+
return this.urlModifier = e, this;
|
|
1103
|
+
}
|
|
1104
|
+
/**
|
|
1105
|
+
* Register a loader with the given regular expression. Can be used to define what loader should
|
|
1106
|
+
* be used in order to load specific files. A typical use case is to overwrite the default loader
|
|
1107
|
+
* for textures.
|
|
1108
|
+
* @param regex A regular expression.
|
|
1109
|
+
* @param loader The loader.
|
|
1110
|
+
* @returns Return this object
|
|
1111
|
+
*/
|
|
1112
|
+
addHandler(e, t) {
|
|
1113
|
+
return this.handlers.push(e, t), this;
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Remove the loader for the given regular expression.
|
|
1117
|
+
* @param regex A regular expression.
|
|
1118
|
+
* @returns Return this object
|
|
1119
|
+
*/
|
|
1120
|
+
removeHandler(e) {
|
|
1121
|
+
const t = this.handlers.indexOf(e);
|
|
1122
|
+
return t !== -1 && this.handlers.splice(t, 2), this;
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Retrieve the registered loader for the given file path.
|
|
1126
|
+
* @param file The file path.
|
|
1127
|
+
* @returns Return the registered loader for the given file path.
|
|
1128
|
+
*/
|
|
1129
|
+
getHandler(e) {
|
|
1130
|
+
for (let t = 0, r = this.handlers.length; t < r; t += 2) {
|
|
1131
|
+
const o = this.handlers[t], s = this.handlers[t + 1];
|
|
1132
|
+
if (o.global && (o.lastIndex = 0), o.test(e))
|
|
1133
|
+
return s;
|
|
1134
|
+
}
|
|
1135
|
+
return null;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
const ee = /* @__PURE__ */ new Q();
|
|
1139
|
+
class he {
|
|
1140
|
+
/**
|
|
1141
|
+
* Creates a new AcCmLoader instance.
|
|
1142
|
+
* @param manager The loadingManager for the loader to use. Default is DefaultLoadingManager.
|
|
1143
|
+
*/
|
|
1144
|
+
constructor(e) {
|
|
1145
|
+
this.manager = e !== void 0 ? e : ee, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* This method is equivalent to 'load', but returns a Promise.
|
|
1149
|
+
* @param url A string containing the path/URL of the file to be loaded.
|
|
1150
|
+
* @param onProgress (optional) — A function to be called while the loading is in progress.
|
|
1151
|
+
* The argument will be the ProgressEvent instance, which contains .lengthComputable, .total
|
|
1152
|
+
* and .loaded. If the server does not set the Content-Length header; .total will be 0.
|
|
1153
|
+
* @returns Return a promise.
|
|
1154
|
+
*/
|
|
1155
|
+
loadAsync(e, t) {
|
|
1156
|
+
return new Promise((r, o) => {
|
|
1157
|
+
this.load(e, r, t, o);
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* This method needs to be implement by all concrete loaders. It holds the logic for parsing the asset.
|
|
1162
|
+
*/
|
|
1163
|
+
parse(e) {
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Set the crossOrigin string to implement CORS for loading the url from a different domain that allows
|
|
1167
|
+
* CORS.
|
|
1168
|
+
* @param crossOrigin The crossOrigin string
|
|
1169
|
+
* @returns Return this object
|
|
1170
|
+
*/
|
|
1171
|
+
setCrossOrigin(e) {
|
|
1172
|
+
return this.crossOrigin = e, this;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Set whether the XMLHttpRequest uses credentials such as cookies, authorization headers or TLS
|
|
1176
|
+
* client certificates.
|
|
1177
|
+
* Note that this has no effect if you are loading files locally or from the same domain.
|
|
1178
|
+
* @param value The flag whether the XMLHttpRequest uses credentials.
|
|
1179
|
+
* @returns Return this object
|
|
1180
|
+
*/
|
|
1181
|
+
setWithCredentials(e) {
|
|
1182
|
+
return this.withCredentials = e, this;
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Set the base path for the asset.
|
|
1186
|
+
* @param path The base path for the asset.
|
|
1187
|
+
* @returns Return this object
|
|
1188
|
+
*/
|
|
1189
|
+
setPath(e) {
|
|
1190
|
+
return this.path = e, this;
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Set the base path for dependent resources like textures.
|
|
1194
|
+
* @param resourcePath The base path for dependent resources like textures.
|
|
1195
|
+
* @returns Return this object
|
|
1196
|
+
*/
|
|
1197
|
+
setResourcePath(e) {
|
|
1198
|
+
return this.resourcePath = e, this;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Set the request header used in HTTP request.
|
|
1202
|
+
* @param requestHeader key: The name of the header whose value is to be set. value: The value
|
|
1203
|
+
* to set as the body of the header.
|
|
1204
|
+
* @returns Return this object
|
|
1205
|
+
*/
|
|
1206
|
+
setRequestHeader(e) {
|
|
1207
|
+
return this.requestHeader = e, this;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
export {
|
|
1211
|
+
P as AcCmColor,
|
|
1212
|
+
re as AcCmErrors,
|
|
1213
|
+
oe as AcCmEventDispatcher,
|
|
1214
|
+
U as AcCmEventManager,
|
|
1215
|
+
he as AcCmLoader,
|
|
1216
|
+
Q as AcCmLoadingManager,
|
|
1217
|
+
F as AcCmObject,
|
|
1218
|
+
_ as AcCmPerformanceCollector,
|
|
1219
|
+
le as AcCmTask,
|
|
1220
|
+
ae as AcCmTaskScheduler,
|
|
1221
|
+
ie as AcTrStringUtil,
|
|
1222
|
+
ne as DEBUG_MODE,
|
|
1223
|
+
ee as DefaultLoadingManager,
|
|
1224
|
+
C as log,
|
|
1225
|
+
se as setLogLevel
|
|
1226
|
+
};
|