@mlightcad/common 1.4.13 → 1.4.15

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 CHANGED
@@ -4,17 +4,14 @@ function W(r, e) {
4
4
  if (typeof s != "string" && !Array.isArray(s)) {
5
5
  for (const o in s)
6
6
  if (o !== "default" && !(o in r)) {
7
- const n = Object.getOwnPropertyDescriptor(s, o);
8
- n && Object.defineProperty(r, o, n.get ? n : {
9
- enumerable: !0,
10
- get: () => s[o]
11
- });
7
+ const i = Object.getOwnPropertyDescriptor(s, o);
8
+ i && Object.defineProperty(r, o, i.get ? i : { enumerable: !0, get: () => s[o] });
12
9
  }
13
10
  }
14
11
  }
15
12
  return Object.freeze(Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }));
16
13
  }
17
- 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 || {});
14
+ var n = /* @__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))(n || {});
18
15
  const G = {
19
16
  aliceblue: 15792383,
20
17
  antiquewhite: 16444375,
@@ -419,607 +416,286 @@ const G = {
419
416
  16777215,
420
417
  0
421
418
  ];
422
- class w {
423
- /**
424
- * Returns the RGB color value for a given AutoCAD color index.
425
- *
426
- * @param {number} index - The AutoCAD color index value (0-255).
427
- * @returns {number} The RGB color value as a 24-bit integer.
428
- *
429
- * @example
430
- * ```typescript
431
- * // Get the RGB value for color index 1 (red)
432
- * const redColor = AcCmColorUtil.getAcadColor(1); // returns 16711680 (0xFF0000)
433
- * ```
434
- *
435
- * @example
436
- * ```typescript
437
- * // Get special inheritance colors
438
- * const byBlock = AcCmColorUtil.getAcadColor(0); // "ByBlock" color
439
- * const byLayer = AcCmColorUtil.getAcadColor(256); // "ByLayer" color
440
- * ```
441
- */
419
+ class b {
442
420
  static getColorByIndex(e) {
443
421
  return R[e];
444
422
  }
445
- /**
446
- * Finds the AutoCAD color index associated with a given RGB value.
447
- *
448
- * @private
449
- * @param {number} color - The RGB value to find an index for.
450
- * @returns {number | undefined} The color index if found, undefined otherwise.
451
- */
452
423
  static getIndexByColor(e) {
453
424
  const t = R.length - 1;
454
425
  for (let s = 1; s < t; ++s)
455
426
  if (R[s] === e)
456
427
  return s;
457
428
  }
458
- /**
459
- * Returns the RGB color value for a given CSS color name.
460
- *
461
- * @param {string} name - The CSS color name (e.g., "red", "blue", "aliceblue").
462
- * @returns {number | undefined} The RGB color value as a 24-bit integer, or undefined if the name is not found.
463
- *
464
- * @example
465
- * ```typescript
466
- * // Get the RGB value for a standard color name
467
- * const redColor = AcCmColorUtil.getColorByName("red"); // returns 16711680 (0xFF0000)
468
- * const blueColor = AcCmColorUtil.getColorByName("blue"); // returns 255 (0x0000FF)
469
- * ```
470
- *
471
- * @example
472
- * ```typescript
473
- * // Handle undefined for unknown color names
474
- * const unknownColor = AcCmColorUtil.getColorByName("unknown"); // returns undefined
475
- * ```
476
- */
477
429
  static getColorByName(e) {
478
430
  return G[e.toLowerCase()];
479
431
  }
480
- /**
481
- * Finds the color name associated with a given RGB value.
482
- *
483
- * @param {number} rgb - The RGB value to find a name for.
484
- * @returns {string | undefined} The color name if found, undefined otherwise.
485
- */
486
432
  static getNameByColor(e) {
487
433
  for (const [t, s] of Object.entries(G))
488
434
  if (s === e)
489
435
  return t;
490
436
  }
491
- /**
492
- * Finds the color name associated with a given color index.
493
- *
494
- * @param {number} index - The color index to find a name for.
495
- * @returns {string | undefined} The color name if found, undefined otherwise.
496
- */
497
437
  static getNameByIndex(e) {
498
438
  const t = this.getColorByIndex(e);
499
439
  return this.getNameByColor(t);
500
440
  }
501
441
  }
502
- class _ {
503
- /**
504
- * Constructs a new AcCmColor.
505
- * @param method Initial color method (defaults to `ByColor`)
506
- * @param value Internal packed value
507
- */
508
- constructor(e = i.ByLayer, t) {
509
- 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;
510
- }
511
- // ---------------------------------------------------------------------
512
- // Color method
513
- // ---------------------------------------------------------------------
514
- /** Gets the current color method. */
442
+ class B {
443
+ constructor(e = n.ByLayer, t) {
444
+ this._colorMethod = e, this._colorMethod == n.ByColor && t == null ? this._value = 16777215 : this._colorMethod == n.ByACI ? t == null ? this._value = 8 : t === 0 ? this._colorMethod = n.ByBlock : t === 256 ? this._colorMethod = n.ByLayer : this._value = Math.max(0, Math.min(t, 256)) : this._value = t;
445
+ }
515
446
  get colorMethod() {
516
447
  return this._colorMethod;
517
448
  }
518
- /**
519
- * Sets the color method.
520
- *
521
- * Note: Changing the method does not modify `_value`.
522
- */
523
449
  set colorMethod(e) {
524
450
  this._colorMethod = e;
525
451
  }
526
- // ---------------------------------------------------------------------
527
- // RGB accessors (ByColor)
528
- // ---------------------------------------------------------------------
529
- /** Gets the red component (0–255). */
530
452
  get red() {
531
453
  const e = this.RGB;
532
454
  return e != null ? e >> 16 & 255 : void 0;
533
455
  }
534
- /** Gets the green component (0–255). */
535
456
  get green() {
536
457
  const e = this.RGB;
537
458
  return e != null ? e >> 8 & 255 : void 0;
538
459
  }
539
- /** Gets the blue component (0–255). */
540
460
  get blue() {
541
461
  const e = this.RGB;
542
462
  return e != null ? e & 255 : void 0;
543
463
  }
544
- /**
545
- * Gets the packed RGB value (0xRRGGBB).
546
- *
547
- * - For `ByColor`, returns `_value` directly
548
- * - For `ByACI`, converts index to RGB via `AcCmColorUtil`
549
- * - For `ByLayer` or `ByBlock`, returns `_value` directly
550
- */
551
464
  get RGB() {
552
465
  switch (this._colorMethod) {
553
- case i.ByColor:
554
- case i.ByBlock:
555
- case i.ByLayer:
466
+ case n.ByColor:
467
+ case n.ByBlock:
468
+ case n.ByLayer:
556
469
  return this._value;
557
- case i.ByACI:
558
- return this._value ? w.getColorByIndex(this._value) : this._value;
470
+ case n.ByACI:
471
+ return this._value ? b.getColorByIndex(this._value) : this._value;
559
472
  default:
560
473
  return;
561
474
  }
562
475
  }
563
- /**
564
- * Sets the RGB color.
565
- *
566
- * @param r Red component (0–255)
567
- * @param g Green component (0–255)
568
- * @param b Blue component (0–255)
569
- * @returns The current instance for chaining
570
- */
571
476
  setRGB(e, t, s) {
572
- const o = Math.max(0, Math.min(255, Math.round(e))), n = Math.max(0, Math.min(255, Math.round(t))), l = Math.max(0, Math.min(255, Math.round(s)));
573
- return this._value = o << 16 | n << 8 | l, this._colorMethod = i.ByColor, this;
574
- }
575
- /**
576
- * Sets the RGB color by a single packed number (0xRRGGBB).
577
- *
578
- * @param value Packed RGB number
579
- */
477
+ const o = Math.max(0, Math.min(255, Math.round(e))), i = Math.max(0, Math.min(255, Math.round(t))), l = Math.max(0, Math.min(255, Math.round(s)));
478
+ return this._value = o << 16 | i << 8 | l, this._colorMethod = n.ByColor, this;
479
+ }
580
480
  setRGBValue(e) {
581
- return e == null || !Number.isFinite(e) ? (console.warn("Invalid RGB value:", e), this) : (this._value = e & 16777215, this._colorMethod = i.ByColor, this);
582
- }
583
- /**
584
- * Sets the RGB color from a CSS color string.
585
- *
586
- * Examples:
587
- * - "#FF00FF"
588
- * - "#F0F"
589
- * - "rgb(255,0,255)"
590
- * - "rgba(255,0,255,0.5)"
591
- * - "red" (named colors)
592
- *
593
- * @param cssString CSS color string
594
- * @returns The current instance for chaining
595
- */
481
+ return e == null || !Number.isFinite(e) ? this : (this._value = e & 16777215, this._colorMethod = n.ByColor, this);
482
+ }
596
483
  setRGBFromCss(e) {
597
484
  if (!e) return this;
598
485
  const t = e.trim().toLowerCase();
599
486
  if (t.startsWith("#")) {
600
- let n = 0, l = 0, c = 0;
487
+ let i = 0, l = 0, c = 0;
601
488
  if (t.length === 7)
602
- n = parseInt(t.substr(1, 2), 16), l = parseInt(t.substr(3, 2), 16), c = parseInt(t.substr(5, 2), 16);
489
+ i = parseInt(t.substr(1, 2), 16), l = parseInt(t.substr(3, 2), 16), c = parseInt(t.substr(5, 2), 16);
603
490
  else if (t.length === 4)
604
- n = parseInt(t[1] + t[1], 16), l = parseInt(t[2] + t[2], 16), c = parseInt(t[3] + t[3], 16);
491
+ i = parseInt(t[1] + t[1], 16), l = parseInt(t[2] + t[2], 16), c = parseInt(t[3] + t[3], 16);
605
492
  else
606
- return console.warn("Invalid hex color:", e), this;
607
- return this.setRGB(n, l, c);
493
+ return this;
494
+ return this.setRGB(i, l, c);
608
495
  }
609
496
  const s = t.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);
610
497
  if (s) {
611
- const n = parseInt(s[1], 10), l = parseInt(s[2], 10), c = parseInt(s[3], 10);
612
- return this.setRGB(n, l, c);
498
+ const i = parseInt(s[1], 10), l = parseInt(s[2], 10), c = parseInt(s[3], 10);
499
+ return this.setRGB(i, l, c);
613
500
  }
614
- const o = w.getColorByName(e);
615
- return o !== void 0 ? this.setRGBValue(o) : (console.warn("Unknown CSS color string:", e), this);
616
- }
617
- /**
618
- * Sets the color as a scalar grayscale value.
619
- *
620
- * @param scalar Scalar value (0–255)
621
- * @returns The current instance for chaining
622
- */
501
+ const o = b.getColorByName(e);
502
+ return o !== void 0 ? this.setRGBValue(o) : this;
503
+ }
623
504
  setScalar(e) {
624
505
  return this.setRGB(e, e, e);
625
506
  }
626
- /**
627
- * Gets the hexadecimal representation of the color (e.g., "0xFF00FF").
628
- */
629
507
  get hexColor() {
630
508
  const e = this.RGB;
631
509
  return e == null ? void 0 : "0x" + e.toString(16).padStart(6, "0").toUpperCase();
632
510
  }
633
- /**
634
- * Gets the CSS RGB color string (e.g., "rgb(255,0,255)").
635
- */
636
511
  get cssColor() {
637
512
  const e = this.RGB;
638
513
  if (e != null)
639
514
  return `rgb(${e >> 16 & 255},${e >> 8 & 255},${e & 255})`;
640
515
  }
641
- /**
642
- * Returns a CSS rgba() color string with the specified alpha value.
643
- * @param alpha - Opacity value between 0 (transparent) and 1 (opaque)
644
- */
645
516
  cssColorAlpha(e) {
646
517
  const t = this.RGB;
647
518
  if (t != null)
648
519
  return `rgba(${t >> 16 & 255},${t >> 8 & 255},${t & 255},${e})`;
649
520
  }
650
- // ---------------------------------------------------------------------
651
- // ACI accessors (ByACI)
652
- // ---------------------------------------------------------------------
653
- /** Gets the AutoCAD Color Index (ACI), or undefined if not ByACI, ByBlock, or ByLayer. */
654
521
  get colorIndex() {
655
- return this._colorMethod === i.ByACI ? this._value : this._colorMethod === i.ByLayer ? 256 : this._colorMethod === i.ByBlock ? 0 : void 0;
656
- }
657
- /**
658
- * Sets the AutoCAD Color Index (0–256).
659
- *
660
- * - 0 sets the color method to `ByBlock`
661
- * - 256 sets the color method to `ByLayer`
662
- * - 1–255 sets the color method to `ByACI`
663
- *
664
- * @param index ACI index
665
- */
522
+ return this._colorMethod === n.ByACI ? this._value : this._colorMethod === n.ByLayer ? 256 : this._colorMethod === n.ByBlock ? 0 : void 0;
523
+ }
666
524
  set colorIndex(e) {
667
525
  if (e == null) return;
668
526
  const t = Math.max(0, Math.min(256, Math.round(e)));
669
- 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);
527
+ t === 0 ? (this._colorMethod = n.ByBlock, this._value = void 0) : t === 256 ? (this._colorMethod = n.ByLayer, this._value = void 0) : (this._colorMethod = n.ByACI, this._value = t);
670
528
  }
671
- /**
672
- * Returns true if the color method is ByColor (explicit RGB).
673
- */
674
529
  get isByColor() {
675
- return this._colorMethod === i.ByColor;
530
+ return this._colorMethod === n.ByColor;
676
531
  }
677
- /**
678
- * Returns true if the color method is ByACI.
679
- */
680
532
  get isByACI() {
681
- return this._colorMethod === i.ByACI;
682
- }
683
- /**
684
- * Returns true if the color method is ByACI and ACI value is 7
685
- *
686
- * Notes:
687
- * In AutoCAD, ACI Color 7 (Color Index 7) is officially named "Black" or "White" depending on
688
- * the context, but it is functionally defined as the "Contrasting Color" or "Auto-Contrast Color."
689
- * Here is the technical explanation of its behavior:
690
- * - If the background is dark: Color 7 displays as White.
691
- * - If the background is light: Color 7 displays as Black.
692
- */
533
+ return this._colorMethod === n.ByACI;
534
+ }
693
535
  get isForeground() {
694
- return this._colorMethod === i.ByACI && this._value === 7;
536
+ return this._colorMethod === n.ByACI && this._value === 7;
695
537
  }
696
- /**
697
- * Sets the color to ACI value 7.
698
- */
699
538
  setForeground() {
700
- return this._colorMethod = i.ByACI, this._value = 7, this;
539
+ return this._colorMethod = n.ByACI, this._value = 7, this;
701
540
  }
702
- // ---------------------------------------------------------------------
703
- // Layer / Block helpers
704
- // ---------------------------------------------------------------------
705
- /** Returns true if the color method is ByLayer. */
706
541
  get isByLayer() {
707
- return this._colorMethod === i.ByLayer;
542
+ return this._colorMethod === n.ByLayer;
708
543
  }
709
- /**
710
- * Sets the color to ByLayer.
711
- * @param value - Option layer color value
712
- */
713
544
  setByLayer(e) {
714
- return this._colorMethod = i.ByLayer, e == null ? this._value = 256 : this._value = e, this;
545
+ return this._colorMethod = n.ByLayer, e == null ? this._value = 256 : this._value = e, this;
715
546
  }
716
- /** Returns true if the color method is ByBlock. */
717
547
  get isByBlock() {
718
- return this._colorMethod === i.ByBlock;
548
+ return this._colorMethod === n.ByBlock;
719
549
  }
720
- /**
721
- * Sets the color to ByBlock.
722
- * @param value - Option layer color value
723
- */
724
550
  setByBlock(e) {
725
- return this._colorMethod = i.ByBlock, e == null ? this._value = 0 : this._value = e, this;
726
- }
727
- // ---------------------------------------------------------------------
728
- // Color name (dynamic)
729
- // ---------------------------------------------------------------------
730
- /**
731
- * Gets the color name.
732
- *
733
- * For `ByColor` or `ByACI`, resolves the name via `AcCmColorUtil`.
734
- * For `ByLayer` or `ByBlock`, returns the corresponding string.
735
- */
551
+ return this._colorMethod = n.ByBlock, e == null ? this._value = 0 : this._value = e, this;
552
+ }
736
553
  get colorName() {
737
554
  switch (this._colorMethod) {
738
- case i.ByLayer:
555
+ case n.ByLayer:
739
556
  return "ByLayer";
740
- case i.ByBlock:
557
+ case n.ByBlock:
741
558
  return "ByBlock";
742
- case i.ByColor:
743
- return this._value ? w.getNameByColor(this._value) : "";
744
- case i.ByACI:
745
- return this._value ? w.getNameByIndex(this._value) : "";
559
+ case n.ByColor:
560
+ return this._value ? b.getNameByColor(this._value) : "";
561
+ case n.ByACI:
562
+ return this._value ? b.getNameByIndex(this._value) : "";
746
563
  default:
747
564
  return;
748
565
  }
749
566
  }
750
- /**
751
- * Sets the color by name.
752
- *
753
- * Resolves the name to an RGB value via `AcCmColorUtil`.
754
- *
755
- * @param name Color name
756
- */
757
567
  set colorName(e) {
758
568
  if (!e) return;
759
- const t = w.getColorByName(e);
760
- t !== void 0 ? (this._value = t, this._colorMethod = i.ByColor) : console.warn("Unknown color name:", e);
761
- }
762
- // ---------------------------------------------------------------------
763
- // Clone / Copy / Equals
764
- // ---------------------------------------------------------------------
765
- /**
766
- * Creates a clone of this color instance.
767
- *
768
- * @returns A new AcCmColor instance with the same method and value
769
- */
569
+ const t = b.getColorByName(e);
570
+ t !== void 0 && (this._value = t, this._colorMethod = n.ByColor);
571
+ }
770
572
  clone() {
771
- const e = new _();
573
+ const e = new B();
772
574
  return e._colorMethod = this._colorMethod, e._value = this._value, e;
773
575
  }
774
- /**
775
- * Copies color values from another AcCmColor instance.
776
- *
777
- * @param other The source color
778
- * @returns The current instance
779
- */
780
576
  copy(e) {
781
577
  return this._colorMethod = e._colorMethod, this._value = e._value, this;
782
578
  }
783
- /**
784
- * Checks equality with another color.
785
- *
786
- * @param other The color to compare
787
- * @returns True if color method and value are identical
788
- */
789
579
  equals(e) {
790
580
  return this._colorMethod === e._colorMethod && this._value === e._value;
791
581
  }
792
- // ---------------------------------------------------------------------
793
- // String representation
794
- // ---------------------------------------------------------------------
795
- /**
796
- * Returns a string representation of the color.
797
- *
798
- * - "ByLayer" for ByLayer colors
799
- * - "ByBlock" for ByBlock colors
800
- * - One number for color index
801
- * - Three comma-separated numbers for RGB color
802
- */
803
582
  toString() {
804
583
  switch (this._colorMethod) {
805
- case i.ByLayer:
584
+ case n.ByLayer:
806
585
  return "ByLayer";
807
- case i.ByBlock:
586
+ case n.ByBlock:
808
587
  return "ByBlock";
809
- case i.ByACI:
588
+ case n.ByACI:
810
589
  return this._value !== void 0 ? String(this._value) : "";
811
- case i.ByColor:
590
+ case n.ByColor:
812
591
  return this._value ? `${this.red},${this.green},${this.blue}` : "";
813
592
  default:
814
593
  return "";
815
594
  }
816
595
  }
817
- /**
818
- * Creates one AcCmColor from one string
819
- */
820
596
  static fromString(e) {
821
597
  if (!e) return;
822
598
  const t = e.trim();
823
599
  if (/^bylayer$/i.test(t))
824
- return new _(i.ByLayer);
600
+ return new B(n.ByLayer);
825
601
  if (/^byblock$/i.test(t))
826
- return new _(i.ByBlock);
602
+ return new B(n.ByBlock);
827
603
  const s = t.match(
828
604
  /^rgb\s*:\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/i
829
605
  );
830
606
  if (s) {
831
- const n = Number(s[1]), l = Number(s[2]), c = Number(s[3]), v = new _(i.ByColor);
832
- return v.setRGB(n, l, c), v;
607
+ const i = Number(s[1]), l = Number(s[2]), c = Number(s[3]), v = new B(n.ByColor);
608
+ return v.setRGB(i, l, c), v;
833
609
  }
834
610
  if (/^\d{1,3},\d{1,3},\d{1,3}$/.test(t)) {
835
- const [n, l, c] = t.split(",").map(Number), v = new _(i.ByColor);
836
- return v.setRGB(n, l, c), v;
611
+ const [i, l, c] = t.split(",").map(Number), v = new B(n.ByColor);
612
+ return v.setRGB(i, l, c), v;
837
613
  }
838
614
  if (/^\d+$/.test(t)) {
839
- const n = parseInt(t, 10);
840
- return new _(i.ByACI, n);
615
+ const i = parseInt(t, 10);
616
+ return new B(n.ByACI, i);
841
617
  }
842
618
  if (/^book\$/i.test(t)) {
843
- const n = t.substring(t.indexOf("$") + 1), l = w.getColorByName(n);
844
- if (l != null)
845
- return new _(i.ByColor, l);
846
- console.warn("Unknown color book entry:", e);
847
- return;
619
+ const i = t.substring(t.indexOf("$") + 1), l = b.getColorByName(i);
620
+ return l != null ? new B(n.ByColor, l) : void 0;
848
621
  }
849
- const o = w.getColorByName(t);
622
+ const o = b.getColorByName(t);
850
623
  if (o != null)
851
- return new _(i.ByColor, o);
852
- console.warn("Unknown color name:", e);
624
+ return new B(n.ByColor, o);
853
625
  }
854
626
  }
855
627
  class oe {
856
- /**
857
- * Constructs a new `AcCmEntityColor`.
858
- *
859
- * @param method Initial color method (defaults to `ByColor`)
860
- * @param value Internal packed value (defaults to `0`)
861
- */
862
- constructor(e = i.ByColor, t = 0) {
628
+ constructor(e = n.ByColor, t = 0) {
863
629
  this._colorMethod = e, this._value = t;
864
630
  }
865
- /**
866
- * Gets the method used to determine the final color.
867
- */
868
631
  get colorMethd() {
869
632
  return this._colorMethod;
870
633
  }
871
- // ---------------------------------------------------------------------
872
- // RGB accessors
873
- // ---------------------------------------------------------------------
874
- /**
875
- * Gets the red component (0–255). Only valid when colorMethod = ByColor.
876
- */
877
634
  get red() {
878
635
  return this._value >> 16 & 255;
879
636
  }
880
- /**
881
- * Sets the red component and updates the packed RGB value.
882
- */
883
637
  set red(e) {
884
- this._colorMethod = i.ByColor, this._value = this._value & 65535 | (e & 255) << 16;
638
+ this._colorMethod = n.ByColor, this._value = this._value & 65535 | (e & 255) << 16;
885
639
  }
886
- /**
887
- * Gets the green component (0–255). Only valid when colorMethod = ByColor.
888
- */
889
640
  get green() {
890
641
  return this._value >> 8 & 255;
891
642
  }
892
- /**
893
- * Sets the green component and updates the packed RGB value.
894
- */
895
643
  set green(e) {
896
- this._colorMethod = i.ByColor, this._value = this._value & 16711935 | (e & 255) << 8;
644
+ this._colorMethod = n.ByColor, this._value = this._value & 16711935 | (e & 255) << 8;
897
645
  }
898
- /**
899
- * Gets the blue component (0–255). Only valid when colorMethod = ByColor.
900
- */
901
646
  get blue() {
902
647
  return this._value & 255;
903
648
  }
904
- /**
905
- * Sets the blue component and updates the packed RGB value.
906
- */
907
649
  set blue(e) {
908
- this._colorMethod = i.ByColor, this._value = this._value & 16776960 | e & 255;
909
- }
910
- /**
911
- * Sets all RGB components.
912
- *
913
- * @param r Red (0–255)
914
- * @param g Green (0–255)
915
- * @param b Blue (0–255)
916
- */
650
+ this._colorMethod = n.ByColor, this._value = this._value & 16776960 | e & 255;
651
+ }
917
652
  setRGB(e, t, s) {
918
- this._colorMethod = i.ByColor, this._value = (e & 255) << 16 | (t & 255) << 8 | s & 255;
919
- }
920
- // ---------------------------------------------------------------------
921
- // ACI accessors
922
- // ---------------------------------------------------------------------
923
- /**
924
- * Gets the AutoCAD Color Index (ACI). Only valid when colorMethod = ByACI.
925
- */
653
+ this._colorMethod = n.ByColor, this._value = (e & 255) << 16 | (t & 255) << 8 | s & 255;
654
+ }
926
655
  get colorIndex() {
927
656
  return this._value;
928
657
  }
929
- /**
930
- * Sets the AutoCAD Color Index (ACI).
931
- */
932
658
  set colorIndex(e) {
933
- this._colorMethod = i.ByACI, this._value = e;
934
- }
935
- // ---------------------------------------------------------------------
936
- // Layer index accessors
937
- // ---------------------------------------------------------------------
938
- /**
939
- * Gets the referenced layer index. Only valid when colorMethod = ByLayer.
940
- */
659
+ this._colorMethod = n.ByACI, this._value = e;
660
+ }
941
661
  get layerIndex() {
942
662
  return this._value;
943
663
  }
944
- /**
945
- * Sets the layer index for ByLayer color mode.
946
- */
947
664
  set layerIndex(e) {
948
- this._colorMethod = i.ByLayer, this._value = e;
949
- }
950
- // ---------------------------------------------------------------------
951
- // Utility methods
952
- // ---------------------------------------------------------------------
953
- /**
954
- * Returns true if the color method is ByColor (explicit RGB).
955
- */
665
+ this._colorMethod = n.ByLayer, this._value = e;
666
+ }
956
667
  isByColor() {
957
- return this._colorMethod === i.ByColor;
668
+ return this._colorMethod === n.ByColor;
958
669
  }
959
- /**
960
- * Returns true if the color method is ByLayer.
961
- */
962
670
  isByLayer() {
963
- return this._colorMethod === i.ByLayer;
671
+ return this._colorMethod === n.ByLayer;
964
672
  }
965
- /**
966
- * Returns true if the color method is ByBlock.
967
- */
968
673
  isByBlock() {
969
- return this._colorMethod === i.ByBlock;
674
+ return this._colorMethod === n.ByBlock;
970
675
  }
971
- /**
972
- * Returns true if the color method is ByACI.
973
- */
974
676
  isByACI() {
975
- return this._colorMethod === i.ByACI;
677
+ return this._colorMethod === n.ByACI;
976
678
  }
977
- /**
978
- * Returns true if color is uninitialized or invalid.
979
- */
980
679
  isNone() {
981
- return this._colorMethod === i.None;
982
- }
983
- /**
984
- * Gets the packed internal value.
985
- *
986
- * - RGB → packed 24-bit integer
987
- * - ACI → index
988
- * - Layer → index
989
- */
680
+ return this._colorMethod === n.None;
681
+ }
990
682
  get rawValue() {
991
683
  return this._value;
992
684
  }
993
- /**
994
- * Sets a raw internal value. The meaning depends on `colorMethod`.
995
- */
996
685
  set rawValue(e) {
997
686
  this._value = e;
998
687
  }
999
688
  }
1000
- const ne = {
1001
- /**
1002
- * Throw error ILLEGAL_PARAMETERS when cannot instantiate from given parameter
1003
- */
689
+ const ie = {
1004
690
  get ILLEGAL_PARAMETERS() {
1005
691
  return new ReferenceError("Illegal Parameters");
1006
692
  },
1007
- /**
1008
- * Throw error ZERO_DIVISION to catch situation of zero division
1009
- */
1010
693
  get ZERO_DIVISION() {
1011
694
  return new Error("Zero division");
1012
695
  },
1013
- /**
1014
- * Error to throw from BooleanOperations module in case when fixBoundaryConflicts not capable to fix it
1015
- */
1016
696
  get UNRESOLVED_BOUNDARY_CONFLICT() {
1017
697
  return new Error("Unresolved boundary conflict in boolean operation");
1018
698
  },
1019
- /**
1020
- * Error to throw from LinkedList:testInfiniteLoop static method
1021
- * in case when circular loop detected in linked list
1022
- */
1023
699
  get INFINITE_LOOP() {
1024
700
  return new Error("Infinite loop");
1025
701
  },
@@ -1033,10 +709,7 @@ const ne = {
1033
709
  return new Error("Not implemented yet");
1034
710
  }
1035
711
  };
1036
- class ie {
1037
- /**
1038
- * Creates {@link AcCmEventDispatcher} object.
1039
- */
712
+ class ne {
1040
713
  constructor() {
1041
714
  this._listeners = {};
1042
715
  }
@@ -1054,54 +727,34 @@ class ie {
1054
727
  if (this._listeners === void 0) return;
1055
728
  const o = this._listeners[e];
1056
729
  if (o !== void 0) {
1057
- const n = o.indexOf(t);
1058
- n !== -1 && o.splice(n, 1);
730
+ const i = o.indexOf(t);
731
+ i !== -1 && o.splice(i, 1);
1059
732
  }
1060
733
  }
1061
- /**
1062
- * Fire an event type.
1063
- * @param event The event that gets fired.
1064
- */
1065
734
  dispatchEvent(e) {
1066
735
  if (this._listeners === void 0) return;
1067
736
  const s = this._listeners[e.type];
1068
737
  if (s !== void 0) {
1069
738
  e.target = this;
1070
739
  const o = s.slice(0);
1071
- for (let n = 0, l = o.length; n < l; n++)
1072
- o[n].call(this, e);
740
+ for (let i = 0, l = o.length; i < l; i++)
741
+ o[i].call(this, e);
1073
742
  }
1074
743
  }
1075
744
  }
1076
- class U {
745
+ class F {
1077
746
  constructor() {
1078
747
  this.listeners = [];
1079
748
  }
1080
- /**
1081
- * Add the event listener
1082
- * @param listener Input listener to be added
1083
- */
1084
749
  addEventListener(e) {
1085
750
  this.listeners.push(e);
1086
751
  }
1087
- /**
1088
- * Remove the listener
1089
- * @param listener Input listener to be removed
1090
- */
1091
752
  removeEventListener(e) {
1092
753
  this.listeners = this.listeners.filter((t) => t !== e);
1093
754
  }
1094
- /**
1095
- * Remove all listeners bound to the target and add one new listener
1096
- * @param listener Input listener to be added
1097
- */
1098
755
  replaceEventListener(e) {
1099
756
  this.removeEventListener(e), this.addEventListener(e);
1100
757
  }
1101
- /**
1102
- * Notify all listeners
1103
- * @param payload Input payload passed to listener
1104
- */
1105
758
  dispatch(e, ...t) {
1106
759
  for (const s of this.listeners)
1107
760
  s.call(null, e, ...t);
@@ -1110,7 +763,7 @@ class U {
1110
763
  function C(r) {
1111
764
  return r === null || typeof r != "object" ? r : Array.isArray(r) ? [...r] : { ...r };
1112
765
  }
1113
- function F(r) {
766
+ function U(r) {
1114
767
  if (r === null || typeof r != "object")
1115
768
  return r;
1116
769
  if (r instanceof Date)
@@ -1118,10 +771,10 @@ function F(r) {
1118
771
  if (r instanceof RegExp)
1119
772
  return new RegExp(r.source, r.flags);
1120
773
  if (Array.isArray(r))
1121
- return r.map(F);
774
+ return r.map(U);
1122
775
  const e = {};
1123
776
  for (const t in r)
1124
- Object.prototype.hasOwnProperty.call(r, t) && (e[t] = F(r[t]));
777
+ Object.prototype.hasOwnProperty.call(r, t) && (e[t] = U(r[t]));
1125
778
  return e;
1126
779
  }
1127
780
  function Y(r, ...e) {
@@ -1186,7 +839,7 @@ var D = { exports: {} };
1186
839
  "info",
1187
840
  "warn",
1188
841
  "error"
1189
- ], n = {}, l = null;
842
+ ], i = {}, l = null;
1190
843
  function c(h, d) {
1191
844
  var a = h[d];
1192
845
  if (typeof a.bind == "function")
@@ -1200,9 +853,9 @@ var D = { exports: {} };
1200
853
  }
1201
854
  }
1202
855
  function v() {
1203
- console.log && (console.log.apply ? console.log.apply(console, arguments) : Function.prototype.apply.apply(console.log, [console, arguments])), console.trace && console.trace();
856
+ console.log && (console.log.apply || Function.prototype.apply.apply(console.log, [console, arguments]));
1204
857
  }
1205
- function b(h) {
858
+ function w(h) {
1206
859
  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;
1207
860
  }
1208
861
  function m() {
@@ -1219,7 +872,7 @@ var D = { exports: {} };
1219
872
  };
1220
873
  }
1221
874
  function f(h, d, a) {
1222
- return b(h) || x.apply(this, arguments);
875
+ return w(h) || x.apply(this, arguments);
1223
876
  }
1224
877
  function S(h, d) {
1225
878
  var a = this, E, N, L, p = "loglevel";
@@ -1268,7 +921,7 @@ var D = { exports: {} };
1268
921
  }
1269
922
  }
1270
923
  }
1271
- function k(u) {
924
+ function M(u) {
1272
925
  var g = u;
1273
926
  if (typeof g == "string" && a.levels[g.toUpperCase()] !== void 0 && (g = a.levels[g.toUpperCase()]), typeof g == "number" && g >= 0 && g <= a.levels.SILENT)
1274
927
  return g;
@@ -1284,9 +937,9 @@ var D = { exports: {} };
1284
937
  }, a.methodFactory = d || f, a.getLevel = function() {
1285
938
  return L ?? N ?? E;
1286
939
  }, a.setLevel = function(u, g) {
1287
- return L = k(u), g !== !1 && z(L), m.call(a);
940
+ return L = M(u), g !== !1 && z(L), m.call(a);
1288
941
  }, a.setDefaultLevel = function(u) {
1289
- N = k(u), P() || a.setLevel(u, !1);
942
+ N = M(u), P() || a.setLevel(u, !1);
1290
943
  }, a.resetLevel = function() {
1291
944
  L = null, H(), m.call(a);
1292
945
  }, a.enableAll = function(u) {
@@ -1294,20 +947,20 @@ var D = { exports: {} };
1294
947
  }, a.disableAll = function(u) {
1295
948
  a.setLevel(a.levels.SILENT, u);
1296
949
  }, a.rebuild = function() {
1297
- if (l !== a && (E = k(l.getLevel())), m.call(a), l === a)
1298
- for (var u in n)
1299
- n[u].rebuild();
1300
- }, E = k(
950
+ if (l !== a && (E = M(l.getLevel())), m.call(a), l === a)
951
+ for (var u in i)
952
+ i[u].rebuild();
953
+ }, E = M(
1301
954
  l ? l.getLevel() : "WARN"
1302
955
  );
1303
956
  var T = P();
1304
- T != null && (L = k(T)), m.call(a);
957
+ T != null && (L = M(T)), m.call(a);
1305
958
  }
1306
959
  l = new S(), l.getLogger = function(d) {
1307
960
  if (typeof d != "symbol" && typeof d != "string" || d === "")
1308
961
  throw new TypeError("You must supply a name when creating a logger.");
1309
- var a = n[d];
1310
- return a || (a = n[d] = new S(
962
+ var a = i[d];
963
+ return a || (a = i[d] = new S(
1311
964
  d,
1312
965
  l.methodFactory
1313
966
  )), a;
@@ -1316,15 +969,12 @@ var D = { exports: {} };
1316
969
  return l.noConflict = function() {
1317
970
  return typeof window !== t && window.log === l && (window.log = j), l;
1318
971
  }, l.getLoggers = function() {
1319
- return n;
972
+ return i;
1320
973
  }, l.default = l, l;
1321
974
  });
1322
975
  })(D);
1323
976
  var q = D.exports;
1324
- const ee = /* @__PURE__ */ Q(q), te = /* @__PURE__ */ W({
1325
- __proto__: null,
1326
- default: ee
1327
- }, [q]), le = !0, O = te;
977
+ const ee = /* @__PURE__ */ Q(q), te = /* @__PURE__ */ W({ __proto__: null, default: ee }, [q]), le = !0, O = te;
1328
978
  O.setLevel("debug");
1329
979
  const ae = (r) => {
1330
980
  try {
@@ -1334,46 +984,14 @@ const ae = (r) => {
1334
984
  }
1335
985
  };
1336
986
  class V {
1337
- /**
1338
- * Create one object to store attributes. For performance reason, values of attributes passed to constructor
1339
- * will not be cloned to `attributes` property. So it means that value of `attributes` property in this object
1340
- * is just a reference to arguments `attributes` passed to constructor.
1341
- * @param attributes Input attributes to store in this object
1342
- */
1343
987
  constructor(e, t) {
1344
988
  this.events = {
1345
- attrChanged: new U(),
1346
- modelChanged: new U()
989
+ attrChanged: new F(),
990
+ modelChanged: new F()
1347
991
  }, this._changing = !1, this._previousAttributes = {}, this._pending = !1;
1348
992
  const s = e || {};
1349
993
  t && Y(s, t), this.attributes = s, this.changed = {};
1350
994
  }
1351
- /**
1352
- * Gets the value of an attribute.
1353
- *
1354
- * For strongly-typed access to attributes, use the `get` method privately in public getter properties.
1355
- *
1356
- * @template A - The key type extending string keys of T.
1357
- * @param {A} key - The attribute key to retrieve.
1358
- * @returns {T[A] | undefined} The attribute value or undefined if not set.
1359
- *
1360
- * @example
1361
- * ```typescript
1362
- * // Get a single attribute value
1363
- * const name = obj.get('name')
1364
- * const visible = obj.get('visible')
1365
- *
1366
- * // Check if attribute exists
1367
- * if (obj.get('name') !== undefined) {
1368
- * console.log('Name is set')
1369
- * }
1370
- *
1371
- * // For strongly-typed subclasses
1372
- * get name(): string {
1373
- * return super.get("name")
1374
- * }
1375
- * ```
1376
- */
1377
995
  get(e) {
1378
996
  return this.attributes[e];
1379
997
  }
@@ -1381,18 +999,18 @@ class V {
1381
999
  if (e == null) return this;
1382
1000
  let o;
1383
1001
  typeof e == "object" ? (o = e, s = t) : (o = {}, o[e] = t), s || (s = {});
1384
- const n = s.unset, l = s.silent, c = [], v = this._changing;
1002
+ const i = s.unset, l = s.silent, c = [], v = this._changing;
1385
1003
  this._changing = !0, v || (this._previousAttributes = C(this.attributes), this.changed = {});
1386
- const b = this.attributes, m = this.changed, x = this._previousAttributes;
1004
+ const w = this.attributes, m = this.changed, x = this._previousAttributes;
1387
1005
  for (const f in o)
1388
- t = o[f], I(b[f], t) || c.push(f), I(x[f], t) ? delete m[f] : m[f] = t, n ? delete b[f] : b[f] = t;
1006
+ t = o[f], I(w[f], t) || c.push(f), I(x[f], t) ? delete m[f] : m[f] = t, i ? delete w[f] : w[f] = t;
1389
1007
  if (!l) {
1390
1008
  c.length && (this._pending = s);
1391
1009
  for (let f = 0; f < c.length; f++)
1392
1010
  this.events.attrChanged.dispatch({
1393
1011
  object: this,
1394
1012
  attrName: c[f],
1395
- attrValue: b[c[f]],
1013
+ attrValue: w[c[f]],
1396
1014
  options: s
1397
1015
  });
1398
1016
  }
@@ -1408,398 +1026,147 @@ class V {
1408
1026
  has(e) {
1409
1027
  return this.get(e) != null;
1410
1028
  }
1411
- /**
1412
- * Determine if the model has changed since the last `"change"` event.
1413
- * If you specify an attribute name, determine if that attribute has changed.
1414
- */
1415
1029
  hasChanged(e) {
1416
1030
  return e == null ? !J(this.changed) : Z(this.changed, e);
1417
1031
  }
1418
- /**
1419
- * Return an object containing all the attributes that have changed. Useful for determining what parts
1420
- * of a view need to be updated and/or what attributes need to be persisted to the server.
1421
- *
1422
- * Unset attributes will be set to undefined. You can also pass an attributes object to diff against
1423
- * the model, determining if there *would be* a change.
1424
- */
1425
1032
  changedAttributes(e) {
1426
1033
  if (!e) return this.hasChanged() ? C(this.changed) : {};
1427
1034
  const t = this._changing ? this._previousAttributes : this.attributes, s = {};
1428
1035
  for (const o in e) {
1429
- const n = e[o];
1430
- I(t[o], n) || (s[o] = n);
1036
+ const i = e[o];
1037
+ I(t[o], i) || (s[o] = i);
1431
1038
  }
1432
1039
  return s;
1433
1040
  }
1434
- /**
1435
- * Get the previous value of an attribute, recorded at the time the last `"change"` event was fired.
1436
- */
1437
1041
  previous(e) {
1438
1042
  return e == null || !this._previousAttributes ? null : this._previousAttributes[e];
1439
1043
  }
1440
- /**
1441
- * Get all of the attributes of the model at the time of the previous `"change"` event.
1442
- */
1443
1044
  previousAttributes() {
1444
1045
  return C(this._previousAttributes);
1445
1046
  }
1446
- /**
1447
- * Create a new model with identical attributes to this one.
1448
- */
1449
1047
  clone() {
1450
1048
  const e = C(this.attributes);
1451
1049
  return new V(e);
1452
1050
  }
1453
1051
  }
1454
- class M {
1455
- /**
1456
- * Private constructor to enforce singleton pattern.
1457
- */
1052
+ class k {
1458
1053
  constructor() {
1459
1054
  this.entries = /* @__PURE__ */ new Map();
1460
1055
  }
1461
- /**
1462
- * Retrieves the singleton instance of the AcCmPerformanceCollector.
1463
- * @returns The shared AcCmPerformanceCollector instance.
1464
- */
1465
1056
  static getInstance() {
1466
- return M.instance || (M.instance = new M()), M.instance;
1057
+ return k.instance || (k.instance = new k()), k.instance;
1467
1058
  }
1468
- /**
1469
- * Adds or replaces a performance entry by name.
1470
- * @template T The type of the performance data.
1471
- * @param entry A performance entry object with name, data, and format method.
1472
- */
1473
1059
  collect(e) {
1474
1060
  this.entries.set(e.name, e);
1475
1061
  }
1476
- /**
1477
- * Logs all performance entries to the console using their format method.
1478
- */
1479
1062
  printAll() {
1480
1063
  for (const [e, t] of this.entries)
1481
- console.log(`${e}:`), console.log(t.format());
1064
+ ;
1482
1065
  }
1483
- /**
1484
- * Clears all collected performance entries.
1485
- */
1486
1066
  clear() {
1487
1067
  this.entries.clear();
1488
1068
  }
1489
- /**
1490
- * Retrieves all entries as an array.
1491
- * @returns A copy of all performance entries.
1492
- */
1493
1069
  getAll() {
1494
1070
  return Array.from(this.entries.values());
1495
1071
  }
1496
- /**
1497
- * Gets a single entry by name.
1498
- * @param name The unique name of the entry.
1499
- * @returns The matching entry or undefined.
1500
- */
1501
1072
  getEntry(e) {
1502
1073
  return this.entries.get(e);
1503
1074
  }
1504
- /**
1505
- * Removes an entry by name.
1506
- * @param name The name of the entry to remove.
1507
- * @returns True if the entry was removed; false if not found.
1508
- */
1509
1075
  remove(e) {
1510
1076
  return this.entries.delete(e);
1511
1077
  }
1512
1078
  }
1513
1079
  class he {
1514
- /**
1515
- * Converts a byte count to a human-readable string using appropriate size units.
1516
- *
1517
- * Automatically selects the most appropriate unit (B, KB, MB, GB, TB) based on the size
1518
- * and formats the result with the specified number of decimal places.
1519
- *
1520
- * @param {number} bytes - The number of bytes to format.
1521
- * @param {number} [decimals=2] - Number of decimal places to include in the result.
1522
- * @returns {string} A formatted string with the appropriate unit.
1523
- *
1524
- * @example
1525
- * ```typescript
1526
- * import { AcTrStringUtil } from './AcCmStringUtil'
1527
- *
1528
- * // Format different byte sizes
1529
- * AcTrStringUtil.formatBytes(0) // "0 B"
1530
- * AcTrStringUtil.formatBytes(1024) // "1 KB"
1531
- * AcTrStringUtil.formatBytes(1024 * 1024) // "1 MB"
1532
- * AcTrStringUtil.formatBytes(1536, 1) // "1.5 KB"
1533
- * AcTrStringUtil.formatBytes(2048000, 0) // "2 MB"
1534
- * ```
1535
- */
1536
1080
  static formatBytes(e, t = 2) {
1537
1081
  if (e === 0) return "0 B";
1538
- const s = 1024, o = Math.max(0, t), n = ["B", "KB", "MB", "GB", "TB"], l = Math.floor(Math.log(e) / Math.log(s)), c = e / Math.pow(s, l);
1539
- return `${parseFloat(c.toFixed(o))} ${n[l]}`;
1082
+ const s = 1024, o = Math.max(0, t), i = ["B", "KB", "MB", "GB", "TB"], l = Math.floor(Math.log(e) / Math.log(s)), c = e / Math.pow(s, l);
1083
+ return `${parseFloat(c.toFixed(o))} ${i[l]}`;
1540
1084
  }
1541
1085
  }
1542
1086
  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 || {});
1543
- class B {
1544
- /**
1545
- * Creates a new transparency object.
1546
- *
1547
- * @param alpha
1548
- * When provided, constructs with `ByAlpha` method and sets alpha.
1549
- * Must be between 0 and 255.
1550
- */
1087
+ class _ {
1551
1088
  constructor(e) {
1552
- e !== void 0 ? (this._method = y.ByAlpha, this._alpha = B.clampAlpha(e)) : (this._method = y.ByLayer, this._alpha = 255);
1089
+ e !== void 0 ? (this._method = y.ByAlpha, this._alpha = _.clampAlpha(e)) : (this._method = y.ByLayer, this._alpha = 255);
1553
1090
  }
1554
- /** Gets the current transparency method */
1555
1091
  get method() {
1556
1092
  return this._method;
1557
1093
  }
1558
- /**
1559
- * Sets the transparency method.
1560
- * If setting to ByAlpha with no prior alpha, alpha stays 255 (opaque).
1561
- *
1562
- * @param method The new transparency method
1563
- */
1564
1094
  set method(e) {
1565
1095
  this._method = e;
1566
1096
  }
1567
- /**
1568
- * Gets the alpha value.
1569
- * Only meaningful if `method === ByAlpha`.
1570
- */
1571
1097
  get alpha() {
1572
1098
  return this._alpha;
1573
1099
  }
1574
- /**
1575
- * Sets the alpha value and force the method to `ByAlpha`.
1576
- *
1577
- * @param alpha 0–255 alpha, clamped internally if out of range
1578
- */
1579
1100
  set alpha(e) {
1580
- this._alpha = B.clampAlpha(e), this._method = y.ByAlpha;
1581
- }
1582
- /**
1583
- * Gets the AutoCAD-style transparency percentage.
1584
- *
1585
- * Mapping rules:
1586
- * - 0% = fully opaque (alpha = 255)
1587
- * - 100% = fully transparent (alpha = 0)
1588
- *
1589
- * This matches how AutoCAD displays and stores transparency
1590
- * values in UI and DXF files.
1591
- *
1592
- * If the transparency method is not `ByAlpha`,
1593
- * this method returns `undefined`, because AutoCAD
1594
- * does not define a percentage for ByLayer or ByBlock.
1595
- *
1596
- * @returns Transparency percentage (0–100), or undefined
1597
- */
1101
+ this._alpha = _.clampAlpha(e), this._method = y.ByAlpha;
1102
+ }
1598
1103
  get percentage() {
1599
1104
  if (this._method === y.ByAlpha)
1600
1105
  return Math.round((1 - this._alpha / 255) * 100);
1601
1106
  }
1602
- /**
1603
- * Sets the transparency using an AutoCAD-style percentage.
1604
- *
1605
- * Mapping rules (AutoCAD compatible):
1606
- * - 0% → fully opaque (alpha = 255)
1607
- * - 100% → fully transparent (alpha = 0)
1608
- *
1609
- * Internally, the alpha value is calculated as:
1610
- * alpha = round(255 × (1 − percentage / 100))
1611
- *
1612
- * This method:
1613
- * - Forces the transparency method to `ByAlpha`
1614
- * - Clamps the percentage to the range 0–100
1615
- * - Preserves ObjectARX value semantics
1616
- *
1617
- * @param percentage Transparency percentage (0–100)
1618
- * @returns This instance (for fluent chaining)
1619
- *
1620
- * @example
1621
- * const t = new AcCmTransparency();
1622
- * t.setPercentage(50); // ≈ alpha 128
1623
- *
1624
- * t.setPercentage(0); // alpha = 255 (opaque)
1625
- * t.setPercentage(100); // alpha = 0 (clear)
1626
- */
1627
1107
  set percentage(e) {
1628
1108
  const t = Math.max(0, Math.min(100, e)), s = Math.round(255 * (1 - t / 100));
1629
1109
  this.alpha = s;
1630
1110
  }
1631
- /**
1632
- * Ensures alpha always stays within 0–255.
1633
- */
1634
1111
  static clampAlpha(e) {
1635
1112
  return Math.max(0, Math.min(255, Math.floor(e)));
1636
1113
  }
1637
- /**
1638
- * True if the method is `ByAlpha`.
1639
- */
1640
1114
  get isByAlpha() {
1641
1115
  return this._method === y.ByAlpha;
1642
1116
  }
1643
- /**
1644
- * True if the method is `ByBlock`.
1645
- */
1646
1117
  get isByBlock() {
1647
1118
  return this._method === y.ByBlock;
1648
1119
  }
1649
- /**
1650
- * True if the method is `ByLayer`.
1651
- */
1652
1120
  get isByLayer() {
1653
1121
  return this._method === y.ByLayer;
1654
1122
  }
1655
- /**
1656
- * True if transparency is exactly clear (alpha==0 and ByAlpha).
1657
- */
1658
1123
  get isClear() {
1659
1124
  return this.isByAlpha && this._alpha === 0;
1660
1125
  }
1661
- /**
1662
- * True if transparency is solid (alpha==255 and ByAlpha).
1663
- */
1664
1126
  get isSolid() {
1665
1127
  return this.isByAlpha && this._alpha === 255;
1666
1128
  }
1667
- /**
1668
- * True if current state is invalid (ErrorValue).
1669
- */
1670
1129
  get isInvalid() {
1671
1130
  return this._method === y.ErrorValue;
1672
1131
  }
1673
- /**
1674
- * Convert this transparency to an integer suitable for storage.
1675
- * Uses a simple bit-encoding: high­bits for method and low­bits for alpha.
1676
- *
1677
- * 31 24 23 8 7 0
1678
- * +-------------+--------------+------------+
1679
- * | flags | reserved | alpha |
1680
- * +-------------+--------------+------------+
1681
- */
1682
1132
  serialize() {
1683
1133
  return this._method << 24 | this._alpha;
1684
1134
  }
1685
- /**
1686
- * Creates a deep copy of this transparency object.
1687
- *
1688
- * This mirrors the value-semantics of ObjectARX `AcCmTransparency`,
1689
- * where copying results in an independent object with the same
1690
- * transparency method and alpha value.
1691
- *
1692
- * @returns A new `AcCmTransparency` instance with identical state.
1693
- */
1694
1135
  clone() {
1695
- const e = new B();
1136
+ const e = new _();
1696
1137
  return e._method = this._method, e._alpha = this._alpha, e;
1697
1138
  }
1698
- /**
1699
- * Compares this transparency with another one for equality.
1700
- *
1701
- * Two `AcCmTransparency` objects are considered equal if:
1702
- * - Their transparency methods are identical
1703
- * - Their alpha values are identical
1704
- *
1705
- * This mirrors the value semantics of ObjectARX
1706
- * `AcCmTransparency`.
1707
- *
1708
- * @param other The transparency to compare with
1709
- * @returns True if both represent the same transparency
1710
- *
1711
- * @example
1712
- * const a = new AcCmTransparency(128);
1713
- * const b = new AcCmTransparency(128);
1714
- * a.equals(b); // true
1715
- */
1716
1139
  equals(e) {
1717
1140
  return this._method === e._method && this._alpha === e._alpha;
1718
1141
  }
1719
- /**
1720
- * Returns a human-readable string representation of the transparency.
1721
- *
1722
- * Behavior:
1723
- * - `"ByLayer"` if transparency is inherited from layer
1724
- * - `"ByBlock"` if transparency is inherited from block
1725
- * - Numeric alpha value (`"0"`–`"255"`) if method is `ByAlpha`
1726
- *
1727
- * This format is intentionally simple and mirrors common
1728
- * AutoCAD UI and DXF text usage.
1729
- *
1730
- * @returns String representation of the transparency
1731
- *
1732
- * @example
1733
- * new AcCmTransparency().toString(); // "ByLayer"
1734
- * new AcCmTransparency(128).toString(); // "128"
1735
- */
1736
1142
  toString() {
1737
1143
  return this.isByLayer ? "ByLayer" : this.isByBlock ? "ByBlock" : this._alpha.toString();
1738
1144
  }
1739
- /**
1740
- * Creates an `AcCmTransparency` instance from a string representation.
1741
- *
1742
- * Accepted formats:
1743
- * - `"ByLayer"` (case-insensitive)
1744
- * - `"ByBlock"` (case-insensitive)
1745
- * - Numeric alpha value `"0"`–`"255"`
1746
- *
1747
- * Invalid or out-of-range values will produce an
1748
- * `ErrorValue` transparency.
1749
- *
1750
- * @param value String to parse
1751
- * @returns Parsed `AcCmTransparency` instance
1752
- *
1753
- * @example
1754
- * AcCmTransparency.fromString("ByLayer");
1755
- * AcCmTransparency.fromString("128");
1756
- * AcCmTransparency.fromString("ByBlock");
1757
- */
1758
1145
  static fromString(e) {
1759
1146
  const t = e.trim();
1760
1147
  if (/^bylayer$/i.test(t)) {
1761
- const n = new B();
1762
- return n._method = y.ByLayer, n;
1148
+ const i = new _();
1149
+ return i._method = y.ByLayer, i;
1763
1150
  }
1764
1151
  if (/^byblock$/i.test(t)) {
1765
- const n = new B();
1766
- return n._method = y.ByBlock, n;
1152
+ const i = new _();
1153
+ return i._method = y.ByBlock, i;
1767
1154
  }
1768
1155
  const s = Number(t);
1769
1156
  if (Number.isInteger(s) && s >= 0 && s <= 255)
1770
- return new B(s);
1771
- const o = new B();
1157
+ return new _(s);
1158
+ const o = new _();
1772
1159
  return o._method = y.ErrorValue, o;
1773
1160
  }
1774
- /**
1775
- * Deserialize an integer back into a transparency object.
1776
- *
1777
- * @param value 32-bit stored transparency representation
1778
- */
1779
1161
  static deserialize(e) {
1780
- const t = e >>> 24 & 255, s = e & 255, o = Object.values(y)[t] ?? y.ErrorValue, n = new B();
1781
- return n._method = o, n._alpha = B.clampAlpha(s), n;
1162
+ const t = e >>> 24 & 255, s = e & 255, o = Object.values(y)[t] ?? y.ErrorValue, i = new _();
1163
+ return i._method = o, i._alpha = _.clampAlpha(s), i;
1782
1164
  }
1783
1165
  }
1784
1166
  class ue {
1785
- /**
1786
- * Creates a new task with the specified name.
1787
- *
1788
- * @param {string} name - The name identifier for this task.
1789
- */
1790
1167
  constructor(e) {
1791
1168
  this.name = e;
1792
1169
  }
1793
- /**
1794
- * Executes the task with the given input.
1795
- *
1796
- * This method must be implemented by subclasses to define the actual work
1797
- * performed by the task. Can return either a synchronous result or a Promise.
1798
- *
1799
- * @param {TIn} _input - The input data for the task.
1800
- * @returns {TOut | Promise<TOut>} The task result, either synchronous or asynchronous.
1801
- * @throws {Error} When the method is not implemented by a subclass.
1802
- */
1803
1170
  run(e) {
1804
1171
  throw new Error("run() must be implemented by subclass");
1805
1172
  }
@@ -1810,15 +1177,6 @@ class ce {
1810
1177
  }, this.onComplete = () => {
1811
1178
  }, this.onError = () => !1;
1812
1179
  }
1813
- /**
1814
- * Schedules a task to be executed asynchronously.
1815
- *
1816
- * This method uses requestAnimationFrame in browser environments or setTimeout
1817
- * in Node.js environments to schedule the task.
1818
- *
1819
- * @param callback - The callback function to schedule
1820
- * @returns Promise that resolves with the result of the callback
1821
- */
1822
1180
  scheduleTask(e) {
1823
1181
  return new Promise((t, s) => {
1824
1182
  const o = () => {
@@ -1827,47 +1185,30 @@ class ce {
1827
1185
  typeof window < "u" && typeof window.requestAnimationFrame == "function" ? window.requestAnimationFrame(o) : setTimeout(o, 0);
1828
1186
  });
1829
1187
  }
1830
- /**
1831
- * Adds a task to the execution queue.
1832
- *
1833
- * @param task Task instance with name and run function
1834
- */
1835
1188
  addTask(e) {
1836
1189
  this.tasks.push(e);
1837
1190
  }
1838
- /**
1839
- * Sets a callback to receive progress updates.
1840
- */
1841
1191
  setProgressCallback(e) {
1842
1192
  this.onProgress = e;
1843
1193
  }
1844
- /**
1845
- * Sets a callback to be called after successful completion of all tasks.
1846
- */
1847
1194
  setCompleteCallback(e) {
1848
1195
  this.onComplete = e;
1849
1196
  }
1850
- /**
1851
- * Sets a callback to be called if any task throws an error.
1852
- */
1853
1197
  setErrorCallback(e) {
1854
1198
  this.onError = e;
1855
1199
  }
1856
- /**
1857
- * Starts execution of the task queue with the given initial input.
1858
- */
1859
1200
  async run(e) {
1860
1201
  const t = this.tasks.length;
1861
1202
  let s = e;
1862
1203
  for (let o = 0; o < t; o++) {
1863
- const n = this.tasks[o];
1204
+ const i = this.tasks[o];
1864
1205
  try {
1865
1206
  s = await this.scheduleTask(async () => {
1866
- const l = await n.run(s);
1867
- return this.onProgress((o + 1) / t, n), l;
1207
+ const l = await i.run(s);
1208
+ return this.onProgress((o + 1) / t, i), l;
1868
1209
  });
1869
1210
  } catch (l) {
1870
- if (this.onError({ error: l, taskIndex: o, task: n }))
1211
+ if (this.onError({ error: l, taskIndex: o, task: i }))
1871
1212
  return Promise.reject(l);
1872
1213
  }
1873
1214
  }
@@ -1875,182 +1216,89 @@ class ce {
1875
1216
  }
1876
1217
  }
1877
1218
  class re {
1878
- /**
1879
- * Create a new AcCmLoadingManager instance
1880
- * @param onLoad this function will be called when all loaders are done.
1881
- * @param onProgress this function will be called when an item is complete.
1882
- * @param onError this function will be called a loader encounters errors.
1883
- */
1884
1219
  constructor(e, t, s) {
1885
1220
  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;
1886
1221
  }
1887
- /**
1888
- * This should be called by any loader using the manager when the loader starts loading an url.
1889
- * @param url The loaded url
1890
- */
1891
1222
  itemStart(e) {
1892
1223
  this.itemsTotal++, this.isLoading === !1 && this.onStart !== void 0 && this.onStart(e, this.itemsLoaded, this.itemsTotal), this.isLoading = !0;
1893
1224
  }
1894
- /**
1895
- * This should be called by any loader using the manager when the loader ended loading an url.
1896
- * @param url The loaded url
1897
- */
1898
1225
  itemEnd(e) {
1899
1226
  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());
1900
1227
  }
1901
- /**
1902
- * This should be called by any loader using the manager when the loader errors loading an url.
1903
- * @param url The loaded url
1904
- */
1905
1228
  itemError(e) {
1906
1229
  this.onError !== void 0 && this.onError(e);
1907
1230
  }
1908
- /**
1909
- * Given a URL, uses the URL modifier callback (if any) and returns a resolved URL. If no URL
1910
- * modifier is set, returns the original URL.
1911
- * @param url The url to load
1912
- * @returns Return resolved URL
1913
- */
1914
1231
  resolveURL(e) {
1915
1232
  return this.urlModifier ? this.urlModifier(e) : e;
1916
1233
  }
1917
- /**
1918
- * If provided, the callback will be passed each resource URL before a request is sent. The callback
1919
- * may return the original URL, or a new URL to override loading behavior. This behavior can be used
1920
- * to load assets from .ZIP files, drag-and-drop APIs, and Data URIs.
1921
- * @param transform URL modifier callback. Called with url argument, and must return resolvedURL.
1922
- * @returns Return this object
1923
- */
1924
1234
  setURLModifier(e) {
1925
1235
  return this.urlModifier = e, this;
1926
1236
  }
1927
- /**
1928
- * Register a loader with the given regular expression. Can be used to define what loader should
1929
- * be used in order to load specific files. A typical use case is to overwrite the default loader
1930
- * for textures.
1931
- * @param regex A regular expression.
1932
- * @param loader The loader.
1933
- * @returns Return this object
1934
- */
1935
1237
  addHandler(e, t) {
1936
1238
  return this.handlers.push(e, t), this;
1937
1239
  }
1938
- /**
1939
- * Remove the loader for the given regular expression.
1940
- * @param regex A regular expression.
1941
- * @returns Return this object
1942
- */
1943
1240
  removeHandler(e) {
1944
1241
  const t = this.handlers.indexOf(e);
1945
1242
  return t !== -1 && this.handlers.splice(t, 2), this;
1946
1243
  }
1947
- /**
1948
- * Retrieve the registered loader for the given file path.
1949
- * @param file The file path.
1950
- * @returns Return the registered loader for the given file path.
1951
- */
1952
1244
  getHandler(e) {
1953
1245
  for (let t = 0, s = this.handlers.length; t < s; t += 2) {
1954
- const o = this.handlers[t], n = this.handlers[t + 1];
1246
+ const o = this.handlers[t], i = this.handlers[t + 1];
1955
1247
  if (o.global && (o.lastIndex = 0), o.test(e))
1956
- return n;
1248
+ return i;
1957
1249
  }
1958
1250
  return null;
1959
1251
  }
1960
1252
  }
1961
- const se = /* @__PURE__ */ new re();
1253
+ const se = new re();
1962
1254
  class de {
1963
- /**
1964
- * Creates a new AcCmLoader instance.
1965
- * @param manager The loadingManager for the loader to use. Default is DefaultLoadingManager.
1966
- */
1967
1255
  constructor(e) {
1968
1256
  this.manager = e !== void 0 ? e : se, this.crossOrigin = "anonymous", this.withCredentials = !1, this.path = "", this.resourcePath = "", this.requestHeader = {};
1969
1257
  }
1970
- /**
1971
- * This method is equivalent to 'load', but returns a Promise.
1972
- * @param url A string containing the path/URL of the file to be loaded.
1973
- * @param onProgress (optional) — A function to be called while the loading is in progress.
1974
- * The argument will be the ProgressEvent instance, which contains .lengthComputable, .total
1975
- * and .loaded. If the server does not set the Content-Length header; .total will be 0.
1976
- * @returns Return a promise.
1977
- */
1978
1258
  loadAsync(e, t) {
1979
1259
  return new Promise((s, o) => {
1980
1260
  this.load(e, s, t, o);
1981
1261
  });
1982
1262
  }
1983
- /**
1984
- * This method needs to be implement by all concrete loaders. It holds the logic for parsing the asset.
1985
- */
1986
1263
  parse(e) {
1987
1264
  }
1988
- /**
1989
- * Set the crossOrigin string to implement CORS for loading the url from a different domain that allows
1990
- * CORS.
1991
- * @param crossOrigin The crossOrigin string
1992
- * @returns Return this object
1993
- */
1994
1265
  setCrossOrigin(e) {
1995
1266
  return this.crossOrigin = e, this;
1996
1267
  }
1997
- /**
1998
- * Set whether the XMLHttpRequest uses credentials such as cookies, authorization headers or TLS
1999
- * client certificates.
2000
- * Note that this has no effect if you are loading files locally or from the same domain.
2001
- * @param value The flag whether the XMLHttpRequest uses credentials.
2002
- * @returns Return this object
2003
- */
2004
1268
  setWithCredentials(e) {
2005
1269
  return this.withCredentials = e, this;
2006
1270
  }
2007
- /**
2008
- * Set the base path for the asset.
2009
- * @param path The base path for the asset.
2010
- * @returns Return this object
2011
- */
2012
1271
  setPath(e) {
2013
1272
  return this.path = e, this;
2014
1273
  }
2015
- /**
2016
- * Set the base path for dependent resources like textures.
2017
- * @param resourcePath The base path for dependent resources like textures.
2018
- * @returns Return this object
2019
- */
2020
1274
  setResourcePath(e) {
2021
1275
  return this.resourcePath = e, this;
2022
1276
  }
2023
- /**
2024
- * Set the request header used in HTTP request.
2025
- * @param requestHeader key: The name of the header whose value is to be set. value: The value
2026
- * to set as the body of the header.
2027
- * @returns Return this object
2028
- */
2029
1277
  setRequestHeader(e) {
2030
1278
  return this.requestHeader = e, this;
2031
1279
  }
2032
1280
  }
2033
1281
  export {
2034
- _ as AcCmColor,
2035
- i as AcCmColorMethod,
2036
- w as AcCmColorUtil,
1282
+ B as AcCmColor,
1283
+ n as AcCmColorMethod,
1284
+ b as AcCmColorUtil,
2037
1285
  oe as AcCmEntityColor,
2038
- ne as AcCmErrors,
2039
- ie as AcCmEventDispatcher,
2040
- U as AcCmEventManager,
1286
+ ie as AcCmErrors,
1287
+ ne as AcCmEventDispatcher,
1288
+ F as AcCmEventManager,
2041
1289
  de as AcCmLoader,
2042
1290
  re as AcCmLoadingManager,
2043
1291
  V as AcCmObject,
2044
- M as AcCmPerformanceCollector,
1292
+ k as AcCmPerformanceCollector,
2045
1293
  ue as AcCmTask,
2046
1294
  ce as AcCmTaskScheduler,
2047
- B as AcCmTransparency,
1295
+ _ as AcCmTransparency,
2048
1296
  y as AcCmTransparencyMethod,
2049
1297
  he as AcTrStringUtil,
2050
1298
  le as DEBUG_MODE,
2051
1299
  se as DefaultLoadingManager,
2052
1300
  C as clone,
2053
- F as deepClone,
1301
+ U as deepClone,
2054
1302
  Y as defaults,
2055
1303
  Z as has,
2056
1304
  J as isEmpty,