@mlightcad/libredwg-converter 3.5.24 → 3.5.26

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.
@@ -1,5 +1,5 @@
1
- import { AcDbFace as v, AcDbArc as O, AcGeVector3d as D, AcDbCircle as m, AcDbEllipse as k, AcDbLine as R, AcGePoint3d as w, AcDbSpline as T, AcDbPoint as F, AcDbTrace as V, AcDbPolyline as N, AcGePoint2d as b, AcDbPolygonMesh as B, AcDbPolyFaceMesh as z, AcDbPoly2dType as A, AcDb2dPolyline as j, AcDbPoly3dType as y, AcDb3dPolyline as W, AcDbHatch as H, AcGePolyline2d as X, AcGeLine2d as U, AcGeCircArc2d as G, AcGeVector2d as Y, AcGeEllipseArc2d as _, AcGeSpline3d as P, AcGeLoop2d as E, AcDbTable as Z, AcDbText as K, AcDbMText as q, AcDbLeader as J, AcDbAlignedDimension as Q, AcDbRotatedDimension as $, AcDb3PointAngularDimension as ee, AcDbOrdinateDimension as ne, AcDbRadialDimension as oe, AcDbDiametricDimension as te, AcDbRasterImage as se, AcDbWipeout as re, AcDbViewport as ie, AcDbRay as ce, AcDbXline as le, AcDbAttributeFlags as I, AcDbAttributeMTextFlag as M, AcDbAttribute as ae, AcDbAttributeDefinition as de, AcDbBlockReference as pe, AcCmTransparency as ue, AcDbDatabaseConverter as fe, createWorkerApi as he, AcDbLinetypeTableRecord as ge, AcDbTextStyleTableRecord as De, DEFAULT_TEXT_STYLE as L, AcDbDimStyleTableRecord as Ae, AcCmColor as Ie, AcDbLayerTableRecord as ye, AcDbViewportTableRecord as we, AcDbBlockTableRecord as Te, AcDbBatchProcessing as be, ByLayer as Pe, AcDbLayout as Ee, AcDbRasterImageDef as Me } from "@mlightcad/data-model";
2
- class C {
1
+ import { AcDbFace as O, AcGeVector3d as D, AcDbArc as m, transformOcsPointToWcs as w, AcDbCircle as k, AcDbEllipse as R, AcDbLine as F, AcGePoint3d as T, AcDbSpline as b, AcDbPoint as V, AcDbTrace as N, AcDbPolyline as B, AcGePoint2d as P, AcDbPolygonMesh as z, AcDbPolyFaceMesh as j, AcDbPoly2dType as A, AcDb2dPolyline as W, AcDbPoly3dType as y, AcDb3dPolyline as H, AcDbHatch as X, AcGePolyline2d as G, AcGeLine2d as U, AcGeCircArc2d as Y, AcGeVector2d as _, AcGeEllipseArc2d as Z, AcGeSpline3d as E, AcGeLoop2d as M, AcDbHatchObjectType as K, AcDbTable as q, AcDbText as J, AcDbMText as Q, AcDbLeader as $, AcDbAlignedDimension as ee, AcDbRotatedDimension as ne, AcDb3PointAngularDimension as oe, AcDbOrdinateDimension as te, AcDbRadialDimension as se, AcDbDiametricDimension as re, AcDbRasterImage as ie, AcDbWipeout as ce, AcDbViewport as ae, AcDbRay as le, AcDbXline as de, AcDbAttributeFlags as I, AcDbAttributeMTextFlag as C, AcDbAttribute as pe, AcDbAttributeDefinition as fe, AcDbBlockReference as ue, AcCmTransparency as ge, AcDbDatabaseConverter as he, createWorkerApi as De, AcDbLinetypeTableRecord as Ae, AcDbTextStyleTableRecord as Ie, DEFAULT_TEXT_STYLE as L, AcDbDimStyleTableRecord as ye, AcCmColor as we, AcDbLayerTableRecord as Te, AcDbViewportTableRecord as be, AcDbBlockTableRecord as Pe, AcDbBatchProcessing as Ee, ByLayer as Me, AcDbLayout as Ce, AcDbRasterImageDef as Le } from "@mlightcad/data-model";
2
+ class S {
3
3
  convert(e) {
4
4
  const n = this.createEntity(e);
5
5
  return n && this.processCommonAttrs(e, n), n;
@@ -8,48 +8,50 @@ class C {
8
8
  return e.type == "3DFACE" ? this.convertFace(e) : e.type == "ARC" ? this.convertArc(e) : e.type == "ATTDEF" ? this.convertAttributeDefinition(e) : e.type == "CIRCLE" ? this.convertCirle(e) : e.type == "DIMENSION" ? this.convertDimension(e) : e.type == "ELLIPSE" ? this.convertEllipse(e) : e.type == "HATCH" ? this.convertHatch(e) : e.type == "IMAGE" ? this.convertImage(e) : e.type == "LEADER" ? this.convertLeader(e) : e.type == "LINE" ? this.convertLine(e) : e.type == "LWPOLYLINE" ? this.convertLWPolyline(e) : e.type == "MTEXT" ? this.convertMText(e) : e.type == "POINT" ? this.convertPoint(e) : e.type == "POLYLINE2D" ? this.convertPolyline2d(e) : e.type == "POLYLINE3D" ? this.convertPolyline3d(e) : e.type == "RAY" ? this.convertRay(e) : e.type == "SPLINE" ? this.convertSpline(e) : e.type == "ACAD_TABLE" ? this.convertTable(e) : e.type == "TEXT" ? this.convertText(e) : e.type == "SOLID" ? this.convertSolid(e) : e.type == "VIEWPORT" ? this.convertViewport(e) : e.type == "WIPEOUT" ? this.convertWipeout(e) : e.type == "XLINE" ? this.convertXline(e) : e.type == "INSERT" ? this.convertBlockReference(e) : null;
9
9
  }
10
10
  convertFace(e) {
11
- const n = new v();
11
+ const n = new O();
12
12
  return e.corner1 && n.setVertexAt(0, e.corner1), e.corner2 && n.setVertexAt(1, e.corner2), e.corner3 && n.setVertexAt(2, e.corner3), e.corner4 && n.setVertexAt(3, e.corner4), n.setEdgeInvisibilities(e.flag), n;
13
13
  }
14
14
  convertArc(e) {
15
- return new O(
16
- e.center,
15
+ const n = e.extrusionDirection ?? D.Z_AXIS;
16
+ return new m(
17
+ w(e.center, n),
17
18
  e.radius,
18
19
  e.startAngle,
19
20
  e.endAngle,
20
- e.extrusionDirection ?? D.Z_AXIS
21
+ n
21
22
  );
22
23
  }
23
24
  convertCirle(e) {
24
- return new m(
25
- e.center,
25
+ const n = e.extrusionDirection ?? D.Z_AXIS;
26
+ return new k(
27
+ w(e.center, n),
26
28
  e.radius,
27
- e.extrusionDirection ?? D.Z_AXIS
29
+ n
28
30
  );
29
31
  }
30
32
  convertEllipse(e) {
31
- const n = new D(e.majorAxisEndPoint), t = n.length();
32
- return new k(
33
+ const n = new D(e.majorAxisEndPoint), s = n.length();
34
+ return new R(
33
35
  e.center,
34
36
  e.extrusionDirection ?? D.Z_AXIS,
35
37
  n,
36
- t,
37
- t * e.axisRatio,
38
+ s,
39
+ s * e.axisRatio,
38
40
  e.startAngle,
39
41
  e.endAngle
40
42
  );
41
43
  }
42
44
  convertLine(e) {
43
- const n = e.startPoint, t = e.endPoint;
44
- return new R(
45
- new w(n.x, n.y, n.z),
46
- new w(t.x, t.y, t.z)
45
+ const n = e.startPoint, s = e.endPoint;
46
+ return new F(
47
+ new T(n.x, n.y, n.z),
48
+ new T(s.x, s.y, s.z)
47
49
  );
48
50
  }
49
51
  convertSpline(e) {
50
52
  try {
51
53
  if (e.numberOfControlPoints > 0 && e.numberOfKnots > 0)
52
- return new T(
54
+ return new b(
53
55
  e.controlPoints,
54
56
  e.knots,
55
57
  e.weights,
@@ -57,7 +59,7 @@ class C {
57
59
  !!(e.flag & 1)
58
60
  );
59
61
  if (e.numberOfFitPoints > 0)
60
- return new T(
62
+ return new b(
61
63
  e.fitPoints,
62
64
  "Uniform",
63
65
  e.degree,
@@ -68,32 +70,32 @@ class C {
68
70
  return null;
69
71
  }
70
72
  convertPoint(e) {
71
- const n = new F();
73
+ const n = new V();
72
74
  return n.position = e.position, n;
73
75
  }
74
76
  convertSolid(e) {
75
- const n = new V();
77
+ const n = new N();
76
78
  return n.setPointAt(0, { ...e.corner1, z: 0 }), n.setPointAt(1, { ...e.corner2, z: 0 }), n.setPointAt(2, { ...e.corner3, z: 0 }), n.setPointAt(
77
79
  3,
78
80
  e.corner4 ? { ...e.corner4, z: 0 } : { ...e.corner3, z: 0 }
79
81
  ), n.thickness = e.thickness, n;
80
82
  }
81
83
  convertLWPolyline(e) {
82
- const n = new N();
84
+ const n = new B();
83
85
  n.closed = !!(e.flag & 512);
84
- const t = e.constantWidth ?? -1;
85
- return e.vertices.forEach((o, s) => {
86
+ const s = e.constantWidth ?? -1;
87
+ return e.vertices.forEach((o, t) => {
86
88
  n.addVertexAt(
87
- s,
88
- new b(o.x, o.y),
89
+ t,
90
+ new P(o.x, o.y),
89
91
  o.bulge,
90
- o.startWidth ?? t,
91
- o.endWidth ?? t
92
+ o.startWidth ?? s,
93
+ o.endWidth ?? s
92
94
  );
93
95
  }), n;
94
96
  }
95
97
  convertPolyline2d(e) {
96
- const n = !!(e.flag & 1), t = !!(e.flag & 16), o = !!(e.flag & 64), s = !!(e.flag & 32), r = [], a = [], c = [];
98
+ const n = !!(e.flag & 1), s = !!(e.flag & 16), o = !!(e.flag & 64), t = !!(e.flag & 32), r = [], l = [], c = [];
97
99
  if (e.vertices.map((i) => {
98
100
  if (!(i.flag & 16))
99
101
  if (o && i.flag & 128)
@@ -102,7 +104,7 @@ class C {
102
104
  x: i.x,
103
105
  y: i.y,
104
106
  z: i.z
105
- }), a.push(i.bulge ?? 0);
107
+ }), l.push(i.bulge ?? 0);
106
108
  else {
107
109
  const d = [];
108
110
  i.polyfaceIndex0 != null && i.polyfaceIndex0 != 0 && d.push(Math.abs(i.polyfaceIndex0) - 1), i.polyfaceIndex1 != null && i.polyfaceIndex1 != 0 && d.push(Math.abs(i.polyfaceIndex1) - 1), i.polyfaceIndex2 != null && i.polyfaceIndex2 != 0 && d.push(Math.abs(i.polyfaceIndex2) - 1), i.polyfaceIndex3 != null && i.polyfaceIndex3 != 0 && d.push(Math.abs(i.polyfaceIndex3) - 1), d.length >= 3 && c.push(d);
@@ -112,53 +114,53 @@ class C {
112
114
  x: i.x,
113
115
  y: i.y,
114
116
  z: i.z
115
- }), a.push(i.bulge ?? 0);
116
- }), t) {
117
+ }), l.push(i.bulge ?? 0);
118
+ }), s) {
117
119
  const i = e.meshMVertexCount ?? 2, d = e.meshNVertexCount ?? 2;
118
- return new B(i, d, r, n, s);
120
+ return new z(i, d, r, n, t);
119
121
  } else {
120
122
  if (o)
121
- return new z(r, c);
123
+ return new j(r, c);
122
124
  {
123
125
  let i = A.SimplePoly;
124
- return e.flag & 2 ? i = A.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? i = A.CubicSplinePoly : e.smoothType == 5 && (i = A.QuadSplinePoly)), new j(
126
+ return e.flag & 2 ? i = A.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? i = A.CubicSplinePoly : e.smoothType == 5 && (i = A.QuadSplinePoly)), new W(
125
127
  i,
126
128
  r,
127
129
  0,
128
130
  n,
129
131
  e.startWidth,
130
132
  e.endWidth,
131
- a
133
+ l
132
134
  );
133
135
  }
134
136
  }
135
137
  }
136
138
  convertPolyline3d(e) {
137
- const n = !!(e.flag & 1), t = [];
138
- e.vertices.map((s) => {
139
- s.flag & 16 || t.push({
140
- x: s.x,
141
- y: s.y,
142
- z: s.z
139
+ const n = !!(e.flag & 1), s = [];
140
+ e.vertices.map((t) => {
141
+ t.flag & 16 || s.push({
142
+ x: t.x,
143
+ y: t.y,
144
+ z: t.z
143
145
  });
144
146
  });
145
147
  let o = y.SimplePoly;
146
- return e.flag & 4 && (e.smoothType == 6 ? o = y.CubicSplinePoly : e.smoothType == 5 && (o = y.QuadSplinePoly)), new W(o, t, n);
148
+ return e.flag & 4 && (e.smoothType == 6 ? o = y.CubicSplinePoly : e.smoothType == 5 && (o = y.QuadSplinePoly)), new H(o, s, n);
147
149
  }
148
150
  convertHatch(e) {
149
151
  var o;
150
- const n = new H();
151
- return (o = e.definitionLines) == null || o.forEach((s) => {
152
+ const n = new X();
153
+ if ((o = e.definitionLines) == null || o.forEach((t) => {
152
154
  n.definitionLines.push({
153
- angle: s.angle,
154
- base: s.base,
155
- offset: s.offset,
156
- dashLengths: s.numberOfDashLengths > 0 ? s.dashLengths : []
155
+ angle: t.angle,
156
+ base: t.base,
157
+ offset: t.offset,
158
+ dashLengths: t.numberOfDashLengths > 0 ? t.dashLengths : []
157
159
  });
158
- }), n.isSolidFill = e.solidFill == 1, n.hatchStyle = e.hatchStyle, n.patternName = e.patternName, n.patternType = e.patternType, n.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, n.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((s) => {
159
- if (s.boundaryPathTypeFlag & 2) {
160
- const a = s, c = new X();
161
- c.closed = a.isClosed, a.vertices.forEach((i, d) => {
160
+ }), n.isSolidFill = e.solidFill == 1, n.hatchStyle = e.hatchStyle, n.patternName = e.patternName, n.patternType = e.patternType, n.patternAngle = e.patternAngle == null ? 0 : e.patternAngle, n.patternScale = e.patternScale == null ? 0 : e.patternScale, e.boundaryPaths.forEach((t) => {
161
+ if (t.boundaryPathTypeFlag & 2) {
162
+ const l = t, c = new G();
163
+ c.closed = l.isClosed, l.vertices.forEach((i, d) => {
162
164
  c.addVertexAt(d, {
163
165
  x: i.x,
164
166
  y: i.y,
@@ -166,162 +168,169 @@ class C {
166
168
  });
167
169
  }), n.add(c);
168
170
  } else {
169
- const a = s, c = [];
170
- a.edges.forEach((d) => {
171
+ const l = t, c = [];
172
+ l.edges.forEach((d) => {
171
173
  if (d != null) {
172
174
  if (d.type == 1) {
173
- const l = d;
174
- c.push(new U(l.start, l.end));
175
+ const a = d;
176
+ c.push(new U(a.start, a.end));
175
177
  } else if (d.type == 2) {
176
- const l = d;
178
+ const a = d;
177
179
  c.push(
178
- new G(
179
- l.center,
180
- l.radius,
181
- l.startAngle,
182
- l.endAngle,
183
- !l.isCCW
180
+ new Y(
181
+ a.center,
182
+ a.radius,
183
+ a.startAngle,
184
+ a.endAngle,
185
+ !a.isCCW
184
186
  )
185
187
  );
186
188
  } else if (d.type == 3) {
187
- const l = d;
188
- new Y().subVectors(l.end, l.center);
189
+ const a = d;
190
+ new _().subVectors(a.end, a.center);
189
191
  const p = Math.sqrt(
190
- Math.pow(l.end.x, 2) + Math.pow(l.end.y, 2)
191
- ), u = p * l.lengthOfMinorAxis;
192
- let f = l.startAngle, g = l.endAngle;
193
- const x = Math.atan2(l.end.y, l.end.x);
194
- l.isCCW || (f = Math.PI * 2 - f, g = Math.PI * 2 - g), c.push(
195
- new _(
196
- { ...l.center, z: 0 },
192
+ Math.pow(a.end.x, 2) + Math.pow(a.end.y, 2)
193
+ ), f = p * a.lengthOfMinorAxis;
194
+ let u = a.startAngle, h = a.endAngle;
195
+ const v = Math.atan2(a.end.y, a.end.x);
196
+ a.isCCW || (u = Math.PI * 2 - u, h = Math.PI * 2 - h), c.push(
197
+ new Z(
198
+ { ...a.center, z: 0 },
197
199
  p,
198
- u,
199
200
  f,
200
- g,
201
- !l.isCCW,
202
- x
201
+ u,
202
+ h,
203
+ !a.isCCW,
204
+ v
203
205
  )
204
206
  );
205
207
  } else if (d.type == 4) {
206
- const l = d;
207
- if (l.numberOfControlPoints > 0 && l.numberOfKnots > 0) {
208
- const h = l.controlPoints.map(
209
- (f) => ({
210
- x: f.x,
211
- y: f.y,
208
+ const a = d;
209
+ if (a.numberOfControlPoints > 0 && a.numberOfKnots > 0) {
210
+ const g = a.controlPoints.map(
211
+ (u) => ({
212
+ x: u.x,
213
+ y: u.y,
212
214
  z: 0
213
215
  })
214
216
  );
215
217
  let p = !0;
216
- const u = l.controlPoints.map((f) => (f.weight == null && (p = !1), f.weight || 1));
218
+ const f = a.controlPoints.map((u) => (u.weight == null && (p = !1), u.weight || 1));
217
219
  c.push(
218
- new P(
219
- h,
220
- l.knots,
221
- p ? u : void 0
220
+ new E(
221
+ g,
222
+ a.knots,
223
+ p ? f : void 0
222
224
  )
223
225
  );
224
- } else if (l.numberOfFitData > 0) {
225
- const h = l.fitDatum.map((p) => ({
226
+ } else if (a.numberOfFitData > 0) {
227
+ const g = a.fitDatum.map((p) => ({
226
228
  x: p.x,
227
229
  y: p.y,
228
230
  z: 0
229
231
  }));
230
- c.push(new P(h, "Uniform"));
232
+ c.push(new E(g, "Uniform"));
231
233
  }
232
234
  }
233
235
  }
234
236
  });
235
- const i = E.buildFromEdges(c);
236
- i.length == 0 && c.length > 0 ? n.add(new E(c)) : i.forEach((d) => n.add(d));
237
+ const i = M.buildFromEdges(c);
238
+ i.length == 0 && c.length > 0 ? n.add(new M(c)) : i.forEach((d) => n.add(d));
237
239
  }
238
- }), n;
240
+ }), e.gradientFlag) {
241
+ const t = e;
242
+ if (n.hatchObjectType = K.GradientObject, n.gradientName = t.gradientName, n.gradientAngle = t.gradientRotation ?? 0, n.gradientShift = t.gradientDefinition ?? 0, n.gradientOneColorMode = t.gradientColorFlag == 1, n.shadeTintValue = t.colorTint ?? 0, t.gradientColors) {
243
+ const r = t.gradientColors.length;
244
+ r > 1 ? (n.gradientStartColor = t.gradientColors[0].rgb, n.gradientEndColor = t.gradientColors[1].rgb) : r > 0 && (n.gradientStartColor = t.gradientColors[0].rgb);
245
+ }
246
+ }
247
+ return n;
239
248
  }
240
249
  convertTable(e) {
241
- const n = new Z(
250
+ const n = new q(
242
251
  e.name,
243
252
  e.rowCount,
244
253
  e.columnCount
245
254
  );
246
255
  return n.tableStyleId = e.tableStyleId, n.owningBlockRecordId = e.blockRecordHandle, e.directionVector && (n.horizontalDirection = new D(e.directionVector)), n.attachmentPoint = e.attachmentPoint, n.position.copy(e.startPoint), n.tableValueFlag = e.tableValue, n.tableOverrideFlag = e.overrideFlag, n.borderColorOverrideFlag = e.borderColorOverrideFlag, n.borderLineweightOverrideFlag = e.borderLineWeightOverrideFlag, n.borderVisibilityOverrideFlag = e.borderVisibilityOverrideFlag, e.columnWidthArr.forEach(
247
- (t, o) => n.setColumnWidth(o, t)
256
+ (s, o) => n.setColumnWidth(o, s)
248
257
  ), e.rowHeightArr.forEach(
249
- (t, o) => n.setRowHeight(o, t)
250
- ), e.cells.forEach((t, o) => {
251
- n.setCell(o, t);
258
+ (s, o) => n.setRowHeight(o, s)
259
+ ), e.cells.forEach((s, o) => {
260
+ n.setCell(o, s);
252
261
  }), n;
253
262
  }
254
263
  convertText(e) {
255
- const n = new K();
264
+ const n = new J();
256
265
  return n.textString = e.text, n.styleName = e.styleName, n.height = e.textHeight, n.position.copy(e.startPoint), n.rotation = e.rotation, n.oblique = e.obliqueAngle ?? 0, n.thickness = e.thickness, n.horizontalMode = e.halign, n.verticalMode = e.valign, n.widthFactor = e.xScale ?? 1, n;
257
266
  }
258
267
  convertMText(e) {
259
- const n = new q();
268
+ const n = new Q();
260
269
  return n.contents = e.text, e.styleName != null && (n.styleName = e.styleName), n.height = e.textHeight, n.width = e.rectWidth, n.rotation = e.rotation || 0, n.location = e.insertionPoint, n.attachmentPoint = e.attachmentPoint, e.direction && (n.direction = new D(e.direction)), n.drawingDirection = e.drawingDirection, n;
261
270
  }
262
271
  convertLeader(e) {
263
- const n = new J();
264
- return e.vertices.forEach((t) => {
265
- n.appendVertex(t);
272
+ const n = new $();
273
+ return e.vertices.forEach((s) => {
274
+ n.appendVertex(s);
266
275
  }), n.hasArrowHead = e.isArrowheadEnabled, n.hasHookLine = e.isHooklineExists, n.isSplined = e.isSpline, n.dimensionStyle = e.styleName, n.annoType = e.leaderCreationFlag, n;
267
276
  }
268
277
  convertDimension(e) {
269
278
  if (e.subclassMarker == "AcDbAlignedDimension") {
270
- const n = e, t = new Q(
279
+ const n = e, s = new ee(
271
280
  n.subDefinitionPoint1,
272
281
  n.subDefinitionPoint2,
273
282
  n.definitionPoint
274
283
  );
275
- return n.insertionPoint && (t.dimBlockPosition = {
284
+ return n.insertionPoint && (s.dimBlockPosition = {
276
285
  x: n.insertionPoint.x,
277
286
  y: n.insertionPoint.y,
278
287
  z: 0
279
- }), t.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, t), t;
288
+ }), s.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, s), s;
280
289
  } else if (e.subclassMarker == "AcDbRotatedDimension") {
281
- const n = e, t = new $(
290
+ const n = e, s = new ne(
282
291
  n.subDefinitionPoint1,
283
292
  n.subDefinitionPoint2,
284
293
  n.definitionPoint
285
294
  );
286
- return n.insertionPoint && (t.dimBlockPosition = {
295
+ return n.insertionPoint && (s.dimBlockPosition = {
287
296
  x: n.insertionPoint.x,
288
297
  y: n.insertionPoint.y,
289
298
  z: 0
290
- }), t.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, t), t;
299
+ }), s.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, s), s;
291
300
  } else if (e.subclassMarker == "AcDb3PointAngularDimension") {
292
- const n = e, t = new ee(
301
+ const n = e, s = new oe(
293
302
  n.centerPoint,
294
303
  n.subDefinitionPoint1,
295
304
  n.subDefinitionPoint2,
296
305
  n.definitionPoint
297
306
  );
298
- return this.processDimensionCommonAttrs(e, t), t;
307
+ return this.processDimensionCommonAttrs(e, s), s;
299
308
  } else if (e.subclassMarker == "AcDbOrdinateDimension") {
300
- const n = e, t = new ne(
309
+ const n = e, s = new te(
301
310
  n.subDefinitionPoint1,
302
311
  n.subDefinitionPoint2
303
312
  );
304
- return this.processDimensionCommonAttrs(e, t), t;
313
+ return this.processDimensionCommonAttrs(e, s), s;
305
314
  } else if (e.subclassMarker == "AcDbRadialDimension") {
306
- const n = e, t = new oe(
315
+ const n = e, s = new se(
307
316
  n.definitionPoint,
308
317
  n.centerPoint,
309
318
  n.leaderLength
310
319
  );
311
- return this.processDimensionCommonAttrs(e, t), t;
320
+ return this.processDimensionCommonAttrs(e, s), s;
312
321
  } else if (e.subclassMarker == "AcDbDiametricDimension") {
313
- const n = e, t = new te(
322
+ const n = e, s = new re(
314
323
  n.definitionPoint,
315
324
  n.centerPoint,
316
325
  n.leaderLength
317
326
  );
318
- return this.processDimensionCommonAttrs(e, t), t;
327
+ return this.processDimensionCommonAttrs(e, s), s;
319
328
  }
320
329
  return null;
321
330
  }
322
331
  processImage(e, n) {
323
- n.position.copy(e.position), n.brightness = e.brightness, n.contrast = e.contrast, n.fade = e.fade, n.imageSize.copy(e.imageSize), n.imageDefId = e.imageDefHandle, n.isClipped = e.clipping > 0, n.isShownClipped = (e.flags | 4) > 0, n.isImageShown = (e.flags | 3) > 0, n.isImageTransparent = (e.flags | 8) > 0, e.clippingBoundaryPath.forEach((t) => {
324
- n.clipBoundary.push(new b(t));
332
+ n.position.copy(e.position), n.brightness = e.brightness, n.contrast = e.contrast, n.fade = e.fade, n.imageSize.copy(e.imageSize), n.imageDefId = e.imageDefHandle, n.isClipped = e.clipping > 0, n.isShownClipped = (e.flags | 4) > 0, n.isImageShown = (e.flags | 3) > 0, n.isImageTransparent = (e.flags | 8) > 0, e.clippingBoundaryPath.forEach((s) => {
333
+ n.clipBoundary.push(new P(s));
325
334
  }), n.clipBoundaryType = e.clippingBoundaryType, n.width = Math.sqrt(
326
335
  e.uPixel.x ** 2 + e.uPixel.y ** 2 + e.uPixel.z ** 2
327
336
  ) * e.imageSize.x, n.height = Math.sqrt(
@@ -329,41 +338,41 @@ class C {
329
338
  ) * e.imageSize.y, n.rotation = Math.atan2(e.uPixel.y, e.uPixel.x);
330
339
  }
331
340
  convertImage(e) {
332
- const n = new se();
341
+ const n = new ie();
333
342
  return this.processImage(e, n), n;
334
343
  }
335
344
  convertWipeout(e) {
336
- const n = new re();
345
+ const n = new ce();
337
346
  return this.processImage(e, n), n;
338
347
  }
339
348
  convertViewport(e) {
340
- const n = new ie();
349
+ const n = new ae();
341
350
  return n.number = e.viewportId, n.centerPoint.copy(e.viewportCenter), n.height = e.height, n.width = e.width, n.viewCenter.copy(e.displayCenter), n.viewHeight = e.viewHeight, n;
342
351
  }
343
352
  convertRay(e) {
344
- const n = new ce();
353
+ const n = new le();
345
354
  return n.basePoint.copy(e.firstPoint), n.unitDir.copy(e.unitDirection), n;
346
355
  }
347
356
  convertXline(e) {
348
- const n = new le();
357
+ const n = new de();
349
358
  return n.basePoint.copy(e.firstPoint), n.unitDir.copy(e.unitDirection), n;
350
359
  }
351
360
  convertAttributeCommon(e, n) {
352
- const t = e.text;
353
- n.textString = t.text, n.styleName = t.styleName, n.height = t.textHeight, n.position.copy(t.startPoint), n.rotation = t.rotation, n.oblique = t.obliqueAngle ?? 0, n.thickness = t.thickness, n.horizontalMode = t.halign, n.verticalMode = t.valign, n.widthFactor = t.xScale ?? 1, n.tag = e.tag, n.fieldLength = e.fieldLength, n.isInvisible = (e.flags & I.Invisible) !== 0, n.isConst = (e.flags & I.Const) !== 0, n.isVerifiable = (e.flags & I.Verifiable) !== 0, n.isPreset = (e.flags & I.Preset) !== 0, n.lockPositionInBlock = e.lockPositionFlag, n.isReallyLocked = e.isReallyLocked, n.isMTextAttribute = (e.mtextFlag & M.MultiLine) !== 0, n.isConstMTextAttribute = (e.mtextFlag & M.ConstMultiLine) !== 0;
361
+ const s = e.text;
362
+ n.textString = s.text, n.styleName = s.styleName, n.height = s.textHeight, n.position.copy(s.startPoint), n.rotation = s.rotation, n.oblique = s.obliqueAngle ?? 0, n.thickness = s.thickness, n.horizontalMode = s.halign, n.verticalMode = s.valign, n.widthFactor = s.xScale ?? 1, n.tag = e.tag, n.fieldLength = e.fieldLength, n.isInvisible = (e.flags & I.Invisible) !== 0, n.isConst = (e.flags & I.Const) !== 0, n.isVerifiable = (e.flags & I.Verifiable) !== 0, n.isPreset = (e.flags & I.Preset) !== 0, n.lockPositionInBlock = e.lockPositionFlag, n.isReallyLocked = e.isReallyLocked, n.isMTextAttribute = (e.mtextFlag & C.MultiLine) !== 0, n.isConstMTextAttribute = (e.mtextFlag & C.ConstMultiLine) !== 0;
354
363
  }
355
364
  convertAttribute(e) {
356
- const n = new ae();
365
+ const n = new pe();
357
366
  return this.convertAttributeCommon(e, n), n;
358
367
  }
359
368
  convertAttributeDefinition(e) {
360
- const n = new de();
369
+ const n = new fe();
361
370
  return this.convertAttributeCommon(e, n), n.prompt = e.prompt, n;
362
371
  }
363
372
  convertBlockReference(e) {
364
- const n = new pe(e.name);
365
- return e.insertionPoint && n.position.copy(e.insertionPoint), n.scaleFactors.x = e.xScale, n.scaleFactors.y = e.yScale, n.scaleFactors.z = e.zScale, n.rotation = e.rotation, n.normal.copy(e.extrusionDirection), e.attribs && e.attribs.forEach((t) => {
366
- const o = this.convertAttribute(t);
373
+ const n = new ue(e.name);
374
+ return e.insertionPoint && n.position.copy(e.insertionPoint), n.scaleFactors.x = e.xScale, n.scaleFactors.y = e.yScale, n.scaleFactors.z = e.zScale, n.rotation = e.rotation, n.normal.copy(e.extrusionDirection), e.attribs && e.attribs.forEach((s) => {
375
+ const o = this.convertAttribute(s);
367
376
  n.appendAttributes(o);
368
377
  }), n;
369
378
  }
@@ -371,26 +380,26 @@ class C {
371
380
  n.dimBlockId = e.name, n.textPosition.copy(e.textPoint), n.textRotation = e.textRotation || 0, e.textLineSpacingFactor && (n.textLineSpacingFactor = e.textLineSpacingFactor), e.textLineSpacingStyle && (n.textLineSpacingStyle = e.textLineSpacingStyle), n.dimensionStyleName = e.styleName, n.dimensionText = e.text || "", n.measurement = e.measurement;
372
381
  }
373
382
  processCommonAttrs(e, n) {
374
- if (n.layer = e.layer || "0", n.objectId = e.handle, n.ownerId = e.ownerBlockRecordSoftId, e.lineType != null && (n.lineType = e.lineType), e.lineweight != null && (n.lineWeight = e.lineweight), e.lineTypeScale != null && (n.linetypeScale = e.lineTypeScale), e.color != null && n.color.setRGBValue(e.color), e.colorIndex != null && (e.color == null || e.colorIndex === 7) && (n.color.colorIndex = e.colorIndex), e.colorName && (n.color.colorName = e.colorName), e.isVisible != null && (n.visibility = e.isVisible), e.transparency != null) {
375
- const t = new ue();
376
- t.method = e.transparencyType, (t.isByBlock || t.isByBlock) && (t.alpha = e.transparency), n.transparency = t;
383
+ if (n.layer = e.layer || "0", n.objectId = e.handle, e.ownerBlockRecordSoftId != null && (n.ownerId = e.ownerBlockRecordSoftId), e.lineType != null && (n.lineType = e.lineType), e.lineweight != null && (n.lineWeight = e.lineweight), e.lineTypeScale != null && (n.linetypeScale = e.lineTypeScale), e.color != null && n.color.setRGBValue(e.color), e.colorIndex != null && (e.color == null || e.colorIndex === 7) && (n.color.colorIndex = e.colorIndex), e.colorName && (n.color.colorName = e.colorName), e.isVisible != null && (n.visibility = e.isVisible), e.transparency != null) {
384
+ const s = new ge();
385
+ s.method = e.transparencyType, (s.isByBlock || s.isByBlock) && (s.alpha = e.transparency), n.transparency = s;
377
386
  }
378
387
  }
379
388
  }
380
- const Le = "*MODEL_SPACE";
381
- class Se extends fe {
389
+ const Se = "*MODEL_SPACE";
390
+ class ve extends he {
382
391
  constructor(e = {}) {
383
392
  super(e), e.useWorker = !0, e.parserWorkerUrl || (e.parserWorkerUrl = "/assets/libredwg-parser-worker.js");
384
393
  }
385
394
  async parse(e, n) {
386
- const t = this.config, o = this.getParserWorkerTimeout(e, n);
387
- if (t.useWorker && t.parserWorkerUrl) {
388
- const s = he({
389
- workerUrl: t.parserWorkerUrl,
395
+ const s = this.config, o = this.getParserWorkerTimeout(e, n);
396
+ if (s.useWorker && s.parserWorkerUrl) {
397
+ const t = De({
398
+ workerUrl: s.parserWorkerUrl,
390
399
  timeout: o,
391
400
  maxConcurrentWorkers: 1
392
- }), r = await s.execute(e);
393
- if (s.destroy(), r.success)
401
+ }), r = await t.execute(e);
402
+ if (t.destroy(), r.success)
394
403
  return r.data;
395
404
  throw new Error(
396
405
  `Failed to parse drawing due to error: '${r.error}'`
@@ -403,60 +412,60 @@ class Se extends fe {
403
412
  e.tables.BLOCK_RECORD.entries.forEach((r) => {
404
413
  n.set(r.name, r);
405
414
  });
406
- const t = /* @__PURE__ */ new Map(), o = (r) => {
415
+ const s = /* @__PURE__ */ new Map(), o = (r) => {
407
416
  if (r) {
408
- const a = r.lastIndexOf(".");
409
- return a >= 0 ? r.substring(0, a).toLowerCase() : r.toLowerCase();
417
+ const l = r.lastIndexOf(".");
418
+ return l >= 0 ? r.substring(0, l).toLowerCase() : r.toLowerCase();
410
419
  }
411
420
  };
412
421
  e.tables.STYLE.entries.forEach((r) => {
413
- const a = [];
422
+ const l = [];
414
423
  let c = o(r.font);
415
- c && a.push(c), c = o(r.bigFont), c && a.push(c), t.set(r.name, a);
424
+ c && l.push(c), c = o(r.bigFont), c && l.push(c), s.set(r.name, l);
416
425
  });
417
- const s = /* @__PURE__ */ new Set();
418
- return this.getFontsInBlock(e.entities, n, t, s), Array.from(s);
426
+ const t = /* @__PURE__ */ new Set();
427
+ return this.getFontsInBlock(e.entities, n, s, t), Array.from(t);
419
428
  }
420
- getFontsInBlock(e, n, t, o) {
421
- const s = /\\f(.*?)\|/g;
429
+ getFontsInBlock(e, n, s, o) {
430
+ const t = /\\f(.*?)\|/g;
422
431
  e.forEach((r) => {
423
432
  if (r.type == "MTEXT") {
424
- const a = r;
425
- [...a.text.matchAll(s)].forEach((i) => {
433
+ const l = r;
434
+ [...l.text.matchAll(t)].forEach((i) => {
426
435
  o.add(i[1].toLowerCase());
427
436
  });
428
- const c = t.get(a.styleName);
437
+ const c = s.get(l.styleName);
429
438
  c == null || c.forEach((i) => o.add(i));
430
439
  } else if (r.type == "TEXT") {
431
- const a = r, c = t.get(a.styleName);
440
+ const l = r, c = s.get(l.styleName);
432
441
  c == null || c.forEach((i) => o.add(i));
433
442
  } else if (r.type == "INSERT") {
434
- const a = r, c = n.get(a.name);
435
- c && this.getFontsInBlock(c.entities, n, t, o);
443
+ const l = r, c = n.get(l.name);
444
+ c && this.getFontsInBlock(c.entities, n, s, o);
436
445
  }
437
446
  });
438
447
  }
439
448
  processLineTypes(e, n) {
440
449
  e.tables.LTYPE.entries.forEach((o) => {
441
- const s = {
450
+ const t = {
442
451
  name: o.name,
443
452
  description: o.description,
444
453
  standardFlag: o.standardFlag,
445
454
  totalPatternLength: o.totalPatternLength,
446
455
  pattern: o.pattern
447
- }, r = new ge(s);
456
+ }, r = new Ae(t);
448
457
  this.processCommonTableEntryAttrs(o, r), r.name = o.name, n.tables.linetypeTable.add(r);
449
458
  });
450
459
  }
451
460
  processTextStyles(e, n) {
452
461
  e.tables.STYLE.entries.forEach((o) => {
453
- const s = new De(o);
454
- this.processCommonTableEntryAttrs(o, s), n.tables.textStyleTable.add(s);
462
+ const t = new Ie(o);
463
+ this.processCommonTableEntryAttrs(o, t), n.tables.textStyleTable.add(t);
455
464
  });
456
465
  }
457
466
  processDimStyles(e, n) {
458
467
  e.tables.DIMSTYLE.entries.forEach((o) => {
459
- const s = {
468
+ const t = {
460
469
  name: o.name,
461
470
  ownerId: o.ownerHandle,
462
471
  dimpost: o.DIMPOST || "",
@@ -525,21 +534,21 @@ class Se extends fe {
525
534
  dimblk2: o.DIMBLK2 || "",
526
535
  dimlwd: o.DIMLWD,
527
536
  dimlwe: o.DIMLWE
528
- }, r = new Ae(s);
537
+ }, r = new ye(t);
529
538
  this.processCommonTableEntryAttrs(o, r), n.tables.dimStyleTable.add(r);
530
539
  });
531
540
  }
532
541
  processLayers(e, n) {
533
542
  e.tables.LAYER.entries.forEach((o) => {
534
- const s = new Ie();
535
- s.colorIndex = o.colorIndex;
536
- const r = new ye({
543
+ const t = new we();
544
+ t.colorIndex = o.colorIndex;
545
+ const r = new Te({
537
546
  name: o.name,
538
547
  standardFlags: o.standardFlag,
539
548
  linetype: o.lineType,
540
549
  lineWeight: o.lineweight,
541
550
  isOff: o.off,
542
- color: s,
551
+ color: t,
543
552
  isPlottable: o.plotFlag != 0
544
553
  });
545
554
  this.processCommonTableEntryAttrs(o, r), n.tables.layerTable.add(r);
@@ -547,96 +556,96 @@ class Se extends fe {
547
556
  }
548
557
  processViewports(e, n) {
549
558
  e.tables.VPORT.entries.forEach((o) => {
550
- const s = new we();
551
- this.processCommonTableEntryAttrs(o, s), o.circleSides && (s.circleSides = o.circleSides), s.standardFlag = o.standardFlag, s.center.copy(o.center), s.lowerLeftCorner.copy(o.lowerLeftCorner), s.upperRightCorner.copy(o.upperRightCorner), o.snapBasePoint && s.snapBase.copy(o.snapBasePoint), o.snapRotationAngle && (s.snapAngle = o.snapRotationAngle), o.snapSpacing && s.snapIncrements.copy(o.snapSpacing), o.majorGridLines && (s.gridMajor = o.majorGridLines), o.gridSpacing && s.gridIncrements.copy(o.gridSpacing), o.backgroundObjectId && (s.backgroundObjectId = o.backgroundObjectId), s.gsView.center.copy(o.center), s.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget), s.gsView.viewTarget.copy(o.viewTarget), o.lensLength && (s.gsView.lensLength = o.lensLength), o.frontClippingPlane && (s.gsView.frontClippingPlane = o.frontClippingPlane), o.backClippingPlane && (s.gsView.backClippingPlane = o.backClippingPlane), o.viewHeight && (s.gsView.viewHeight = o.viewHeight), o.viewTwistAngle && (s.gsView.viewTwistAngle = o.viewTwistAngle), o.frozenLayers && (s.gsView.frozenLayers = o.frozenLayers), o.styleSheet && (s.gsView.styleSheet = o.styleSheet), o.renderMode && (s.gsView.renderMode = o.renderMode), o.viewMode && (s.gsView.viewMode = o.viewMode), o.ucsIconSetting && (s.gsView.ucsIconSetting = o.ucsIconSetting), o.ucsOrigin && s.gsView.ucsOrigin.copy(o.ucsOrigin), o.ucsXAxis && s.gsView.ucsXAxis.copy(o.ucsXAxis), o.ucsYAxis && s.gsView.ucsYAxis.copy(o.ucsYAxis), o.orthographicType && (s.gsView.orthographicType = o.orthographicType), o.shadePlotSetting && (s.gsView.shadePlotSetting = o.shadePlotSetting), o.shadePlotObjectId && (s.gsView.shadePlotObjectId = o.shadePlotObjectId), o.visualStyleObjectId && (s.gsView.visualStyleObjectId = o.visualStyleObjectId), o.isDefaultLightingOn && (s.gsView.isDefaultLightingOn = o.isDefaultLightingOn), o.defaultLightingType && (s.gsView.defaultLightingType = o.defaultLightingType), o.brightness && (s.gsView.brightness = o.brightness), o.contrast && (s.gsView.contrast = o.contrast), o.ambientColor && (s.gsView.ambientColor = o.ambientColor), n.tables.viewportTable.add(s);
559
+ const t = new be();
560
+ this.processCommonTableEntryAttrs(o, t), o.circleSides && (t.circleSides = o.circleSides), t.standardFlag = o.standardFlag, t.center.copy(o.center), t.lowerLeftCorner.copy(o.lowerLeftCorner), t.upperRightCorner.copy(o.upperRightCorner), o.snapBasePoint && t.snapBase.copy(o.snapBasePoint), o.snapRotationAngle && (t.snapAngle = o.snapRotationAngle), o.snapSpacing && t.snapIncrements.copy(o.snapSpacing), o.majorGridLines && (t.gridMajor = o.majorGridLines), o.gridSpacing && t.gridIncrements.copy(o.gridSpacing), o.backgroundObjectId && (t.backgroundObjectId = o.backgroundObjectId), t.gsView.center.copy(o.center), t.gsView.viewDirectionFromTarget.copy(o.viewDirectionFromTarget), t.gsView.viewTarget.copy(o.viewTarget), o.lensLength && (t.gsView.lensLength = o.lensLength), o.frontClippingPlane && (t.gsView.frontClippingPlane = o.frontClippingPlane), o.backClippingPlane && (t.gsView.backClippingPlane = o.backClippingPlane), o.viewHeight && (t.gsView.viewHeight = o.viewHeight), o.viewTwistAngle && (t.gsView.viewTwistAngle = o.viewTwistAngle), o.frozenLayers && (t.gsView.frozenLayers = o.frozenLayers), o.styleSheet && (t.gsView.styleSheet = o.styleSheet), o.renderMode && (t.gsView.renderMode = o.renderMode), o.viewMode && (t.gsView.viewMode = o.viewMode), o.ucsIconSetting && (t.gsView.ucsIconSetting = o.ucsIconSetting), o.ucsOrigin && t.gsView.ucsOrigin.copy(o.ucsOrigin), o.ucsXAxis && t.gsView.ucsXAxis.copy(o.ucsXAxis), o.ucsYAxis && t.gsView.ucsYAxis.copy(o.ucsYAxis), o.orthographicType && (t.gsView.orthographicType = o.orthographicType), o.shadePlotSetting && (t.gsView.shadePlotSetting = o.shadePlotSetting), o.shadePlotObjectId && (t.gsView.shadePlotObjectId = o.shadePlotObjectId), o.visualStyleObjectId && (t.gsView.visualStyleObjectId = o.visualStyleObjectId), o.isDefaultLightingOn && (t.gsView.isDefaultLightingOn = o.isDefaultLightingOn), o.defaultLightingType && (t.gsView.defaultLightingType = o.defaultLightingType), o.brightness && (t.gsView.brightness = o.brightness), o.contrast && (t.gsView.contrast = o.contrast), o.ambientColor && (t.gsView.ambientColor = o.ambientColor), n.tables.viewportTable.add(t);
552
561
  });
553
562
  }
554
563
  processBlockTables(e, n) {
555
564
  e.tables.BLOCK_RECORD.entries.forEach((o) => {
556
- let s = n.tables.blockTable.getAt(o.name);
557
- s || (s = new Te(), s.objectId = o.handle, s.name = o.name, s.ownerId = o.ownerHandle, s.origin.copy(o.basePoint), s.layoutId = o.layout, s.blockInsertUnits = o.insertionUnits, s.explodability = o.explodability, s.blockScaling = o.scalability, o.bmpPreview && (s.bmpPreview = o.bmpPreview), n.tables.blockTable.add(s)), !s.isModelSapce && o.entities && o.entities.length > 0 && this.processEntitiesInBlock(o.entities, s);
565
+ let t = n.tables.blockTable.getAt(o.name);
566
+ t || (t = new Pe(), t.objectId = o.handle, t.name = o.name, t.ownerId = o.ownerHandle, t.origin.copy(o.basePoint), t.layoutId = o.layout, t.blockInsertUnits = o.insertionUnits, t.explodability = o.explodability, t.blockScaling = o.scalability, o.bmpPreview && (t.bmpPreview = o.bmpPreview), n.tables.blockTable.add(t)), !t.isModelSapce && o.entities && o.entities.length > 0 && this.processEntitiesInBlock(o.entities, t);
558
567
  });
559
568
  }
560
569
  processBlocks(e, n) {
561
570
  }
562
571
  async processEntitiesInBlock(e, n) {
563
- const t = new C(), o = e.length, s = [];
572
+ const s = new S(), o = e.length, t = [];
564
573
  for (let r = 0; r < o; r++) {
565
- const a = e[r], c = t.convert(a);
566
- c && s.push(c);
574
+ const l = e[r], c = s.convert(l);
575
+ c && t.push(c);
567
576
  }
568
- n.appendEntity(s);
577
+ n.appendEntity(t);
569
578
  }
570
- async processEntities(e, n, t, o, s) {
571
- const r = new C();
572
- let a = [];
573
- e.tables.BLOCK_RECORD.entries.forEach((l) => {
574
- this.isModelSpace(l.name) && (a = l.entities);
579
+ async processEntities(e, n, s, o, t) {
580
+ const r = new S();
581
+ let l = [];
582
+ e.tables.BLOCK_RECORD.entries.forEach((a) => {
583
+ this.isModelSpace(a.name) && (l = a.entities);
575
584
  });
576
- const c = a.length, i = new be(
585
+ const c = l.length, i = new Ee(
577
586
  c,
578
587
  100 - o.value,
579
- t
588
+ s
580
589
  );
581
- this.config.convertByEntityType && (a = this.groupAndFlattenByType(a));
590
+ this.config.convertByEntityType && (l = this.groupAndFlattenByType(l));
582
591
  const d = n.tables.blockTable.modelSpace;
583
- await i.processChunk(async (l, h) => {
592
+ await i.processChunk(async (a, g) => {
584
593
  const p = [];
585
- for (let u = l; u < h; u++) {
586
- const f = a[u], g = r.convert(f);
587
- g && p.push(g);
594
+ for (let f = a; f < g; f++) {
595
+ const u = l[f], h = r.convert(u);
596
+ h && p.push(h);
588
597
  }
589
- if (d.appendEntity(p), s) {
590
- let u = o.value + h / c * (100 - o.value);
591
- u > 100 && (u = 100), await s(u, "ENTITY", "IN-PROGRESS");
598
+ if (d.appendEntity(p), t) {
599
+ let f = o.value + g / c * (100 - o.value);
600
+ f > 100 && (f = 100), await t(f, "ENTITY", "IN-PROGRESS");
592
601
  }
593
602
  });
594
603
  }
595
604
  processHeader(e, n) {
596
- const t = e.header;
597
- t.CECOLOR && (t.CECOLOR.index >= 0 && t.CECOLOR.index <= 256 ? n.cecolor.colorIndex = t.CECOLOR.index : n.cecolor.setRGBValue(t.CECOLOR.rgb)), n.angBase = t.ANGBASE ?? 0, n.angDir = t.ANGDIR ?? 0, n.aunits = t.AUNITS ?? 0, n.celtype = t.CELTYPE ?? Pe, n.celtscale = t.CELTSCALE ?? 1, n.ltscale = t.LTSCALE ?? 1, t.EXTMAX && (n.extmax = t.EXTMAX), t.EXTMIN && (n.extmin = t.EXTMIN), n.insunits = t.INSUNITS ?? 1, n.pdmode = t.PDMODE ?? 0, n.pdsize = t.PDSIZE ?? 0, n.textstyle = t.TEXTSTYLE ?? L;
605
+ const s = e.header;
606
+ s.CECOLOR && (s.CECOLOR.index >= 0 && s.CECOLOR.index <= 256 ? n.cecolor.colorIndex = s.CECOLOR.index : n.cecolor.setRGBValue(s.CECOLOR.rgb)), n.angBase = s.ANGBASE ?? 0, n.angDir = s.ANGDIR ?? 0, n.aunits = s.AUNITS ?? 0, n.celtype = s.CELTYPE ?? Me, n.celtscale = s.CELTSCALE ?? 1, n.ltscale = s.LTSCALE ?? 1, s.EXTMAX && (n.extmax = s.EXTMAX), s.EXTMIN && (n.extmin = s.EXTMIN), n.insunits = s.INSUNITS ?? 1, n.pdmode = s.PDMODE ?? 0, n.pdsize = s.PDSIZE ?? 0, n.textstyle = s.TEXTSTYLE ?? L;
598
607
  }
599
608
  processCommonTableEntryAttrs(e, n) {
600
- n.name = e.name, n.objectId = e.handle, n.ownerId = e.ownerHandle;
609
+ n.name = e.name, n.objectId = e.handle, e.ownerHandle != null && (n.ownerId = e.ownerHandle);
601
610
  }
602
611
  processObjects(e, n) {
603
612
  this.processLayouts(e, n), this.processImageDefs(e, n);
604
613
  }
605
614
  processLayouts(e, n) {
606
- const t = n.objects.layout;
607
- e.objects.LAYOUT.forEach((s) => {
608
- const r = new Ee();
609
- r.layoutName = s.layoutName, r.tabOrder = s.tabOrder;
610
- const a = n.tables.blockTable.newIterator();
611
- r.objectId = s.handle;
612
- for (const c of a)
615
+ const s = n.objects.layout;
616
+ e.objects.LAYOUT.forEach((t) => {
617
+ const r = new Ce();
618
+ r.layoutName = t.layoutName, r.tabOrder = t.tabOrder;
619
+ const l = n.tables.blockTable.newIterator();
620
+ r.objectId = t.handle;
621
+ for (const c of l)
613
622
  if (c.layoutId === r.objectId) {
614
623
  r.blockTableRecordId = c.objectId;
615
624
  break;
616
625
  }
617
- r.blockTableRecordId || s.layoutName === "Model" && (r.blockTableRecordId = n.tables.blockTable.modelSpace.objectId), r.limits.min.copy(s.minLimit), r.limits.max.copy(s.maxLimit), r.extents.min.copy(s.minExtent), r.extents.max.copy(s.maxExtent), s.viewportId && r.viewportArray.push(s.viewportId), this.processCommonObjectAttrs(s, r), t.setAt(r.layoutName, r);
626
+ r.blockTableRecordId || t.layoutName === "Model" && (r.blockTableRecordId = n.tables.blockTable.modelSpace.objectId), r.limits.min.copy(t.minLimit), r.limits.max.copy(t.maxLimit), r.extents.min.copy(t.minExtent), r.extents.max.copy(t.maxExtent), t.viewportId && r.viewportArray.push(t.viewportId), this.processCommonObjectAttrs(t, r), s.setAt(r.layoutName, r);
618
627
  });
619
628
  }
620
629
  processImageDefs(e, n) {
621
- const t = n.objects.imageDefinition;
622
- e.objects.IMAGEDEF.forEach((s) => {
623
- const r = new Me();
624
- r.sourceFileName = s.fileName, this.processCommonObjectAttrs(s, r), t.setAt(r.objectId, r);
630
+ const s = n.objects.imageDefinition;
631
+ e.objects.IMAGEDEF.forEach((t) => {
632
+ const r = new Le();
633
+ r.sourceFileName = t.fileName, this.processCommonObjectAttrs(t, r), s.setAt(r.objectId, r);
625
634
  });
626
635
  }
627
636
  processCommonObjectAttrs(e, n) {
628
- n.objectId = e.handle, n.ownerId = e.ownerHandle;
637
+ n.objectId = e.handle, e.ownerHandle != null && (n.ownerId = e.ownerHandle);
629
638
  }
630
639
  groupAndFlattenByType(e) {
631
- const n = {}, t = [];
640
+ const n = {}, s = [];
632
641
  for (const o of e)
633
- n[o.type] || (n[o.type] = [], t.push(o.type)), n[o.type].push(o);
634
- return t.flatMap((o) => n[o]);
642
+ n[o.type] || (n[o.type] = [], s.push(o.type)), n[o.type].push(o);
643
+ return s.flatMap((o) => n[o]);
635
644
  }
636
645
  isModelSpace(e) {
637
- return e && e.toUpperCase() == Le;
646
+ return e && e.toUpperCase() == Se;
638
647
  }
639
648
  }
640
649
  export {
641
- Se as AcDbLibreDwgConverter
650
+ ve as AcDbLibreDwgConverter
642
651
  };