@mlightcad/common 1.4.36 → 1.4.37

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