@mlightcad/libredwg-converter 3.5.12 → 3.5.14

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,4 +1,4 @@
1
- import { AcDbFace as x, AcDbArc as O, AcGeVector3d as D, AcDbCircle as m, AcDbEllipse as k, AcDbLine as F, AcGePoint3d as y, AcDbSpline as T, AcDbPoint as R, AcDbTrace as V, AcDbPolyline as N, AcGePoint2d as b, AcDbPoly2dType as A, AcDb2dPolyline as B, AcDbPoly3dType as w, AcDb3dPolyline as z, AcDbHatch as j, AcGePolyline2d as W, AcGeLine2d as H, AcGeCircArc2d as X, AcGeVector2d as U, AcGeEllipseArc2d as G, AcGeSpline3d as E, AcGeLoop2d as P, AcDbTable as Y, AcDbText as _, AcDbMText as Z, AcDbLeader as K, AcDbAlignedDimension as q, AcDb3PointAngularDimension as J, AcDbOrdinateDimension as Q, AcDbRadialDimension as $, AcDbDiametricDimension as ee, AcDbRasterImage as ne, AcDbWipeout as te, AcDbViewport as oe, AcDbRay as se, AcDbXline as re, AcDbAttributeFlags as I, AcDbAttributeMTextFlag as L, AcDbAttribute as ie, AcDbAttributeDefinition as ce, AcDbBlockReference as le, AcCmTransparency as ae, AcDbDatabaseConverter as de, createWorkerApi as pe, AcDbLinetypeTableRecord as ue, AcDbTextStyleTableRecord as fe, DEFAULT_TEXT_STYLE as M, AcDbDimStyleTableRecord as he, AcCmColor as ge, AcDbLayerTableRecord as De, AcDbViewportTableRecord as Ae, AcDbBlockTableRecord as Ie, AcDbBatchProcessing as we, AcDbLayout as ye, AcDbRasterImageDef as Te } from "@mlightcad/data-model";
1
+ import { AcDbFace as v, AcDbArc as O, AcGeVector3d as D, AcDbCircle as m, AcDbEllipse as k, AcDbLine as F, AcGePoint3d as w, AcDbSpline as T, AcDbPoint as R, 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, AcDb3PointAngularDimension as $, AcDbOrdinateDimension as ee, AcDbRadialDimension as ne, AcDbDiametricDimension as oe, AcDbRasterImage as te, AcDbWipeout as se, AcDbViewport as re, AcDbRay as ie, AcDbXline as ce, AcDbAttributeFlags as I, AcDbAttributeMTextFlag as M, AcDbAttribute as le, AcDbAttributeDefinition as ae, AcDbBlockReference as de, AcCmTransparency as pe, AcDbDatabaseConverter as ue, createWorkerApi as fe, AcDbLinetypeTableRecord as he, AcDbTextStyleTableRecord as ge, DEFAULT_TEXT_STYLE as L, AcDbDimStyleTableRecord as De, AcCmColor as Ae, AcDbLayerTableRecord as Ie, AcDbViewportTableRecord as ye, AcDbBlockTableRecord as we, AcDbBatchProcessing as Te, AcDbLayout as be, AcDbRasterImageDef as Pe } from "@mlightcad/data-model";
2
2
  class S {
3
3
  convert(e) {
4
4
  const n = this.createEntity(e);
@@ -13,7 +13,7 @@ class S {
13
13
  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;
14
14
  }
15
15
  convertFace(e) {
16
- const n = new x();
16
+ const n = new v();
17
17
  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;
18
18
  }
19
19
  convertArc(e) {
@@ -33,22 +33,22 @@ class S {
33
33
  );
34
34
  }
35
35
  convertEllipse(e) {
36
- const n = new D(e.majorAxisEndPoint), o = n.length();
36
+ const n = new D(e.majorAxisEndPoint), t = n.length();
37
37
  return new k(
38
38
  e.center,
39
39
  e.extrusionDirection ?? D.Z_AXIS,
40
40
  n,
41
- o,
42
- o * e.axisRatio,
41
+ t,
42
+ t * e.axisRatio,
43
43
  e.startAngle,
44
44
  e.endAngle
45
45
  );
46
46
  }
47
47
  convertLine(e) {
48
- const n = e.startPoint, o = e.endPoint;
48
+ const n = e.startPoint, t = e.endPoint;
49
49
  return new F(
50
- new y(n.x, n.y, n.z),
51
- new y(o.x, o.y, o.z)
50
+ new w(n.x, n.y, n.z),
51
+ new w(t.x, t.y, t.z)
52
52
  );
53
53
  }
54
54
  convertSpline(e) {
@@ -86,52 +86,73 @@ class S {
86
86
  }
87
87
  convertLWPolyline(e) {
88
88
  const n = new N();
89
- return n.closed = !!(e.flag & 512), e.vertices.forEach((o, t) => {
89
+ return n.closed = !!(e.flag & 512), e.vertices.forEach((t, o) => {
90
90
  n.addVertexAt(
91
- t,
92
- new b(o.x, o.y),
93
- o.bulge,
94
- o.startWidth,
95
- o.endWidth
91
+ o,
92
+ new b(t.x, t.y),
93
+ t.bulge,
94
+ t.startWidth,
95
+ t.endWidth
96
96
  );
97
97
  }), n;
98
98
  }
99
99
  convertPolyline2d(e) {
100
- const n = !!(e.flag & 1), o = [], t = [];
101
- e.vertices.map((r) => {
102
- r.flag & 16 || (o.push({
103
- x: r.x,
104
- y: r.y,
105
- z: r.z
106
- }), t.push(r.bulge ?? 0));
107
- });
108
- let s = A.SimplePoly;
109
- return e.flag & 2 ? s = A.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? s = A.CubicSplinePoly : e.smoothType == 5 && (s = A.QuadSplinePoly)), new B(
110
- s,
111
- o,
112
- 0,
113
- n,
114
- e.startWidth,
115
- e.endWidth,
116
- t
117
- );
100
+ const n = !!(e.flag & 1), t = !!(e.flag & 16), o = !!(e.flag & 64), s = !!(e.flag & 32), r = [], a = [], c = [];
101
+ if (e.vertices.map((i) => {
102
+ if (!(i.flag & 16))
103
+ if (o && i.flag & 128)
104
+ if (i.flag & 64)
105
+ r.push({
106
+ x: i.x,
107
+ y: i.y,
108
+ z: i.z
109
+ }), a.push(i.bulge ?? 0);
110
+ else {
111
+ const d = [];
112
+ 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);
113
+ }
114
+ else
115
+ r.push({
116
+ x: i.x,
117
+ y: i.y,
118
+ z: i.z
119
+ }), a.push(i.bulge ?? 0);
120
+ }), t) {
121
+ const i = e.meshMVertexCount ?? 2, d = e.meshNVertexCount ?? 2;
122
+ return new B(i, d, r, n, s);
123
+ } else {
124
+ if (o)
125
+ return new z(r, c);
126
+ {
127
+ let i = A.SimplePoly;
128
+ return e.flag & 2 ? i = A.FitCurvePoly : e.flag & 4 && (e.smoothType == 6 ? i = A.CubicSplinePoly : e.smoothType == 5 && (i = A.QuadSplinePoly)), new j(
129
+ i,
130
+ r,
131
+ 0,
132
+ n,
133
+ e.startWidth,
134
+ e.endWidth,
135
+ a
136
+ );
137
+ }
138
+ }
118
139
  }
119
140
  convertPolyline3d(e) {
120
- const n = !!(e.flag & 1), o = [];
141
+ const n = !!(e.flag & 1), t = [];
121
142
  e.vertices.map((s) => {
122
- s.flag & 16 || o.push({
143
+ s.flag & 16 || t.push({
123
144
  x: s.x,
124
145
  y: s.y,
125
146
  z: s.z
126
147
  });
127
148
  });
128
- let t = w.SimplePoly;
129
- return e.flag & 4 && (e.smoothType == 6 ? t = w.CubicSplinePoly : e.smoothType == 5 && (t = w.QuadSplinePoly)), new z(t, o, n);
149
+ let o = y.SimplePoly;
150
+ return e.flag & 4 && (e.smoothType == 6 ? o = y.CubicSplinePoly : e.smoothType == 5 && (o = y.QuadSplinePoly)), new W(o, t, n);
130
151
  }
131
152
  convertHatch(e) {
132
- var t;
133
- const n = new j();
134
- return (t = e.definitionLines) == null || t.forEach((s) => {
153
+ var o;
154
+ const n = new H();
155
+ return (o = e.definitionLines) == null || o.forEach((s) => {
135
156
  n.definitionLines.push({
136
157
  angle: s.angle,
137
158
  base: s.base,
@@ -140,55 +161,55 @@ class S {
140
161
  });
141
162
  }), 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) => {
142
163
  if (s.boundaryPathTypeFlag & 2) {
143
- const l = s, i = new W();
144
- i.closed = l.isClosed, l.vertices.forEach((d, a) => {
145
- i.addVertexAt(a, {
146
- x: d.x,
147
- y: d.y,
148
- bulge: d.bulge
164
+ const a = s, c = new X();
165
+ c.closed = a.isClosed, a.vertices.forEach((i, d) => {
166
+ c.addVertexAt(d, {
167
+ x: i.x,
168
+ y: i.y,
169
+ bulge: i.bulge
149
170
  });
150
- }), n.add(i);
171
+ }), n.add(c);
151
172
  } else {
152
- const l = s, i = [];
153
- l.edges.forEach((a) => {
154
- if (a != null) {
155
- if (a.type == 1) {
156
- const c = a;
157
- i.push(new H(c.start, c.end));
158
- } else if (a.type == 2) {
159
- const c = a;
160
- i.push(
161
- new X(
162
- c.center,
163
- c.radius,
164
- c.startAngle,
165
- c.endAngle,
166
- !c.isCCW
173
+ const a = s, c = [];
174
+ a.edges.forEach((d) => {
175
+ if (d != null) {
176
+ if (d.type == 1) {
177
+ const l = d;
178
+ c.push(new U(l.start, l.end));
179
+ } else if (d.type == 2) {
180
+ const l = d;
181
+ c.push(
182
+ new G(
183
+ l.center,
184
+ l.radius,
185
+ l.startAngle,
186
+ l.endAngle,
187
+ !l.isCCW
167
188
  )
168
189
  );
169
- } else if (a.type == 3) {
170
- const c = a;
171
- new U().subVectors(c.end, c.center);
190
+ } else if (d.type == 3) {
191
+ const l = d;
192
+ new Y().subVectors(l.end, l.center);
172
193
  const p = Math.sqrt(
173
- Math.pow(c.end.x, 2) + Math.pow(c.end.y, 2)
174
- ), u = p * c.lengthOfMinorAxis;
175
- let f = c.startAngle, g = c.endAngle;
176
- const v = Math.atan2(c.end.y, c.end.x);
177
- c.isCCW || (f = Math.PI * 2 - f, g = Math.PI * 2 - g), i.push(
178
- new G(
179
- { ...c.center, z: 0 },
194
+ Math.pow(l.end.x, 2) + Math.pow(l.end.y, 2)
195
+ ), u = p * l.lengthOfMinorAxis;
196
+ let f = l.startAngle, g = l.endAngle;
197
+ const x = Math.atan2(l.end.y, l.end.x);
198
+ l.isCCW || (f = Math.PI * 2 - f, g = Math.PI * 2 - g), c.push(
199
+ new _(
200
+ { ...l.center, z: 0 },
180
201
  p,
181
202
  u,
182
203
  f,
183
204
  g,
184
- !c.isCCW,
185
- v
205
+ !l.isCCW,
206
+ x
186
207
  )
187
208
  );
188
- } else if (a.type == 4) {
189
- const c = a;
190
- if (c.numberOfControlPoints > 0 && c.numberOfKnots > 0) {
191
- const h = c.controlPoints.map(
209
+ } else if (d.type == 4) {
210
+ const l = d;
211
+ if (l.numberOfControlPoints > 0 && l.numberOfKnots > 0) {
212
+ const h = l.controlPoints.map(
192
213
  (f) => ({
193
214
  x: f.x,
194
215
  y: f.y,
@@ -196,104 +217,104 @@ class S {
196
217
  })
197
218
  );
198
219
  let p = !0;
199
- const u = c.controlPoints.map((f) => (f.weight == null && (p = !1), f.weight || 1));
200
- i.push(
201
- new E(
220
+ const u = l.controlPoints.map((f) => (f.weight == null && (p = !1), f.weight || 1));
221
+ c.push(
222
+ new P(
202
223
  h,
203
- c.knots,
224
+ l.knots,
204
225
  p ? u : void 0
205
226
  )
206
227
  );
207
- } else if (c.numberOfFitData > 0) {
208
- const h = c.fitDatum.map((p) => ({
228
+ } else if (l.numberOfFitData > 0) {
229
+ const h = l.fitDatum.map((p) => ({
209
230
  x: p.x,
210
231
  y: p.y,
211
232
  z: 0
212
233
  }));
213
- i.push(new E(h, "Uniform"));
234
+ c.push(new P(h, "Uniform"));
214
235
  }
215
236
  }
216
237
  }
217
238
  });
218
- const d = P.buildFromEdges(i);
219
- d.length == 0 && i.length > 0 ? n.add(new P(i)) : d.forEach((a) => n.add(a));
239
+ const i = E.buildFromEdges(c);
240
+ i.length == 0 && c.length > 0 ? n.add(new E(c)) : i.forEach((d) => n.add(d));
220
241
  }
221
242
  }), n;
222
243
  }
223
244
  convertTable(e) {
224
- const n = new Y(
245
+ const n = new Z(
225
246
  e.name,
226
247
  e.rowCount,
227
248
  e.columnCount
228
249
  );
229
250
  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(
230
- (o, t) => n.setColumnWidth(t, o)
251
+ (t, o) => n.setColumnWidth(o, t)
231
252
  ), e.rowHeightArr.forEach(
232
- (o, t) => n.setRowHeight(t, o)
233
- ), e.cells.forEach((o, t) => {
234
- n.setCell(t, o);
253
+ (t, o) => n.setRowHeight(o, t)
254
+ ), e.cells.forEach((t, o) => {
255
+ n.setCell(o, t);
235
256
  }), n;
236
257
  }
237
258
  convertText(e) {
238
- const n = new _();
259
+ const n = new K();
239
260
  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;
240
261
  }
241
262
  convertMText(e) {
242
- const n = new Z();
263
+ const n = new q();
243
264
  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;
244
265
  }
245
266
  convertLeader(e) {
246
- const n = new K();
247
- return e.vertices.forEach((o) => {
248
- n.appendVertex(o);
267
+ const n = new J();
268
+ return e.vertices.forEach((t) => {
269
+ n.appendVertex(t);
249
270
  }), n.hasArrowHead = e.isArrowheadEnabled, n.hasHookLine = e.isHooklineExists, n.isSplined = e.isSpline, n.dimensionStyle = e.styleName, n.annoType = e.leaderCreationFlag, n;
250
271
  }
251
272
  convertDimension(e) {
252
273
  if (e.subclassMarker == "AcDbAlignedDimension" || e.subclassMarker == "AcDbRotatedDimension") {
253
- const n = e, o = new q(
274
+ const n = e, t = new Q(
254
275
  n.subDefinitionPoint1,
255
276
  n.subDefinitionPoint2,
256
277
  n.definitionPoint
257
278
  );
258
- return n.insertionPoint && (o.dimBlockPosition = {
279
+ return n.insertionPoint && (t.dimBlockPosition = {
259
280
  x: n.insertionPoint.x,
260
281
  y: n.insertionPoint.y,
261
282
  z: 0
262
- }), o.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, o), o;
283
+ }), t.rotation = n.rotationAngle, this.processDimensionCommonAttrs(e, t), t;
263
284
  } else if (e.subclassMarker == "AcDb3PointAngularDimension") {
264
- const n = e, o = new J(
285
+ const n = e, t = new $(
265
286
  n.centerPoint,
266
287
  n.subDefinitionPoint1,
267
288
  n.subDefinitionPoint2,
268
289
  n.definitionPoint
269
290
  );
270
- return this.processDimensionCommonAttrs(e, o), o;
291
+ return this.processDimensionCommonAttrs(e, t), t;
271
292
  } else if (e.subclassMarker == "AcDbOrdinateDimension") {
272
- const n = e, o = new Q(
293
+ const n = e, t = new ee(
273
294
  n.subDefinitionPoint1,
274
295
  n.subDefinitionPoint2
275
296
  );
276
- return this.processDimensionCommonAttrs(e, o), o;
297
+ return this.processDimensionCommonAttrs(e, t), t;
277
298
  } else if (e.subclassMarker == "AcDbRadialDimension") {
278
- const n = e, o = new $(
299
+ const n = e, t = new ne(
279
300
  n.definitionPoint,
280
301
  n.centerPoint,
281
302
  n.leaderLength
282
303
  );
283
- return this.processDimensionCommonAttrs(e, o), o;
304
+ return this.processDimensionCommonAttrs(e, t), t;
284
305
  } else if (e.subclassMarker == "AcDbDiametricDimension") {
285
- const n = e, o = new ee(
306
+ const n = e, t = new oe(
286
307
  n.definitionPoint,
287
308
  n.centerPoint,
288
309
  n.leaderLength
289
310
  );
290
- return this.processDimensionCommonAttrs(e, o), o;
311
+ return this.processDimensionCommonAttrs(e, t), t;
291
312
  }
292
313
  return null;
293
314
  }
294
315
  processImage(e, n) {
295
- 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((o) => {
296
- n.clipBoundary.push(new b(o));
316
+ 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) => {
317
+ n.clipBoundary.push(new b(t));
297
318
  }), n.clipBoundaryType = e.clippingBoundaryType, n.width = Math.sqrt(
298
319
  e.uPixel.x ** 2 + e.uPixel.y ** 2 + e.uPixel.z ** 2
299
320
  ) * e.imageSize.x, n.height = Math.sqrt(
@@ -301,42 +322,42 @@ class S {
301
322
  ) * e.imageSize.y, n.rotation = Math.atan2(e.uPixel.y, e.uPixel.x);
302
323
  }
303
324
  convertImage(e) {
304
- const n = new ne();
325
+ const n = new te();
305
326
  return this.processImage(e, n), n;
306
327
  }
307
328
  convertWipeout(e) {
308
- const n = new te();
329
+ const n = new se();
309
330
  return this.processImage(e, n), n;
310
331
  }
311
332
  convertViewport(e) {
312
- const n = new oe();
333
+ const n = new re();
313
334
  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;
314
335
  }
315
336
  convertRay(e) {
316
- const n = new se();
337
+ const n = new ie();
317
338
  return n.basePoint.copy(e.firstPoint), n.unitDir.copy(e.unitDirection), n;
318
339
  }
319
340
  convertXline(e) {
320
- const n = new re();
341
+ const n = new ce();
321
342
  return n.basePoint.copy(e.firstPoint), n.unitDir.copy(e.unitDirection), n;
322
343
  }
323
344
  convertAttributeCommon(e, n) {
324
- const o = e.text;
325
- n.textString = o.text, n.styleName = o.styleName, n.height = o.textHeight, n.position.copy(o.startPoint), n.rotation = o.rotation, n.oblique = o.obliqueAngle ?? 0, n.thickness = o.thickness, n.horizontalMode = o.halign, n.verticalMode = o.valign, n.widthFactor = o.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 & L.MultiLine) !== 0, n.isConstMTextAttribute = (e.mtextFlag & L.ConstMultiLine) !== 0;
345
+ const t = e.text;
346
+ 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;
326
347
  }
327
348
  convertAttribute(e) {
328
- const n = new ie();
349
+ const n = new le();
329
350
  return this.convertAttributeCommon(e, n), n;
330
351
  }
331
352
  convertAttributeDefinition(e) {
332
- const n = new ce();
353
+ const n = new ae();
333
354
  return this.convertAttributeCommon(e, n), n.prompt = e.prompt, n;
334
355
  }
335
356
  convertBlockReference(e) {
336
- const n = new le(e.name);
337
- 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((o) => {
338
- const t = this.convertAttribute(o);
339
- n.appendAttributes(t);
357
+ const n = new de(e.name);
358
+ 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) => {
359
+ const o = this.convertAttribute(t);
360
+ n.appendAttributes(o);
340
361
  }), n;
341
362
  }
342
363
  processDimensionCommonAttrs(e, n) {
@@ -344,22 +365,22 @@ class S {
344
365
  }
345
366
  processCommonAttrs(e, n) {
346
367
  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 && (n.color.colorIndex = e.colorIndex), e.colorName && (n.color.colorName = e.colorName), e.isVisible != null && (n.visibility = e.isVisible), e.transparency != null) {
347
- const o = new ae();
348
- o.method = e.transparencyType, (o.isByBlock || o.isByBlock) && (o.alpha = e.transparency), n.transparency = o;
368
+ const t = new pe();
369
+ t.method = e.transparencyType, (t.isByBlock || t.isByBlock) && (t.alpha = e.transparency), n.transparency = t;
349
370
  }
350
371
  }
351
372
  }
352
- const be = "*MODEL_SPACE";
353
- class Pe extends de {
373
+ const Ee = "*MODEL_SPACE";
374
+ class Le extends ue {
354
375
  constructor(e = {}) {
355
376
  super(e), e.useWorker = !0, e.parserWorkerUrl || (e.parserWorkerUrl = "/assets/libredwg-parser-worker.js");
356
377
  }
357
378
  async parse(e, n) {
358
- const o = this.config, t = this.getParserWorkerTimeout(e, n);
359
- if (o.useWorker && o.parserWorkerUrl) {
360
- const s = pe({
361
- workerUrl: o.parserWorkerUrl,
362
- timeout: t,
379
+ const t = this.config, o = this.getParserWorkerTimeout(e, n);
380
+ if (t.useWorker && t.parserWorkerUrl) {
381
+ const s = fe({
382
+ workerUrl: t.parserWorkerUrl,
383
+ timeout: o,
363
384
  // One concurrent worker needed for parser
364
385
  maxConcurrentWorkers: 1
365
386
  }), r = await s.execute(e);
@@ -381,175 +402,175 @@ class Pe extends de {
381
402
  e.tables.BLOCK_RECORD.entries.forEach((r) => {
382
403
  n.set(r.name, r);
383
404
  });
384
- const o = /* @__PURE__ */ new Map(), t = (r) => {
405
+ const t = /* @__PURE__ */ new Map(), o = (r) => {
385
406
  if (r) {
386
- const l = r.lastIndexOf(".");
387
- return l >= 0 ? r.substring(0, l).toLowerCase() : r.toLowerCase();
407
+ const a = r.lastIndexOf(".");
408
+ return a >= 0 ? r.substring(0, a).toLowerCase() : r.toLowerCase();
388
409
  }
389
410
  };
390
411
  e.tables.STYLE.entries.forEach((r) => {
391
- const l = [];
392
- let i = t(r.font);
393
- i && l.push(i), i = t(r.bigFont), i && l.push(i), o.set(r.name, l);
412
+ const a = [];
413
+ let c = o(r.font);
414
+ c && a.push(c), c = o(r.bigFont), c && a.push(c), t.set(r.name, a);
394
415
  });
395
416
  const s = /* @__PURE__ */ new Set();
396
- return this.getFontsInBlock(e.entities, n, o, s), Array.from(s);
417
+ return this.getFontsInBlock(e.entities, n, t, s), Array.from(s);
397
418
  }
398
419
  /**
399
420
  * Iterate entities in model space to get fonts used by text, mtext and insert entities
400
421
  */
401
- getFontsInBlock(e, n, o, t) {
422
+ getFontsInBlock(e, n, t, o) {
402
423
  const s = /\\f(.*?)\|/g;
403
424
  e.forEach((r) => {
404
425
  if (r.type == "MTEXT") {
405
- const l = r;
406
- [...l.text.matchAll(s)].forEach((d) => {
407
- t.add(d[1].toLowerCase());
426
+ const a = r;
427
+ [...a.text.matchAll(s)].forEach((i) => {
428
+ o.add(i[1].toLowerCase());
408
429
  });
409
- const i = o.get(l.styleName);
410
- i == null || i.forEach((d) => t.add(d));
430
+ const c = t.get(a.styleName);
431
+ c == null || c.forEach((i) => o.add(i));
411
432
  } else if (r.type == "TEXT") {
412
- const l = r, i = o.get(l.styleName);
413
- i == null || i.forEach((d) => t.add(d));
433
+ const a = r, c = t.get(a.styleName);
434
+ c == null || c.forEach((i) => o.add(i));
414
435
  } else if (r.type == "INSERT") {
415
- const l = r, i = n.get(l.name);
416
- i && this.getFontsInBlock(i.entities, n, o, t);
436
+ const a = r, c = n.get(a.name);
437
+ c && this.getFontsInBlock(c.entities, n, t, o);
417
438
  }
418
439
  });
419
440
  }
420
441
  processLineTypes(e, n) {
421
- e.tables.LTYPE.entries.forEach((t) => {
442
+ e.tables.LTYPE.entries.forEach((o) => {
422
443
  const s = {
423
- name: t.name,
424
- description: t.description,
425
- standardFlag: t.standardFlag,
426
- totalPatternLength: t.totalPatternLength,
427
- pattern: t.pattern
428
- }, r = new ue(s);
429
- this.processCommonTableEntryAttrs(t, r), r.name = t.name, n.tables.linetypeTable.add(r);
444
+ name: o.name,
445
+ description: o.description,
446
+ standardFlag: o.standardFlag,
447
+ totalPatternLength: o.totalPatternLength,
448
+ pattern: o.pattern
449
+ }, r = new he(s);
450
+ this.processCommonTableEntryAttrs(o, r), r.name = o.name, n.tables.linetypeTable.add(r);
430
451
  });
431
452
  }
432
453
  processTextStyles(e, n) {
433
- e.tables.STYLE.entries.forEach((t) => {
434
- const s = new fe(t);
435
- this.processCommonTableEntryAttrs(t, s), n.tables.textStyleTable.add(s);
454
+ e.tables.STYLE.entries.forEach((o) => {
455
+ const s = new ge(o);
456
+ this.processCommonTableEntryAttrs(o, s), n.tables.textStyleTable.add(s);
436
457
  });
437
458
  }
438
459
  processDimStyles(e, n) {
439
- e.tables.DIMSTYLE.entries.forEach((t) => {
460
+ e.tables.DIMSTYLE.entries.forEach((o) => {
440
461
  const s = {
441
- name: t.name,
442
- ownerId: t.ownerHandle,
443
- dimpost: t.DIMPOST || "",
444
- dimapost: t.DIMAPOST || "",
445
- dimscale: t.DIMSCALE,
446
- dimasz: t.DIMASZ,
447
- dimexo: t.DIMEXO,
448
- dimdli: t.DIMDLI,
449
- dimexe: t.DIMEXE,
450
- dimrnd: t.DIMRND,
451
- dimdle: t.DIMDLE,
452
- dimtp: t.DIMTP,
453
- dimtm: t.DIMTM,
454
- dimtxt: t.DIMTXT,
455
- dimcen: t.DIMCEN,
456
- dimtsz: t.DIMTSZ,
457
- dimaltf: t.DIMALTF,
458
- dimlfac: t.DIMLFAC,
459
- dimtvp: t.DIMTVP,
460
- dimtfac: t.DIMTFAC,
461
- dimgap: t.DIMGAP,
462
- dimaltrnd: t.DIMALTRND,
463
- dimtol: t.DIMTOL == null || t.DIMTOL == 0 ? 0 : 1,
464
- dimlim: t.DIMLIM == null || t.DIMLIM == 0 ? 0 : 1,
465
- dimtih: t.DIMTIH == null || t.DIMTIH == 0 ? 0 : 1,
466
- dimtoh: t.DIMTOH == null || t.DIMTOH == 0 ? 0 : 1,
467
- dimse1: t.DIMSE1 == null || t.DIMSE1 == 0 ? 0 : 1,
468
- dimse2: t.DIMSE2 == null || t.DIMSE2 == 0 ? 0 : 1,
469
- dimtad: t.DIMTAD,
470
- dimzin: t.DIMZIN,
471
- dimazin: t.DIMAZIN,
472
- dimalt: t.DIMALT,
473
- dimaltd: t.DIMALTD,
474
- dimtofl: t.DIMTOFL,
475
- dimsah: t.DIMSAH,
476
- dimtix: t.DIMTIX,
477
- dimsoxd: t.DIMSOXD,
478
- dimclrd: t.DIMCLRD,
479
- dimclre: t.DIMCLRE,
480
- dimclrt: t.DIMCLRT,
481
- dimadec: t.DIMADEC || 0,
482
- dimunit: t.DIMUNIT || 2,
483
- dimdec: t.DIMDEC,
484
- dimtdec: t.DIMTDEC,
485
- dimaltu: t.DIMALTU,
486
- dimalttd: t.DIMALTTD,
487
- dimaunit: t.DIMAUNIT,
488
- dimfrac: t.DIMFRAC,
489
- dimlunit: t.DIMLUNIT,
490
- dimdsep: t.DIMDSEP || ".",
491
- dimtmove: t.DIMTMOVE || 0,
492
- dimjust: t.DIMJUST,
493
- dimsd1: t.DIMSD1,
494
- dimsd2: t.DIMSD2,
495
- dimtolj: t.DIMTOLJ,
496
- dimtzin: t.DIMTZIN,
497
- dimaltz: t.DIMALTZ,
498
- dimalttz: t.DIMALTTZ,
499
- dimfit: t.DIMFIT || 0,
500
- dimupt: t.DIMUPT,
501
- dimatfit: t.DIMATFIT,
502
- dimtxsty: M,
462
+ name: o.name,
463
+ ownerId: o.ownerHandle,
464
+ dimpost: o.DIMPOST || "",
465
+ dimapost: o.DIMAPOST || "",
466
+ dimscale: o.DIMSCALE,
467
+ dimasz: o.DIMASZ,
468
+ dimexo: o.DIMEXO,
469
+ dimdli: o.DIMDLI,
470
+ dimexe: o.DIMEXE,
471
+ dimrnd: o.DIMRND,
472
+ dimdle: o.DIMDLE,
473
+ dimtp: o.DIMTP,
474
+ dimtm: o.DIMTM,
475
+ dimtxt: o.DIMTXT,
476
+ dimcen: o.DIMCEN,
477
+ dimtsz: o.DIMTSZ,
478
+ dimaltf: o.DIMALTF,
479
+ dimlfac: o.DIMLFAC,
480
+ dimtvp: o.DIMTVP,
481
+ dimtfac: o.DIMTFAC,
482
+ dimgap: o.DIMGAP,
483
+ dimaltrnd: o.DIMALTRND,
484
+ dimtol: o.DIMTOL == null || o.DIMTOL == 0 ? 0 : 1,
485
+ dimlim: o.DIMLIM == null || o.DIMLIM == 0 ? 0 : 1,
486
+ dimtih: o.DIMTIH == null || o.DIMTIH == 0 ? 0 : 1,
487
+ dimtoh: o.DIMTOH == null || o.DIMTOH == 0 ? 0 : 1,
488
+ dimse1: o.DIMSE1 == null || o.DIMSE1 == 0 ? 0 : 1,
489
+ dimse2: o.DIMSE2 == null || o.DIMSE2 == 0 ? 0 : 1,
490
+ dimtad: o.DIMTAD,
491
+ dimzin: o.DIMZIN,
492
+ dimazin: o.DIMAZIN,
493
+ dimalt: o.DIMALT,
494
+ dimaltd: o.DIMALTD,
495
+ dimtofl: o.DIMTOFL,
496
+ dimsah: o.DIMSAH,
497
+ dimtix: o.DIMTIX,
498
+ dimsoxd: o.DIMSOXD,
499
+ dimclrd: o.DIMCLRD,
500
+ dimclre: o.DIMCLRE,
501
+ dimclrt: o.DIMCLRT,
502
+ dimadec: o.DIMADEC || 0,
503
+ dimunit: o.DIMUNIT || 2,
504
+ dimdec: o.DIMDEC,
505
+ dimtdec: o.DIMTDEC,
506
+ dimaltu: o.DIMALTU,
507
+ dimalttd: o.DIMALTTD,
508
+ dimaunit: o.DIMAUNIT,
509
+ dimfrac: o.DIMFRAC,
510
+ dimlunit: o.DIMLUNIT,
511
+ dimdsep: o.DIMDSEP || ".",
512
+ dimtmove: o.DIMTMOVE || 0,
513
+ dimjust: o.DIMJUST,
514
+ dimsd1: o.DIMSD1,
515
+ dimsd2: o.DIMSD2,
516
+ dimtolj: o.DIMTOLJ,
517
+ dimtzin: o.DIMTZIN,
518
+ dimaltz: o.DIMALTZ,
519
+ dimalttz: o.DIMALTTZ,
520
+ dimfit: o.DIMFIT || 0,
521
+ dimupt: o.DIMUPT,
522
+ dimatfit: o.DIMATFIT,
523
+ dimtxsty: L,
503
524
  // TODO: Set correct value
504
525
  dimldrblk: "",
505
526
  // TODO: Set correct value
506
- dimblk: t.DIMBLK || "",
527
+ dimblk: o.DIMBLK || "",
507
528
  // TODO: Set correct value
508
- dimblk1: t.DIMBLK1 || "",
529
+ dimblk1: o.DIMBLK1 || "",
509
530
  // TODO: Set correct value
510
- dimblk2: t.DIMBLK2 || "",
531
+ dimblk2: o.DIMBLK2 || "",
511
532
  // TODO: Set correct value
512
- dimlwd: t.DIMLWD,
513
- dimlwe: t.DIMLWE
514
- }, r = new he(s);
515
- this.processCommonTableEntryAttrs(t, r), n.tables.dimStyleTable.add(r);
533
+ dimlwd: o.DIMLWD,
534
+ dimlwe: o.DIMLWE
535
+ }, r = new De(s);
536
+ this.processCommonTableEntryAttrs(o, r), n.tables.dimStyleTable.add(r);
516
537
  });
517
538
  }
518
539
  processLayers(e, n) {
519
- e.tables.LAYER.entries.forEach((t) => {
520
- const s = new ge();
521
- s.colorIndex = t.colorIndex;
522
- const r = new De({
523
- name: t.name,
524
- standardFlags: t.standardFlag,
525
- linetype: t.lineType,
526
- lineWeight: t.lineweight,
527
- isOff: t.off,
540
+ e.tables.LAYER.entries.forEach((o) => {
541
+ const s = new Ae();
542
+ s.colorIndex = o.colorIndex;
543
+ const r = new Ie({
544
+ name: o.name,
545
+ standardFlags: o.standardFlag,
546
+ linetype: o.lineType,
547
+ lineWeight: o.lineweight,
548
+ isOff: o.off,
528
549
  color: s,
529
- isPlottable: t.plotFlag != 0
550
+ isPlottable: o.plotFlag != 0
530
551
  });
531
- this.processCommonTableEntryAttrs(t, r), n.tables.layerTable.add(r);
552
+ this.processCommonTableEntryAttrs(o, r), n.tables.layerTable.add(r);
532
553
  });
533
554
  }
534
555
  processViewports(e, n) {
535
- e.tables.VPORT.entries.forEach((t) => {
536
- const s = new Ae();
537
- this.processCommonTableEntryAttrs(t, s), t.circleSides && (s.circleSides = t.circleSides), s.standardFlag = t.standardFlag, s.center.copy(t.center), s.lowerLeftCorner.copy(t.lowerLeftCorner), s.upperRightCorner.copy(t.upperRightCorner), t.snapBasePoint && s.snapBase.copy(t.snapBasePoint), t.snapRotationAngle && (s.snapAngle = t.snapRotationAngle), t.snapSpacing && s.snapIncrements.copy(t.snapSpacing), t.majorGridLines && (s.gridMajor = t.majorGridLines), t.gridSpacing && s.gridIncrements.copy(t.gridSpacing), t.backgroundObjectId && (s.backgroundObjectId = t.backgroundObjectId), s.gsView.center.copy(t.center), s.gsView.viewDirectionFromTarget.copy(t.viewDirectionFromTarget), s.gsView.viewTarget.copy(t.viewTarget), t.lensLength && (s.gsView.lensLength = t.lensLength), t.frontClippingPlane && (s.gsView.frontClippingPlane = t.frontClippingPlane), t.backClippingPlane && (s.gsView.backClippingPlane = t.backClippingPlane), t.viewHeight && (s.gsView.viewHeight = t.viewHeight), t.viewTwistAngle && (s.gsView.viewTwistAngle = t.viewTwistAngle), t.frozenLayers && (s.gsView.frozenLayers = t.frozenLayers), t.styleSheet && (s.gsView.styleSheet = t.styleSheet), t.renderMode && (s.gsView.renderMode = t.renderMode), t.viewMode && (s.gsView.viewMode = t.viewMode), t.ucsIconSetting && (s.gsView.ucsIconSetting = t.ucsIconSetting), t.ucsOrigin && s.gsView.ucsOrigin.copy(t.ucsOrigin), t.ucsXAxis && s.gsView.ucsXAxis.copy(t.ucsXAxis), t.ucsYAxis && s.gsView.ucsYAxis.copy(t.ucsYAxis), t.orthographicType && (s.gsView.orthographicType = t.orthographicType), t.shadePlotSetting && (s.gsView.shadePlotSetting = t.shadePlotSetting), t.shadePlotObjectId && (s.gsView.shadePlotObjectId = t.shadePlotObjectId), t.visualStyleObjectId && (s.gsView.visualStyleObjectId = t.visualStyleObjectId), t.isDefaultLightingOn && (s.gsView.isDefaultLightingOn = t.isDefaultLightingOn), t.defaultLightingType && (s.gsView.defaultLightingType = t.defaultLightingType), t.brightness && (s.gsView.brightness = t.brightness), t.contrast && (s.gsView.contrast = t.contrast), t.ambientColor && (s.gsView.ambientColor = t.ambientColor), n.tables.viewportTable.add(s);
556
+ e.tables.VPORT.entries.forEach((o) => {
557
+ const s = new ye();
558
+ 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);
538
559
  });
539
560
  }
540
561
  processBlockTables(e, n) {
541
- e.tables.BLOCK_RECORD.entries.forEach((t) => {
542
- let s = n.tables.blockTable.getAt(t.name);
543
- s || (s = new Ie(), s.objectId = t.handle, s.name = t.name, s.ownerId = t.ownerHandle, s.origin.copy(t.basePoint), s.layoutId = t.layout, s.blockInsertUnits = t.insertionUnits, s.explodability = t.explodability, s.blockScaling = t.scalability, t.bmpPreview && (s.bmpPreview = t.bmpPreview), n.tables.blockTable.add(s)), !s.isModelSapce && t.entities && t.entities.length > 0 && this.processEntitiesInBlock(t.entities, s);
562
+ e.tables.BLOCK_RECORD.entries.forEach((o) => {
563
+ let s = n.tables.blockTable.getAt(o.name);
564
+ s || (s = new we(), 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);
544
565
  });
545
566
  }
546
567
  processBlocks(e, n) {
547
568
  }
548
569
  async processEntitiesInBlock(e, n) {
549
- const o = new S(), t = e.length, s = [];
550
- for (let r = 0; r < t; r++) {
551
- const l = e[r], i = o.convert(l);
552
- i && s.push(i);
570
+ const t = new S(), o = e.length, s = [];
571
+ for (let r = 0; r < o; r++) {
572
+ const a = e[r], c = t.convert(a);
573
+ c && s.push(c);
553
574
  }
554
575
  n.appendEntity(s);
555
576
  }
@@ -558,34 +579,34 @@ class Pe extends de {
558
579
  * as "batch processing" or "cooperative multitasking," where the time-consuming task is broken into
559
580
  * smaller pieces and executed in small intervals to allow the UI to remain responsive.
560
581
  */
561
- async processEntities(e, n, o, t, s) {
582
+ async processEntities(e, n, t, o, s) {
562
583
  const r = new S();
563
- let l = [];
564
- e.tables.BLOCK_RECORD.entries.forEach((c) => {
565
- this.isModelSpace(c.name) && (l = c.entities);
584
+ let a = [];
585
+ e.tables.BLOCK_RECORD.entries.forEach((l) => {
586
+ this.isModelSpace(l.name) && (a = l.entities);
566
587
  });
567
- const i = l.length, d = new we(
568
- i,
569
- 100 - t.value,
570
- o
588
+ const c = a.length, i = new Te(
589
+ c,
590
+ 100 - o.value,
591
+ t
571
592
  );
572
- this.config.convertByEntityType && (l = this.groupAndFlattenByType(l));
573
- const a = n.tables.blockTable.modelSpace;
574
- await d.processChunk(async (c, h) => {
593
+ this.config.convertByEntityType && (a = this.groupAndFlattenByType(a));
594
+ const d = n.tables.blockTable.modelSpace;
595
+ await i.processChunk(async (l, h) => {
575
596
  const p = [];
576
- for (let u = c; u < h; u++) {
577
- const f = l[u], g = r.convert(f);
597
+ for (let u = l; u < h; u++) {
598
+ const f = a[u], g = r.convert(f);
578
599
  g && p.push(g);
579
600
  }
580
- if (a.appendEntity(p), s) {
581
- let u = t.value + h / i * (100 - t.value);
601
+ if (d.appendEntity(p), s) {
602
+ let u = o.value + h / c * (100 - o.value);
582
603
  u > 100 && (u = 100), await s(u, "ENTITY", "IN-PROGRESS");
583
604
  }
584
605
  });
585
606
  }
586
607
  processHeader(e, n) {
587
- const o = e.header;
588
- o.CECOLOR && (o.CECOLOR.index >= 0 && o.CECOLOR.index <= 256 ? n.cecolor.colorIndex = o.CECOLOR.index : n.cecolor.setRGBValue(o.CECOLOR.rgb)), n.angBase = o.ANGBASE ?? 0, n.angDir = o.ANGDIR ?? 0, n.aunits = o.AUNITS ?? 0, n.celtscale = o.CELTSCALE ?? 1, n.ltscale = o.LTSCALE ?? 1, o.EXTMAX && (n.extmax = o.EXTMAX), o.EXTMIN && (n.extmin = o.EXTMIN), n.insunits = o.INSUNITS ?? 1, n.pdmode = o.PDMODE ?? 0, n.pdsize = o.PDSIZE ?? 0, n.textstyle = o.TEXTSTYLE ?? M;
608
+ const t = e.header;
609
+ 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.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;
589
610
  }
590
611
  processCommonTableEntryAttrs(e, n) {
591
612
  n.name = e.name, n.objectId = e.handle, n.ownerId = e.ownerHandle;
@@ -594,25 +615,25 @@ class Pe extends de {
594
615
  this.processLayouts(e, n), this.processImageDefs(e, n);
595
616
  }
596
617
  processLayouts(e, n) {
597
- const o = n.objects.layout;
618
+ const t = n.objects.layout;
598
619
  e.objects.LAYOUT.forEach((s) => {
599
- const r = new ye();
620
+ const r = new be();
600
621
  r.layoutName = s.layoutName, r.tabOrder = s.tabOrder;
601
- const l = n.tables.blockTable.newIterator();
622
+ const a = n.tables.blockTable.newIterator();
602
623
  r.objectId = s.handle;
603
- for (const i of l)
604
- if (i.layoutId === r.objectId) {
605
- r.blockTableRecordId = i.objectId;
624
+ for (const c of a)
625
+ if (c.layoutId === r.objectId) {
626
+ r.blockTableRecordId = c.objectId;
606
627
  break;
607
628
  }
608
- 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), o.setAt(r.layoutName, r);
629
+ 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);
609
630
  });
610
631
  }
611
632
  processImageDefs(e, n) {
612
- const o = n.objects.imageDefinition;
633
+ const t = n.objects.imageDefinition;
613
634
  e.objects.IMAGEDEF.forEach((s) => {
614
- const r = new Te();
615
- r.sourceFileName = s.fileName, this.processCommonObjectAttrs(s, r), o.setAt(r.objectId, r);
635
+ const r = new Pe();
636
+ r.sourceFileName = s.fileName, this.processCommonObjectAttrs(s, r), t.setAt(r.objectId, r);
616
637
  });
617
638
  }
618
639
  processCommonObjectAttrs(e, n) {
@@ -632,15 +653,15 @@ class Pe extends de {
632
653
  * @returns A new array of entities grouped by their `type` property.
633
654
  */
634
655
  groupAndFlattenByType(e) {
635
- const n = {}, o = [];
636
- for (const t of e)
637
- n[t.type] || (n[t.type] = [], o.push(t.type)), n[t.type].push(t);
638
- return o.flatMap((t) => n[t]);
656
+ const n = {}, t = [];
657
+ for (const o of e)
658
+ n[o.type] || (n[o.type] = [], t.push(o.type)), n[o.type].push(o);
659
+ return t.flatMap((o) => n[o]);
639
660
  }
640
661
  isModelSpace(e) {
641
- return e && e.toUpperCase() == be;
662
+ return e && e.toUpperCase() == Ee;
642
663
  }
643
664
  }
644
665
  export {
645
- Pe as AcDbLibreDwgConverter
666
+ Le as AcDbLibreDwgConverter
646
667
  };