@mlightcad/libredwg-converter 3.15.27 → 3.15.29

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.
@@ -325,6 +325,10 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
325
325
  AcDbLibreDwgConverter.prototype.processLayers = function (model, db) {
326
326
  var _this = this;
327
327
  var layers = model.tables.LAYER.entries;
328
+ // LAYER.plotflag (DXF 290) exists only since R2000 (AC1015). LibreDWG
329
+ // leaves the bit at 0 for R13/R14, which would mark every layer
330
+ // non-plottable and hide the drawing when drawNoPlotLayers is false.
331
+ var layerPlotFlagSupported = this.isLayerPlotFlagSupported(model);
328
332
  layers.forEach(function (item) {
329
333
  var color = new AcCmColor();
330
334
  _this.applyLibreLayerColor(color, item);
@@ -335,12 +339,37 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
335
339
  lineWeight: item.lineweight,
336
340
  isOff: item.off,
337
341
  color: color,
338
- isPlottable: item.plotFlag != 0
342
+ isPlottable: layerPlotFlagSupported ? item.plotFlag != 0 : true
339
343
  });
340
344
  _this.processCommonTableEntryAttrs(item, record);
341
345
  db.tables.layerTable.add(record);
342
346
  });
343
347
  };
348
+ /**
349
+ * True when the drawing database version can carry LAYER plot flags.
350
+ *
351
+ * Pre-R2000 DWGs have no no-plot concept; treating LibreDWG's zeroed
352
+ * `plotflag` as non-plottable blanks the canvas under the editor's default
353
+ * `drawNoPlotLayers: false` policy.
354
+ */
355
+ AcDbLibreDwgConverter.prototype.isLayerPlotFlagSupported = function (model) {
356
+ var _a, _b, _c, _d;
357
+ var acadver = (_a = model.header) === null || _a === void 0 ? void 0 : _a.ACADVER;
358
+ var match = typeof acadver === 'string' ? /^AC(\d{4})$/.exec(acadver.trim()) : null;
359
+ if (match) {
360
+ // AC1014 = R14, AC1015 = AutoCAD 2000.
361
+ return Number(match[1]) >= 1015;
362
+ }
363
+ // parseLibreDwgFile fills ACADVER from the parsed file, so this guess only
364
+ // applies when the version is unknown. LibreDWG zeros every plotflag for
365
+ // pre-R2000, so an all-zero table most likely means the field was never
366
+ // authored. An R2000+ drawing whose layers are all genuinely no-plot is
367
+ // misread here.
368
+ var layers = (_d = (_c = (_b = model.tables) === null || _b === void 0 ? void 0 : _b.LAYER) === null || _c === void 0 ? void 0 : _c.entries) !== null && _d !== void 0 ? _d : [];
369
+ if (layers.length === 0)
370
+ return true;
371
+ return layers.some(function (layer) { return layer.plotFlag != 0; });
372
+ };
344
373
  /**
345
374
  * Maps a libredwg-web {@link DwgLayerTableEntry} colour onto {@link AcCmColor}.
346
375
  *
@@ -827,38 +856,66 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
827
856
  var layoutDict = db.objects.layout;
828
857
  var layouts = model.objects.LAYOUT;
829
858
  layouts.forEach(function (layout) {
830
- var e_3, _a;
859
+ var e_3, _a, e_4, _b;
831
860
  var dbLayout = new AcDbLayout();
832
861
  dbLayout.layoutName = layout.layoutName;
833
862
  dbLayout.tabOrder = layout.tabOrder;
834
- // layout.paperSpaceTableId doesn't point to the block table record asscicated with
835
- // this layout. So let's get the assocated block table record id from block table.
836
- var btrs = db.tables.blockTable.newIterator();
863
+ // Prefer BLOCK_RECORD.layoutId (same rule as the DXF reader). Model must
864
+ // always track the live *Model_Space BTR — matching Model by layoutId
865
+ // alone can latch onto a stale handle after bootstrap / handle-collision
866
+ // rewrites. When layoutId is empty (common on R14 DWGs), fall back to
867
+ // LAYOUT.paperSpaceTableId and then to an unbound *Paper_Space* BTR.
837
868
  dbLayout.objectId = layout.handle;
838
- try {
839
- for (var btrs_1 = __values(btrs), btrs_1_1 = btrs_1.next(); !btrs_1_1.done; btrs_1_1 = btrs_1.next()) {
840
- var btr = btrs_1_1.value;
841
- // Because the type of layout id (number) block table record and layout id (BingInt)
842
- // in layout dictionary are different, so the converted data are used to compare.
843
- // In the future, we will use BigInt type for object id.
844
- if (btr.layoutId === dbLayout.objectId) {
845
- dbLayout.blockTableRecordId = btr.objectId;
846
- break;
847
- }
848
- }
869
+ if (layout.layoutName === 'Model') {
870
+ var modelSpace = db.tables.blockTable.modelSpace;
871
+ dbLayout.blockTableRecordId = modelSpace.objectId;
872
+ modelSpace.layoutId = dbLayout.objectId;
849
873
  }
850
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
851
- finally {
874
+ else {
852
875
  try {
853
- if (btrs_1_1 && !btrs_1_1.done && (_a = btrs_1.return)) _a.call(btrs_1);
876
+ for (var _c = __values(db.tables.blockTable.newIterator()), _d = _c.next(); !_d.done; _d = _c.next()) {
877
+ var btr = _d.value;
878
+ // layoutId types can differ (number vs string hex); compare as string.
879
+ if (String(btr.layoutId) === String(dbLayout.objectId)) {
880
+ dbLayout.blockTableRecordId = btr.objectId;
881
+ break;
882
+ }
883
+ }
854
884
  }
855
- finally { if (e_3) throw e_3.error; }
856
- }
857
- // If the layout is not found in the block table due to some unknow reason,
858
- // let's set the model space block table record id.
859
- if (!dbLayout.blockTableRecordId) {
860
- if (layout.layoutName === 'Model') {
861
- dbLayout.blockTableRecordId = db.tables.blockTable.modelSpace.objectId;
885
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
886
+ finally {
887
+ try {
888
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
889
+ }
890
+ finally { if (e_3) throw e_3.error; }
891
+ }
892
+ if (!dbLayout.blockTableRecordId && layout.paperSpaceTableId) {
893
+ var btr = db.tables.blockTable.getIdAt(String(layout.paperSpaceTableId));
894
+ // paperSpaceTableId is not always reliable, so only accept a paper
895
+ // space BTR that is not already bound to another layout.
896
+ if ((btr === null || btr === void 0 ? void 0 : btr.isPaperSapce) && !btr.layoutId) {
897
+ dbLayout.blockTableRecordId = btr.objectId;
898
+ btr.layoutId = dbLayout.objectId;
899
+ }
900
+ }
901
+ if (!dbLayout.blockTableRecordId) {
902
+ try {
903
+ for (var _e = __values(db.tables.blockTable.newIterator()), _f = _e.next(); !_f.done; _f = _e.next()) {
904
+ var btr = _f.value;
905
+ if (!btr.isPaperSapce || btr.layoutId)
906
+ continue;
907
+ dbLayout.blockTableRecordId = btr.objectId;
908
+ btr.layoutId = dbLayout.objectId;
909
+ break;
910
+ }
911
+ }
912
+ catch (e_4_1) { e_4 = { error: e_4_1 }; }
913
+ finally {
914
+ try {
915
+ if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
916
+ }
917
+ finally { if (e_4) throw e_4.error; }
918
+ }
862
919
  }
863
920
  }
864
921
  dbLayout.limits.min.copy(layout.minLimit);
@@ -917,7 +974,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
917
974
  });
918
975
  };
919
976
  AcDbLibreDwgConverter.prototype.processScales = function (model, db) {
920
- var e_4, _a;
977
+ var e_5, _a;
921
978
  var scales = this.optionalObjectArray(model, 'SCALE');
922
979
  if (!(scales === null || scales === void 0 ? void 0 : scales.length))
923
980
  return;
@@ -932,16 +989,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
932
989
  scaleDict.setAt(key, dbScale);
933
990
  }
934
991
  }
935
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
992
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
936
993
  finally {
937
994
  try {
938
995
  if (scales_1_1 && !scales_1_1.done && (_a = scales_1.return)) _a.call(scales_1);
939
996
  }
940
- finally { if (e_4) throw e_4.error; }
997
+ finally { if (e_5) throw e_5.error; }
941
998
  }
942
999
  };
943
1000
  AcDbLibreDwgConverter.prototype.processDictionaryVars = function (model, db) {
944
- var e_5, _a;
1001
+ var e_6, _a;
945
1002
  var dictVars = this.optionalObjectArray(model, 'DICTIONARYVAR');
946
1003
  if (!(dictVars === null || dictVars === void 0 ? void 0 : dictVars.length))
947
1004
  return;
@@ -955,16 +1012,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
955
1012
  dictVarDict.setAt(dbVar.objectId, dbVar);
956
1013
  }
957
1014
  }
958
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1015
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
959
1016
  finally {
960
1017
  try {
961
1018
  if (dictVars_1_1 && !dictVars_1_1.done && (_a = dictVars_1.return)) _a.call(dictVars_1);
962
1019
  }
963
- finally { if (e_5) throw e_5.error; }
1020
+ finally { if (e_6) throw e_6.error; }
964
1021
  }
965
1022
  };
966
1023
  AcDbLibreDwgConverter.prototype.processMTextObjectContextData = function (model, db) {
967
- var e_6, _a;
1024
+ var e_7, _a;
968
1025
  var _b;
969
1026
  var contexts = (_b = this.optionalObjectArray(model, 'MTEXTOBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_MTEXTOBJECTCONTEXTDATA_CLASS');
970
1027
  if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
@@ -979,16 +1036,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
979
1036
  contextDict.setAt(dbContext.objectId, dbContext);
980
1037
  }
981
1038
  }
982
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1039
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
983
1040
  finally {
984
1041
  try {
985
1042
  if (contexts_1_1 && !contexts_1_1.done && (_a = contexts_1.return)) _a.call(contexts_1);
986
1043
  }
987
- finally { if (e_6) throw e_6.error; }
1044
+ finally { if (e_7) throw e_7.error; }
988
1045
  }
989
1046
  };
990
1047
  AcDbLibreDwgConverter.prototype.processDimensionObjectContextData = function (model, db) {
991
- var e_7, _a, e_8, _b;
1048
+ var e_8, _a, e_9, _b;
992
1049
  var keys = [
993
1050
  'ALDIMOBJECTCONTEXTDATA',
994
1051
  'ACDB_ALDIMOBJECTCONTEXTDATA_CLASS',
@@ -1016,7 +1073,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1016
1073
  if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
1017
1074
  continue;
1018
1075
  try {
1019
- for (var contexts_2 = (e_8 = void 0, __values(contexts)), contexts_2_1 = contexts_2.next(); !contexts_2_1.done; contexts_2_1 = contexts_2.next()) {
1076
+ for (var contexts_2 = (e_9 = void 0, __values(contexts)), contexts_2_1 = contexts_2.next(); !contexts_2_1.done; contexts_2_1 = contexts_2.next()) {
1020
1077
  var context = contexts_2_1.value;
1021
1078
  var dbContext = objectConverter.convertDimensionObjectContextData(context);
1022
1079
  if (dbContext.objectId) {
@@ -1024,25 +1081,25 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1024
1081
  }
1025
1082
  }
1026
1083
  }
1027
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
1084
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1028
1085
  finally {
1029
1086
  try {
1030
1087
  if (contexts_2_1 && !contexts_2_1.done && (_b = contexts_2.return)) _b.call(contexts_2);
1031
1088
  }
1032
- finally { if (e_8) throw e_8.error; }
1089
+ finally { if (e_9) throw e_9.error; }
1033
1090
  }
1034
1091
  }
1035
1092
  }
1036
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
1093
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1037
1094
  finally {
1038
1095
  try {
1039
1096
  if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
1040
1097
  }
1041
- finally { if (e_7) throw e_7.error; }
1098
+ finally { if (e_8) throw e_8.error; }
1042
1099
  }
1043
1100
  };
1044
1101
  AcDbLibreDwgConverter.prototype.processTextObjectContextData = function (model, db) {
1045
- var e_9, _a;
1102
+ var e_10, _a;
1046
1103
  var _b;
1047
1104
  var contexts = (_b = this.optionalObjectArray(model, 'TEXTOBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_TEXTOBJECTCONTEXTDATA_CLASS');
1048
1105
  if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
@@ -1057,16 +1114,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1057
1114
  contextDict.setAt(dbContext.objectId, dbContext);
1058
1115
  }
1059
1116
  }
1060
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
1117
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
1061
1118
  finally {
1062
1119
  try {
1063
1120
  if (contexts_3_1 && !contexts_3_1.done && (_a = contexts_3.return)) _a.call(contexts_3);
1064
1121
  }
1065
- finally { if (e_9) throw e_9.error; }
1122
+ finally { if (e_10) throw e_10.error; }
1066
1123
  }
1067
1124
  };
1068
1125
  AcDbLibreDwgConverter.prototype.processHatchScaleContextData = function (model, db) {
1069
- var e_10, _a;
1126
+ var e_11, _a;
1070
1127
  var _b;
1071
1128
  var contexts = (_b = this.optionalObjectArray(model, 'HATCHSCALECONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_HATCHSCALECONTEXTDATA_CLASS');
1072
1129
  if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
@@ -1081,16 +1138,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1081
1138
  contextDict.setAt(dbContext.objectId, dbContext);
1082
1139
  }
1083
1140
  }
1084
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
1141
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
1085
1142
  finally {
1086
1143
  try {
1087
1144
  if (contexts_4_1 && !contexts_4_1.done && (_a = contexts_4.return)) _a.call(contexts_4);
1088
1145
  }
1089
- finally { if (e_10) throw e_10.error; }
1146
+ finally { if (e_11) throw e_11.error; }
1090
1147
  }
1091
1148
  };
1092
1149
  AcDbLibreDwgConverter.prototype.processBlkRefObjectContextData = function (model, db) {
1093
- var e_11, _a;
1150
+ var e_12, _a;
1094
1151
  var _b;
1095
1152
  var contexts = (_b = this.optionalObjectArray(model, 'BLKREFOBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_BLKREFOBJECTCONTEXTDATA_CLASS');
1096
1153
  if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
@@ -1105,16 +1162,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1105
1162
  contextDict.setAt(dbContext.objectId, dbContext);
1106
1163
  }
1107
1164
  }
1108
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
1165
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
1109
1166
  finally {
1110
1167
  try {
1111
1168
  if (contexts_5_1 && !contexts_5_1.done && (_a = contexts_5.return)) _a.call(contexts_5);
1112
1169
  }
1113
- finally { if (e_11) throw e_11.error; }
1170
+ finally { if (e_12) throw e_12.error; }
1114
1171
  }
1115
1172
  };
1116
1173
  AcDbLibreDwgConverter.prototype.processLeaderObjectContextData = function (model, db) {
1117
- var e_12, _a;
1174
+ var e_13, _a;
1118
1175
  var _b;
1119
1176
  var contexts = (_b = this.optionalObjectArray(model, 'LEADEROBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_LEADEROBJECTCONTEXTDATA_CLASS');
1120
1177
  if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
@@ -1129,16 +1186,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1129
1186
  contextDict.setAt(dbContext.objectId, dbContext);
1130
1187
  }
1131
1188
  }
1132
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
1189
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
1133
1190
  finally {
1134
1191
  try {
1135
1192
  if (contexts_6_1 && !contexts_6_1.done && (_a = contexts_6.return)) _a.call(contexts_6);
1136
1193
  }
1137
- finally { if (e_12) throw e_12.error; }
1194
+ finally { if (e_13) throw e_13.error; }
1138
1195
  }
1139
1196
  };
1140
1197
  AcDbLibreDwgConverter.prototype.processMLeaderObjectContextData = function (model, db) {
1141
- var e_13, _a;
1198
+ var e_14, _a;
1142
1199
  var _b;
1143
1200
  var contexts = (_b = this.optionalObjectArray(model, 'MLEADEROBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_MLEADEROBJECTCONTEXTDATA_CLASS');
1144
1201
  if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
@@ -1153,16 +1210,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1153
1210
  contextDict.setAt(dbContext.objectId, dbContext);
1154
1211
  }
1155
1212
  }
1156
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
1213
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
1157
1214
  finally {
1158
1215
  try {
1159
1216
  if (contexts_7_1 && !contexts_7_1.done && (_a = contexts_7.return)) _a.call(contexts_7);
1160
1217
  }
1161
- finally { if (e_13) throw e_13.error; }
1218
+ finally { if (e_14) throw e_14.error; }
1162
1219
  }
1163
1220
  };
1164
1221
  AcDbLibreDwgConverter.prototype.processMTextAttributeObjectContextData = function (model, db) {
1165
- var e_14, _a;
1222
+ var e_15, _a;
1166
1223
  var _b;
1167
1224
  var contexts = (_b = this.optionalObjectArray(model, 'MTEXTATTRIBUTEOBJECTCONTEXTDATA')) !== null && _b !== void 0 ? _b : this.optionalObjectArray(model, 'ACDB_MTEXTATTRIBUTEOBJECTCONTEXTDATA_CLASS');
1168
1225
  if (!(contexts === null || contexts === void 0 ? void 0 : contexts.length))
@@ -1177,16 +1234,16 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1177
1234
  contextDict.setAt(dbContext.objectId, dbContext);
1178
1235
  }
1179
1236
  }
1180
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
1237
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
1181
1238
  finally {
1182
1239
  try {
1183
1240
  if (contexts_8_1 && !contexts_8_1.done && (_a = contexts_8.return)) _a.call(contexts_8);
1184
1241
  }
1185
- finally { if (e_14) throw e_14.error; }
1242
+ finally { if (e_15) throw e_15.error; }
1186
1243
  }
1187
1244
  };
1188
1245
  AcDbLibreDwgConverter.prototype.processXRecords = function (model, db) {
1189
- var e_15, _a;
1246
+ var e_16, _a;
1190
1247
  var xrecords = model.objects.XRECORD;
1191
1248
  if (!(xrecords === null || xrecords === void 0 ? void 0 : xrecords.length))
1192
1249
  return;
@@ -1200,12 +1257,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1200
1257
  xrecordDict.setAt(dbXrecord.objectId, dbXrecord);
1201
1258
  }
1202
1259
  }
1203
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
1260
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
1204
1261
  finally {
1205
1262
  try {
1206
1263
  if (xrecords_1_1 && !xrecords_1_1.done && (_a = xrecords_1.return)) _a.call(xrecords_1);
1207
1264
  }
1208
- finally { if (e_15) throw e_15.error; }
1265
+ finally { if (e_16) throw e_16.error; }
1209
1266
  }
1210
1267
  };
1211
1268
  /**
@@ -1213,7 +1270,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1213
1270
  * the ACAD_GROUP dictionary so ObjectARX-style names are available.
1214
1271
  */
1215
1272
  AcDbLibreDwgConverter.prototype.processGroups = function (model, db) {
1216
- var e_16, _a, e_17, _b, e_18, _c, e_19, _d;
1273
+ var e_17, _a, e_18, _b, e_19, _c, e_20, _d;
1217
1274
  var _e, _f, _g, _h;
1218
1275
  var groups = (_e = model.objects.GROUP) !== null && _e !== void 0 ? _e : this.optionalObjectArray(model, 'GROUP');
1219
1276
  if (!(groups === null || groups === void 0 ? void 0 : groups.length))
@@ -1236,12 +1293,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1236
1293
  byHandle.set(normalize(dbGroup.objectId), dbGroup);
1237
1294
  }
1238
1295
  }
1239
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
1296
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
1240
1297
  finally {
1241
1298
  try {
1242
1299
  if (groups_1_1 && !groups_1_1.done && (_a = groups_1.return)) _a.call(groups_1);
1243
1300
  }
1244
- finally { if (e_16) throw e_16.error; }
1301
+ finally { if (e_17) throw e_17.error; }
1245
1302
  }
1246
1303
  // Resolve ACAD_GROUP dictionary entry names → group.name / dict keys.
1247
1304
  var acadGroupHandle = '';
@@ -1255,12 +1312,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1255
1312
  }
1256
1313
  }
1257
1314
  }
1258
- catch (e_17_1) { e_17 = { error: e_17_1 }; }
1315
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
1259
1316
  finally {
1260
1317
  try {
1261
1318
  if (_k && !_k.done && (_b = _j.return)) _b.call(_j);
1262
1319
  }
1263
- finally { if (e_17) throw e_17.error; }
1320
+ finally { if (e_18) throw e_18.error; }
1264
1321
  }
1265
1322
  if (!acadGroupHandle)
1266
1323
  return;
@@ -1276,7 +1333,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1276
1333
  continue;
1277
1334
  var storedKey = void 0;
1278
1335
  try {
1279
- for (var _p = (e_19 = void 0, __values(groupDict.entries())), _q = _p.next(); !_q.done; _q = _p.next()) {
1336
+ for (var _p = (e_20 = void 0, __values(groupDict.entries())), _q = _p.next(); !_q.done; _q = _p.next()) {
1280
1337
  var _r = __read(_q.value, 2), key = _r[0], existing = _r[1];
1281
1338
  if (normalize(existing.objectId) === handle) {
1282
1339
  storedKey = key;
@@ -1284,12 +1341,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1284
1341
  }
1285
1342
  }
1286
1343
  }
1287
- catch (e_19_1) { e_19 = { error: e_19_1 }; }
1344
+ catch (e_20_1) { e_20 = { error: e_20_1 }; }
1288
1345
  finally {
1289
1346
  try {
1290
1347
  if (_q && !_q.done && (_d = _p.return)) _d.call(_p);
1291
1348
  }
1292
- finally { if (e_19) throw e_19.error; }
1349
+ finally { if (e_20) throw e_20.error; }
1293
1350
  }
1294
1351
  var occupied = groupDict.getAt(entryName);
1295
1352
  if (occupied && occupied !== group) {
@@ -1306,12 +1363,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1306
1363
  group.name = entryName;
1307
1364
  }
1308
1365
  }
1309
- catch (e_18_1) { e_18 = { error: e_18_1 }; }
1366
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
1310
1367
  finally {
1311
1368
  try {
1312
1369
  if (_m && !_m.done && (_c = _l.return)) _c.call(_l);
1313
1370
  }
1314
- finally { if (e_18) throw e_18.error; }
1371
+ finally { if (e_19) throw e_19.error; }
1315
1372
  }
1316
1373
  };
1317
1374
  /**
@@ -1319,7 +1376,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1319
1376
  * dictionaries have been materialized.
1320
1377
  */
1321
1378
  AcDbLibreDwgConverter.prototype.finishCannoscale = function (model, db) {
1322
- var e_20, _a;
1379
+ var e_21, _a;
1323
1380
  var _b, _c;
1324
1381
  var tryRead = function (variableDict) {
1325
1382
  var cannoscaleVar = variableDict.getAt('CANNOSCALE');
@@ -1360,19 +1417,19 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1360
1417
  return;
1361
1418
  }
1362
1419
  }
1363
- catch (e_20_1) { e_20 = { error: e_20_1 }; }
1420
+ catch (e_21_1) { e_21 = { error: e_21_1 }; }
1364
1421
  finally {
1365
1422
  try {
1366
1423
  if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1367
1424
  }
1368
- finally { if (e_20) throw e_20.error; }
1425
+ finally { if (e_21) throw e_21.error; }
1369
1426
  }
1370
1427
  };
1371
1428
  /**
1372
1429
  * Reads ANNOALLVISIBLE from AcDbVariableDictionary → DICTIONARYVAR.
1373
1430
  */
1374
1431
  AcDbLibreDwgConverter.prototype.finishAnnoallvisible = function (model, db) {
1375
- var e_21, _a;
1432
+ var e_22, _a;
1376
1433
  var _b, _c;
1377
1434
  var tryRead = function (variableDict) {
1378
1435
  var annoVar = variableDict.getAt('ANNOALLVISIBLE');
@@ -1405,12 +1462,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1405
1462
  return;
1406
1463
  }
1407
1464
  }
1408
- catch (e_21_1) { e_21 = { error: e_21_1 }; }
1465
+ catch (e_22_1) { e_22 = { error: e_22_1 }; }
1409
1466
  finally {
1410
1467
  try {
1411
1468
  if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
1412
1469
  }
1413
- finally { if (e_21) throw e_21.error; }
1470
+ finally { if (e_22) throw e_22.error; }
1414
1471
  }
1415
1472
  };
1416
1473
  /** Reads optional object arrays that newer libredwg-web builds may expose. */
@@ -1439,7 +1496,7 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1439
1496
  * @returns A new array of entities grouped by their `type` property.
1440
1497
  */
1441
1498
  AcDbLibreDwgConverter.prototype.groupAndFlattenByType = function (entities) {
1442
- var e_22, _a, e_23, _b;
1499
+ var e_23, _a, e_24, _b;
1443
1500
  var groups = {};
1444
1501
  var order = [];
1445
1502
  try {
@@ -1452,12 +1509,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1452
1509
  groups[entity.type].push(entity);
1453
1510
  }
1454
1511
  }
1455
- catch (e_22_1) { e_22 = { error: e_22_1 }; }
1512
+ catch (e_23_1) { e_23 = { error: e_23_1 }; }
1456
1513
  finally {
1457
1514
  try {
1458
1515
  if (entities_1_1 && !entities_1_1.done && (_a = entities_1.return)) _a.call(entities_1);
1459
1516
  }
1460
- finally { if (e_22) throw e_22.error; }
1517
+ finally { if (e_23) throw e_23.error; }
1461
1518
  }
1462
1519
  var result = [];
1463
1520
  try {
@@ -1470,12 +1527,12 @@ var AcDbLibreDwgConverter = /** @class */ (function (_super) {
1470
1527
  }
1471
1528
  }
1472
1529
  }
1473
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
1530
+ catch (e_24_1) { e_24 = { error: e_24_1 }; }
1474
1531
  finally {
1475
1532
  try {
1476
1533
  if (order_1_1 && !order_1_1.done && (_b = order_1.return)) _b.call(order_1);
1477
1534
  }
1478
- finally { if (e_23) throw e_23.error; }
1535
+ finally { if (e_24) throw e_24.error; }
1479
1536
  }
1480
1537
  return result;
1481
1538
  };